Changeset 258837 in webkit
- Timestamp:
- Mar 23, 2020 7:24:19 AM (4 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r258826 r258837 1 2020-03-23 youenn fablet <youenn@apple.com> 2 3 MediaDevices::refreshDevices should take device type into account 4 https://bugs.webkit.org/show_bug.cgi?id=209417 5 <rdar://problem/60521332> 6 7 Reviewed by Eric Carlson. 8 9 * fast/mediastream/media-device-info-expected.txt: 10 * fast/mediastream/media-device-info.html: 11 1 12 2020-03-22 Antoine Quint <graouts@apple.com> 2 13 -
trunk/LayoutTests/fast/mediastream/media-device-info-expected.txt
r217476 r258837 1 1 2 2 PASS Test properties of MediaDeviceInfo 3 PASS Ensure enumerateDevices exposes both microphone and camera 3 4 -
trunk/LayoutTests/fast/mediastream/media-device-info.html
r217476 r258837 7 7 <script src="../../resources/testharnessreport.js"></script> 8 8 <script> 9 var devices = [];10 11 if (window.testRunner)12 testRunner.setUserMediaPermission(true);13 14 9 promise_test((test) => { 15 10 return navigator.mediaDevices.enumerateDevices() … … 34 29 }, "Test properties of MediaDeviceInfo"); 35 30 31 promise_test(async (test) => { 32 await navigator.mediaDevices.enumerateDevices(); 33 const devices = await navigator.mediaDevices.enumerateDevices(); 34 assert_equals(devices.length, 2); 35 assert_equals(devices[0].kind, "audioinput"); 36 assert_equals(devices[1].kind, "videoinput"); 37 }, "Ensure enumerateDevices exposes both microphone and camera"); 36 38 </script> 37 39 </head> -
trunk/Source/WebCore/ChangeLog
r258836 r258837 1 2020-03-23 youenn fablet <youenn@apple.com> 2 3 MediaDevices::refreshDevices should take device type into account 4 https://bugs.webkit.org/show_bug.cgi?id=209417 5 <rdar://problem/60521332> 6 7 Reviewed by Eric Carlson. 8 9 Now that we set deviceId to the empty string when media capture is not granted, 10 we can have two devices with the same ID. We also need to handle the device type. 11 12 * Modules/mediastream/MediaDevices.cpp: 13 (WebCore::MediaDevices::refreshDevices): 14 1 15 2020-03-23 Zalan Bujtas <zalan@apple.com> 2 16 -
trunk/Source/WebCore/Modules/mediastream/MediaDevices.cpp
r256034 r258837 182 182 continue; 183 183 184 auto index = m_devices.findMatching([&newDevice](auto& oldDevice) { 185 return oldDevice->deviceId() == newDevice.persistentId(); 184 auto deviceKind = newDevice.type() == CaptureDevice::DeviceType::Microphone ? MediaDeviceInfo::Kind::Audioinput : MediaDeviceInfo::Kind::Videoinput; 185 auto index = m_devices.findMatching([deviceKind, &newDevice](auto& oldDevice) { 186 return oldDevice->deviceId() == newDevice.persistentId() && oldDevice->kind() == deviceKind; 186 187 }); 187 188 if (index != notFound) { … … 190 191 } 191 192 192 auto deviceType = newDevice.type() == CaptureDevice::DeviceType::Microphone ? MediaDeviceInfo::Kind::Audioinput : MediaDeviceInfo::Kind::Videoinput; 193 devices.append(MediaDeviceInfo::create(newDevice.label(), newDevice.persistentId(), newDevice.groupId(), deviceType)); 193 devices.append(MediaDeviceInfo::create(newDevice.label(), newDevice.persistentId(), newDevice.groupId(), deviceKind)); 194 194 } 195 195 m_devices = WTFMove(devices);
Note: See TracChangeset
for help on using the changeset viewer.