Changeset 5867 for pjproject


Ignore:
Timestamp:
Aug 23, 2018 4:48:03 AM (10 months ago)
Author:
ming
Message:

Re #2103: Darwin's capture device is passive, thus the video port's clock will fetch the frames much earlier than when the device is ready, getting zero frames and resulting in green screen on the remote side.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjmedia/src/pjmedia-videodev/darwin_dev.m

    r5628 r5867  
    142142    AVCaptureSession            *cap_session; 
    143143    AVCaptureDeviceInput        *dev_input; 
     144    pj_bool_t                    has_image; 
    144145    AVCaptureVideoDataOutput    *video_output; 
    145146    VOutDelegate                *vout_delegate; 
     
    547548 
    548549    [stream->frame_lock lock]; 
     550    stream->has_image = PJ_TRUE; 
    549551     
    550552    if (stream->is_planar && stream->capture_buf) { 
     
    569571             
    570572            p = (pj_uint8_t*)CVPixelBufferGetBaseAddressOfPlane(img, 0); 
     573 
    571574            p_len = stream->vid_size.w * stream->vid_size.h; 
    572575            Y = (pj_uint8_t*)stream->capture_buf; 
     
    630633{ 
    631634    struct darwin_stream *stream = (struct darwin_stream *)strm; 
     635 
     636    if (!stream->has_image) { 
     637        frame->size = 0; 
     638        frame->type = PJMEDIA_FRAME_TYPE_NONE; 
     639        frame->timestamp.u64 = stream->frame_ts.u64; 
     640        return PJMEDIA_EVID_NOTREADY; 
     641    } 
    632642 
    633643    frame->type = PJMEDIA_FRAME_TYPE_VIDEO; 
     
    13031313        [stream->cap_session stopRunning]; 
    13041314    }); 
     1315    stream->has_image = PJ_FALSE; 
    13051316     
    13061317    return PJ_SUCCESS; 
Note: See TracChangeset for help on using the changeset viewer.