RESOLVED FIXED 191587
[MediaStream] Observer AVCaptureDevice "suspended" property
https://bugs.webkit.org/show_bug.cgi?id=191587
Summary [MediaStream] Observer AVCaptureDevice "suspended" property
Eric Carlson
Reported 2018-11-13 09:07:48 PST
On macOS the AVCaptureDevice property "suspended" changes when the device stops/resumes producing data because, e.g. the laptop lid is closed. Changes to this property should trigger mediaDevices.ondevicechange and MediaStreamTrack.onmute/MediaStreamTrack.onunmute events.
Attachments
Patch (15.85 KB, patch)
2018-11-13 09:24 PST, Eric Carlson
no flags
Patch for landing (15.74 KB, patch)
2018-11-13 13:40 PST, Eric Carlson
no flags
Radar WebKit Bug Importer
Comment 1 2018-11-13 09:10:34 PST
Eric Carlson
Comment 2 2018-11-13 09:24:43 PST
youenn fablet
Comment 3 2018-11-13 10:35:12 PST
Comment on attachment 354675 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=354675&action=review > Source/WebCore/platform/mediastream/mac/AVCaptureDeviceManager.h:72 > + RetainPtr<NSMutableArray> m_AVCaptureDevices; Should it be named m_avCaptureDevices? > Source/WebCore/platform/mediastream/mac/AVCaptureDeviceManager.mm:145 > + stopObservingDevices(scratchArray.get()); I would tend to move the computation of removed devices in stopObservingDevices. That way, it is clear that we are doing the right thing in terms of begin/stop observing. It seems we might iterate twice over currentDevices but that might not be a big deal. s/beginObserving/startObserving? > Source/WebCore/platform/mediastream/mac/AVCaptureDeviceManager.mm:159 > + deviceList.append(captureDevice); WTFMove(captureDevice). > Source/WebCore/platform/mediastream/mac/AVCaptureDeviceManager.mm:171 > + m_devices = deviceList; WTFMove(deviceList); > Source/WebCore/platform/mediastream/mac/AVVideoCaptureSource.mm:556 > + notifyMutedChange(isSuspended); notifyMutedChange is checking whether muted == m_muted, so we might be able to just write; notifyMutedChange([m_device isSuspended]);
Eric Carlson
Comment 4 2018-11-13 13:40:41 PST
Created attachment 354697 [details] Patch for landing
WebKit Commit Bot
Comment 5 2018-11-13 14:21:09 PST
Comment on attachment 354697 [details] Patch for landing Clearing flags on attachment: 354697 Committed r238145: <https://trac.webkit.org/changeset/238145>
WebKit Commit Bot
Comment 6 2018-11-13 14:21:10 PST
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.