RESOLVED FIXED 180206
[MediaStream] Use CaptureDevice instead of device ID to identify devices
https://bugs.webkit.org/show_bug.cgi?id=180206
Summary [MediaStream] Use CaptureDevice instead of device ID to identify devices
Eric Carlson
Reported 2017-11-30 10:29:07 PST
Use CaptureDevice instead of device ID to identify devices when requesting user permission.
Attachments
Proposed patch. (52.90 KB, patch)
2017-11-30 11:44 PST, Eric Carlson
ews-watchlist: commit-queue-
Archive of layout-test-results from ews105 for mac-elcapitan-wk2 (3.08 MB, application/zip)
2017-11-30 12:55 PST, EWS Watchlist
no flags
Updated patch. (53.46 KB, patch)
2017-11-30 13:53 PST, Eric Carlson
no flags
Updated patch. (53.61 KB, patch)
2017-11-30 14:13 PST, Eric Carlson
no flags
Patch for landing. (58.90 KB, patch)
2017-12-01 09:21 PST, Eric Carlson
no flags
Radar WebKit Bug Importer
Comment 1 2017-11-30 10:29:48 PST
Eric Carlson
Comment 2 2017-11-30 11:44:31 PST
Created attachment 328001 [details] Proposed patch.
EWS Watchlist
Comment 3 2017-11-30 12:55:05 PST
Comment on attachment 328001 [details] Proposed patch. Attachment 328001 [details] did not pass mac-wk2-ews (mac-wk2): Output: http://webkit-queues.webkit.org/results/5421399 New failing tests: fast/mediastream/getUserMedia-grant-persistency.html fast/mediastream/getUserMedia-grant-persistency2.html http/tests/media/media-stream/get-user-media-prompt.html
EWS Watchlist
Comment 4 2017-11-30 12:55:06 PST
Created attachment 328008 [details] Archive of layout-test-results from ews105 for mac-elcapitan-wk2 The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews. Bot: ews105 Port: mac-elcapitan-wk2 Platform: Mac OS X 10.11.6
Eric Carlson
Comment 5 2017-11-30 13:53:30 PST
Created attachment 328018 [details] Updated patch.
Eric Carlson
Comment 6 2017-11-30 14:13:17 PST
Created attachment 328025 [details] Updated patch.
youenn fablet
Comment 7 2017-11-30 21:18:09 PST
Comment on attachment 328025 [details] Updated patch. View in context: https://bugs.webkit.org/attachment.cgi?id=328025&action=review > Source/WebCore/Modules/mediastream/UserMediaRequest.cpp:158 > +void UserMediaRequest::allow(std::optional<CaptureDevice>&& audioDevice, std::optional<CaptureDevice>&& videoDevice, String&& deviceIdentifierHashSalt) An alternative to std::optional would be to consider that there is no CaptureDevice if CaptureDevice.persistentId is the null string or its type is none (i.e. default constructed CaptureDevice). We could also have added an operator bool or helper method to know whether CaptureDevice was valid or not like optional has. Not sure what is best, but optional is fine to me. > Source/WebCore/Modules/mediastream/UserMediaRequest.cpp:162 > + m_allowedVideoDevice = videoDevice; We can probably move audioDevice/videoDevice. > Source/WebKit/UIProcess/UserMediaPermissionRequestManagerProxy.cpp:219 > +void UserMediaPermissionRequestManagerProxy::grantAccess(uint64_t userMediaID, std::optional<CaptureDevice> audioDevice, std::optional<CaptureDevice> videoDevice, const String& deviceIdentifierHashSalt) Should be const std::optional<CaptureDevice>& probably. > Source/WebKit/UIProcess/UserMediaPermissionRequestManagerProxy.cpp:221 > + UserMediaProcessManager::singleton().willCreateMediaStream(*this, audioDevice.has_value(), videoDevice.has_value()); could use !!audioDevice instead of has_value. > Source/WebKit/UIProcess/UserMediaPermissionRequestProxy.h:54 > + const Vector<String> audioDeviceUIDs() const; Can we use Vector<> instead of const Vector<>?
Eric Carlson
Comment 8 2017-12-01 09:19:30 PST
Comment on attachment 328025 [details] Updated patch. View in context: https://bugs.webkit.org/attachment.cgi?id=328025&action=review >> Source/WebCore/Modules/mediastream/UserMediaRequest.cpp:158 >> +void UserMediaRequest::allow(std::optional<CaptureDevice>&& audioDevice, std::optional<CaptureDevice>&& videoDevice, String&& deviceIdentifierHashSalt) > > An alternative to std::optional would be to consider that there is no CaptureDevice if CaptureDevice.persistentId is the null string or its type is none (i.e. default constructed CaptureDevice). > We could also have added an operator bool or helper method to know whether CaptureDevice was valid or not like optional has. > Not sure what is best, but optional is fine to me. Good idea. I added an operator bool that checks type != Unknown. >> Source/WebCore/Modules/mediastream/UserMediaRequest.cpp:162 >> + m_allowedVideoDevice = videoDevice; > > We can probably move audioDevice/videoDevice. That doesn't work because we have to WTFMove() the device parameters to RealtimeMediaSourceCenter::createMediaStream. >> Source/WebKit/UIProcess/UserMediaPermissionRequestManagerProxy.cpp:219 >> +void UserMediaPermissionRequestManagerProxy::grantAccess(uint64_t userMediaID, std::optional<CaptureDevice> audioDevice, std::optional<CaptureDevice> videoDevice, const String& deviceIdentifierHashSalt) > > Should be const std::optional<CaptureDevice>& probably. Fixed. >> Source/WebKit/UIProcess/UserMediaPermissionRequestManagerProxy.cpp:221 >> + UserMediaProcessManager::singleton().willCreateMediaStream(*this, audioDevice.has_value(), videoDevice.has_value()); > > could use !!audioDevice instead of has_value. I did that at first but changed to has_value at some point. Reconsidering, I think you are right. >> Source/WebKit/UIProcess/UserMediaPermissionRequestProxy.h:54 >> + const Vector<String> audioDeviceUIDs() const; > > Can we use Vector<> instead of const Vector<>? Fixed.
Eric Carlson
Comment 9 2017-12-01 09:21:25 PST
Created attachment 328098 [details] Patch for landing.
WebKit Commit Bot
Comment 10 2017-12-01 10:09:07 PST
Comment on attachment 328098 [details] Patch for landing. Clearing flags on attachment: 328098 Committed r225395: <https://trac.webkit.org/changeset/225395>
Note You need to log in before you can comment on or make changes to this bug.