Title: [258837] trunk
- Revision
- 258837
- Author
- [email protected]
- Date
- 2020-03-23 07:24:19 -0700 (Mon, 23 Mar 2020)
Log Message
MediaDevices::refreshDevices should take device type into account
https://bugs.webkit.org/show_bug.cgi?id=209417
<rdar://problem/60521332>
Reviewed by Eric Carlson.
Source/WebCore:
Now that we set deviceId to the empty string when media capture is not granted,
we can have two devices with the same ID. We also need to handle the device type.
* Modules/mediastream/MediaDevices.cpp:
(WebCore::MediaDevices::refreshDevices):
LayoutTests:
* fast/mediastream/media-device-info-expected.txt:
* fast/mediastream/media-device-info.html:
Modified Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (258836 => 258837)
--- trunk/LayoutTests/ChangeLog 2020-03-23 14:22:04 UTC (rev 258836)
+++ trunk/LayoutTests/ChangeLog 2020-03-23 14:24:19 UTC (rev 258837)
@@ -1,3 +1,14 @@
+2020-03-23 youenn fablet <[email protected]>
+
+ MediaDevices::refreshDevices should take device type into account
+ https://bugs.webkit.org/show_bug.cgi?id=209417
+ <rdar://problem/60521332>
+
+ Reviewed by Eric Carlson.
+
+ * fast/mediastream/media-device-info-expected.txt:
+ * fast/mediastream/media-device-info.html:
+
2020-03-22 Antoine Quint <[email protected]>
DocumentTimeline / CSSTransition objects are leaking on CNN.com
Modified: trunk/LayoutTests/fast/mediastream/media-device-info-expected.txt (258836 => 258837)
--- trunk/LayoutTests/fast/mediastream/media-device-info-expected.txt 2020-03-23 14:22:04 UTC (rev 258836)
+++ trunk/LayoutTests/fast/mediastream/media-device-info-expected.txt 2020-03-23 14:24:19 UTC (rev 258837)
@@ -1,3 +1,4 @@
PASS Test properties of MediaDeviceInfo
+PASS Ensure enumerateDevices exposes both microphone and camera
Modified: trunk/LayoutTests/fast/mediastream/media-device-info.html (258836 => 258837)
--- trunk/LayoutTests/fast/mediastream/media-device-info.html 2020-03-23 14:22:04 UTC (rev 258836)
+++ trunk/LayoutTests/fast/mediastream/media-device-info.html 2020-03-23 14:24:19 UTC (rev 258837)
@@ -6,11 +6,6 @@
<script src=""
<script src=""
<script>
- var devices = [];
-
- if (window.testRunner)
- testRunner.setUserMediaPermission(true);
-
promise_test((test) => {
return navigator.mediaDevices.enumerateDevices()
.then((devices) => {
@@ -33,6 +28,13 @@
});
}, "Test properties of MediaDeviceInfo");
+ promise_test(async (test) => {
+ await navigator.mediaDevices.enumerateDevices();
+ const devices = await navigator.mediaDevices.enumerateDevices();
+ assert_equals(devices.length, 2);
+ assert_equals(devices[0].kind, "audioinput");
+ assert_equals(devices[1].kind, "videoinput");
+ }, "Ensure enumerateDevices exposes both microphone and camera");
</script>
</head>
<body>
Modified: trunk/Source/WebCore/ChangeLog (258836 => 258837)
--- trunk/Source/WebCore/ChangeLog 2020-03-23 14:22:04 UTC (rev 258836)
+++ trunk/Source/WebCore/ChangeLog 2020-03-23 14:24:19 UTC (rev 258837)
@@ -1,3 +1,17 @@
+2020-03-23 youenn fablet <[email protected]>
+
+ MediaDevices::refreshDevices should take device type into account
+ https://bugs.webkit.org/show_bug.cgi?id=209417
+ <rdar://problem/60521332>
+
+ Reviewed by Eric Carlson.
+
+ Now that we set deviceId to the empty string when media capture is not granted,
+ we can have two devices with the same ID. We also need to handle the device type.
+
+ * Modules/mediastream/MediaDevices.cpp:
+ (WebCore::MediaDevices::refreshDevices):
+
2020-03-23 Zalan Bujtas <[email protected]>
[LFC] Box::establishesBlockFormattingContext should check isInitialContainingBlock
Modified: trunk/Source/WebCore/Modules/mediastream/MediaDevices.cpp (258836 => 258837)
--- trunk/Source/WebCore/Modules/mediastream/MediaDevices.cpp 2020-03-23 14:22:04 UTC (rev 258836)
+++ trunk/Source/WebCore/Modules/mediastream/MediaDevices.cpp 2020-03-23 14:24:19 UTC (rev 258837)
@@ -181,8 +181,9 @@
if (!canAccessCamera && newDevice.type() == CaptureDevice::DeviceType::Camera)
continue;
- auto index = m_devices.findMatching([&newDevice](auto& oldDevice) {
- return oldDevice->deviceId() == newDevice.persistentId();
+ auto deviceKind = newDevice.type() == CaptureDevice::DeviceType::Microphone ? MediaDeviceInfo::Kind::Audioinput : MediaDeviceInfo::Kind::Videoinput;
+ auto index = m_devices.findMatching([deviceKind, &newDevice](auto& oldDevice) {
+ return oldDevice->deviceId() == newDevice.persistentId() && oldDevice->kind() == deviceKind;
});
if (index != notFound) {
devices.append(m_devices[index].copyRef());
@@ -189,8 +190,7 @@
continue;
}
- auto deviceType = newDevice.type() == CaptureDevice::DeviceType::Microphone ? MediaDeviceInfo::Kind::Audioinput : MediaDeviceInfo::Kind::Videoinput;
- devices.append(MediaDeviceInfo::create(newDevice.label(), newDevice.persistentId(), newDevice.groupId(), deviceType));
+ devices.append(MediaDeviceInfo::create(newDevice.label(), newDevice.persistentId(), newDevice.groupId(), deviceKind));
}
m_devices = WTFMove(devices);
}
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes