Respond to capture interruptions and notifications
Created attachment 302179 [details] Proposed patch
Attachment 302179 [details] did not pass style-queue: ERROR: Source/WebCore/platform/mediastream/mac/AVMediaCaptureSource.mm:423: This { should be at the end of the previous line [whitespace/braces] [4] Total errors found: 1 in 4 files If any of these errors are false positives, please file a bug against check-webkit-style.
Comment on attachment 302179 [details] Proposed patch View in context: https://bugs.webkit.org/attachment.cgi?id=302179&action=review r=me, with nits: > Source/WebCore/platform/mediastream/mac/AVMediaCaptureSource.mm:83 > +#if PLATFORM(IOS) > +SOFT_LINK_POINTER(AVFoundation, AVCaptureSessionRuntimeErrorNotification, NSString *) > +SOFT_LINK_POINTER(AVFoundation, AVCaptureSessionWasInterruptedNotification, NSString *) > +SOFT_LINK_POINTER(AVFoundation, AVCaptureSessionInterruptionEndedNotification, NSString *) > +SOFT_LINK_POINTER(AVFoundation, AVCaptureSessionInterruptionReasonKey, NSString *) > +SOFT_LINK_POINTER(AVFoundation, AVCaptureSessionErrorKey, NSString *) > +#endif Rather than defining these only on IOS, you could make these SOFT_LINK_POINTER_OPTIONAL(). > Source/WebCore/platform/mediastream/mac/AVMediaCaptureSource.mm:169 > + if (![m_session isRunning]) > + return; > + > + [m_session stopRunning]; Seems like this could just be: if ([m_session isRunning]) [m_session stopRunning]; > Source/WebCore/platform/mediastream/mac/AVMediaCaptureSource.mm:180 > + [m_objcObserver.get() addNotificationObservers]; You shouldn't need the .get() here. > Source/WebCore/platform/mediastream/mac/AVMediaCaptureSource.mm:189 > + [m_objcObserver.get() removeNotificationObservers]; Ditto. > Source/WebCore/platform/mediastream/mac/AVMediaCaptureSource.mm:365 > + [center addObserver:self selector:@selector(sessionRuntimeError:) name:AVCaptureSessionRuntimeErrorNotification object:session]; > + [center addObserver:self selector:@selector(beginSessionInterrupted:) name:AVCaptureSessionWasInterruptedNotification object:session]; > + [center addObserver:self selector:@selector(endSessionInterrupted:) name:AVCaptureSessionInterruptionEndedNotification object:session]; Though, if you make the notification names _OPTIONAL, you'll have to check them before adding observers here. > Source/WebCore/platform/mediastream/mac/AVMediaCaptureSource.mm:419 > + if (!m_callback) > + return; > + > + m_callback->captureSessionRuntimeError(error); This could be: if (m_callback) m_callback->captureSessionRuntimeError(error); > Source/WebCore/platform/mediastream/mac/AVMediaCaptureSource.mm:429 > + if (!m_callback) > + return; > + > + m_callback->captureSessionBeginInterruption(notification); Ditto. > Source/WebCore/platform/mediastream/mac/AVMediaCaptureSource.mm:440 > + if (!m_callback) > + return; > + > + m_callback->captureSessionEndInterruption(notification); Ditto.
<rdar://problem/30656822>
Created attachment 302420 [details] Patch for landing.
Comment on attachment 302420 [details] Patch for landing. Clearing flags on attachment: 302420 Committed r212844: <http://trac.webkit.org/changeset/212844>