Bug 187896

Summary: 'ended' Event doesn't fire on MediaStreamTrack when a USB camera is unplugged
Product: WebKit Reporter: Adam <adam>
Component: WebRTCAssignee: Eric Carlson <eric.carlson>
Status: RESOLVED FIXED    
Severity: Normal CC: commit-queue, eric.carlson, jer.noble, jonlee, webkit-bug-importer, youennf
Priority: P2 Keywords: InRadar
Version: Safari Technology Preview   
Hardware: Mac   
OS: macOS 10.13   
Attachments:
Description Flags
Patch
none
Patch
none
Patch for landing. none

Adam
Reported 2018-07-22 18:32:11 PDT
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.
Attachments
Patch (18.67 KB, patch)
2018-12-21 13:22 PST, Eric Carlson
no flags
Patch (18.87 KB, patch)
2018-12-21 14:04 PST, Eric Carlson
no flags
Patch for landing. (18.95 KB, patch)
2018-12-21 15:15 PST, Eric Carlson
no flags
Radar WebKit Bug Importer
Comment 1 2018-07-27 17:33:21 PDT
Eric Carlson
Comment 2 2018-12-21 13:22:41 PST
Eric Carlson
Comment 3 2018-12-21 14:04:04 PST
Jer Noble
Comment 4 2018-12-21 14:13:13 PST
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.
youenn fablet
Comment 5 2018-12-21 14:24:21 PST
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
Eric Carlson
Comment 6 2018-12-21 15:15:48 PST
Created attachment 357988 [details] Patch for landing.
WebKit Commit Bot
Comment 7 2018-12-21 17:37:08 PST
Comment on attachment 357988 [details] Patch for landing. Clearing flags on attachment: 357988 Committed r239531: <https://trac.webkit.org/changeset/239531>
WebKit Commit Bot
Comment 8 2018-12-21 17:37: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.