Ignore:
Timestamp:
Sep 3, 2018 7:36:46 AM (6 years ago)
Author:
ming
Message:

Re #2059 (misc): Add log for error info when Darwin capture session fails to start running or encounters an error during runtime.

File:
1 edited

Legend:

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

    r5867 r5873  
    523523#endif 
    524524 
     525- (void)session_runtime_error:(NSNotification *)notification 
     526{ 
     527    NSError *error = notification.userInfo[AVCaptureSessionErrorKey]; 
     528    PJ_LOG(3, (THIS_FILE, "Capture session runtime error: %s, %s", 
     529               [error localizedDescription], 
     530               [error localizedFailureReason])); 
     531} 
     532 
    525533- (void)captureOutput:(AVCaptureOutput *)captureOutput  
    526534                      didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer 
     
    865873        [strm->video_output setSampleBufferDelegate:strm->vout_delegate 
    866874                            queue:strm->queue]; 
     875 
     876        /* Add observer to catch notification when the capture session 
     877         * fails to start running or encounters an error during runtime. 
     878         */ 
     879        [[NSNotificationCenter defaultCenter] addObserver:strm->vout_delegate 
     880            selector:@selector(session_runtime_error:) 
     881            name:AVCaptureSessionRuntimeErrorNotification 
     882            object:strm->cap_session]; 
    867883         
    868884        if ([strm->cap_session canAddOutput:strm->video_output]) { 
Note: See TracChangeset for help on using the changeset viewer.