RESOLVED FIXED 168610
[MediaStream iOS] Respond to capture interruptions and notifications
https://bugs.webkit.org/show_bug.cgi?id=168610
Summary [MediaStream iOS] Respond to capture interruptions and notifications
Eric Carlson
Reported 2017-02-20 12:59:49 PST
Respond to capture interruptions and notifications
Attachments
Proposed patch (22.44 KB, patch)
2017-02-20 15:17 PST, Eric Carlson
no flags
Patch for landing. (22.39 KB, patch)
2017-02-22 11:29 PST, Eric Carlson
no flags
Eric Carlson
Comment 1 2017-02-20 15:17:06 PST
Created attachment 302179 [details] Proposed patch
WebKit Commit Bot
Comment 2 2017-02-20 15:19:33 PST
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.
Jer Noble
Comment 3 2017-02-21 14:19:11 PST
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.
Radar WebKit Bug Importer
Comment 4 2017-02-22 11:19:36 PST
Eric Carlson
Comment 5 2017-02-22 11:29:48 PST
Created attachment 302420 [details] Patch for landing.
WebKit Commit Bot
Comment 6 2017-02-22 12:08:44 PST
Comment on attachment 302420 [details] Patch for landing. Clearing flags on attachment: 302420 Committed r212844: <http://trac.webkit.org/changeset/212844>
Note You need to log in before you can comment on or make changes to this bug.