Steps to reproduce: 1. Plug in a USB web cam 2. Go to https://output.jsbin.com/fofeyan 3. Choose the USB webcam as your camera and click the switch device button 4. Allow access to the camera and wait for it to be acquired. 5. Unplug the USB webcam Expected result: You get an alert saying 'track ended'. This happens in Chrome and Firefox. But in Safari there is no 'ended' Event on the MediaStreamTrack. I tested this in Safari Tech Preview 12.0 and it's not firing there either.
<rdar://problem/42681445>
Created attachment 357973 [details] Patch
Created attachment 357978 [details] Patch
View in context: https://bugs.webkit.org/attachment.cgi?id=357973&action=review > Source/WebCore/platform/mediastream/mac/AVVideoCaptureSource.mm:636 > + AVCaptureDeviceTypedef *device = [notification object]; > + if (this->device() == device) Nit: You don't seem to need the local variable here. > Source/WebCore/platform/mediastream/mac/AVVideoCaptureSource.mm:726 > + if (!m_callback) > + return; > + > + m_callback->deviceDisconnected(notification); Nit: how about: if (m_callback) m_callback->deviceDisconnected(notification); > Source/WebCore/platform/mediastream/mac/CoreAudioCaptureDeviceManager.cpp:95 > + bool isNonAggregable = !name || !String { name }.startsWith("com.apple.audio.CoreAudio"); Woah, that looks super weird. I realize that brace-initialization is the new hotness, but I don't think it's supposed to be used for anonymous variables like this.
Comment on attachment 357978 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=357978&action=review > Source/WebCore/platform/mediastream/mac/CoreAudioCaptureSource.cpp:206 > +void CoreAudioSharedUnit::setCaptureDevice(const String& persistentID, uint32_t captureDeviceID) Could be String&& > Source/WebCore/platform/mediastream/mac/CoreAudioCaptureSource.cpp:232 > + } Nit: use WTF::anyOf
Created attachment 357988 [details] Patch for landing.
Comment on attachment 357988 [details] Patch for landing. Clearing flags on attachment: 357988 Committed r239531: <https://trac.webkit.org/changeset/239531>
All reviewed patches have been landed. Closing bug.