Title: [283173] trunk
Revision
283173
Author
[email protected]
Date
2021-09-28 09:20:25 -0700 (Tue, 28 Sep 2021)

Log Message

applyConstraints throws OverconstrainedError if specify exact for deviceId
https://bugs.webkit.org/show_bug.cgi?id=230819
<rdar://problem/83577361>

Reviewed by Eric Carlson.

Source/WebKit:

We were not setting properly the persistent device ID of remote sources.
Set values according provided device.

Test: fast/mediastream/applyConstraints-deviceId.html

* WebProcess/cocoa/RemoteRealtimeAudioSource.cpp:
(WebKit::RemoteRealtimeAudioSource::RemoteRealtimeAudioSource):
* WebProcess/cocoa/RemoteRealtimeVideoSource.cpp:
(WebKit::RemoteRealtimeVideoSource::RemoteRealtimeVideoSource):

LayoutTests:

* fast/mediastream/applyConstraints-deviceId-expected.txt: Added.
* fast/mediastream/applyConstraints-deviceId.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (283172 => 283173)


--- trunk/LayoutTests/ChangeLog	2021-09-28 16:17:24 UTC (rev 283172)
+++ trunk/LayoutTests/ChangeLog	2021-09-28 16:20:25 UTC (rev 283173)
@@ -1,3 +1,14 @@
+2021-09-28  Youenn Fablet  <[email protected]>
+
+        applyConstraints throws OverconstrainedError if specify exact for deviceId
+        https://bugs.webkit.org/show_bug.cgi?id=230819
+        <rdar://problem/83577361>
+
+        Reviewed by Eric Carlson.
+
+        * fast/mediastream/applyConstraints-deviceId-expected.txt: Added.
+        * fast/mediastream/applyConstraints-deviceId.html: Added.
+
 2021-09-28  Antti Koivisto  <[email protected]>
 
         [CSS Cascade Layers] Add CSSOM interface

Added: trunk/LayoutTests/fast/mediastream/applyConstraints-deviceId-expected.txt (0 => 283173)


--- trunk/LayoutTests/fast/mediastream/applyConstraints-deviceId-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/mediastream/applyConstraints-deviceId-expected.txt	2021-09-28 16:20:25 UTC (rev 283173)
@@ -0,0 +1,4 @@
+
+PASS applyConstraint deviceId for audio
+PASS applyConstraint deviceId for video
+

Added: trunk/LayoutTests/fast/mediastream/applyConstraints-deviceId.html (0 => 283173)


--- trunk/LayoutTests/fast/mediastream/applyConstraints-deviceId.html	                        (rev 0)
+++ trunk/LayoutTests/fast/mediastream/applyConstraints-deviceId.html	2021-09-28 16:20:25 UTC (rev 283173)
@@ -0,0 +1,22 @@
+<!DOCTYPE HTML>
+<html>
+    <head>
+        <script src=""
+        <script src=""
+    </head>
+    <body>
+        <script>
+promise_test(async (test) => {
+    const stream = await navigator.mediaDevices.getUserMedia({audio:true});
+    const deviceId = stream.getTracks()[0].getSettings().deviceId;
+    await stream.getTracks()[0].applyConstraints({deviceId: {exact: deviceId}});
+}, "applyConstraint deviceId for audio");
+
+promise_test(async (test) => {
+    const stream = await navigator.mediaDevices.getUserMedia({video:true});
+    const deviceId = stream.getTracks()[0].getSettings().deviceId;
+    await stream.getTracks()[0].applyConstraints({deviceId: {exact: deviceId}});
+}, "applyConstraint deviceId for video");
+        </script>
+    </body>
+</html>

Modified: trunk/Source/WebKit/ChangeLog (283172 => 283173)


--- trunk/Source/WebKit/ChangeLog	2021-09-28 16:17:24 UTC (rev 283172)
+++ trunk/Source/WebKit/ChangeLog	2021-09-28 16:20:25 UTC (rev 283173)
@@ -1,3 +1,21 @@
+2021-09-28  Youenn Fablet  <[email protected]>
+
+        applyConstraints throws OverconstrainedError if specify exact for deviceId
+        https://bugs.webkit.org/show_bug.cgi?id=230819
+        <rdar://problem/83577361>
+
+        Reviewed by Eric Carlson.
+
+        We were not setting properly the persistent device ID of remote sources.
+        Set values according provided device.
+
+        Test: fast/mediastream/applyConstraints-deviceId.html
+
+        * WebProcess/cocoa/RemoteRealtimeAudioSource.cpp:
+        (WebKit::RemoteRealtimeAudioSource::RemoteRealtimeAudioSource):
+        * WebProcess/cocoa/RemoteRealtimeVideoSource.cpp:
+        (WebKit::RemoteRealtimeVideoSource::RemoteRealtimeVideoSource):
+
 2021-09-27  Cameron McCormack  <[email protected]>
 
         Avoid building log messages when IPCMessages log stream is off

Modified: trunk/Source/WebKit/WebProcess/cocoa/RemoteRealtimeAudioSource.cpp (283172 => 283173)


--- trunk/Source/WebKit/WebProcess/cocoa/RemoteRealtimeAudioSource.cpp	2021-09-28 16:17:24 UTC (rev 283172)
+++ trunk/Source/WebKit/WebProcess/cocoa/RemoteRealtimeAudioSource.cpp	2021-09-28 16:20:25 UTC (rev 283173)
@@ -53,7 +53,7 @@
 }
 
 RemoteRealtimeAudioSource::RemoteRealtimeAudioSource(RealtimeMediaSourceIdentifier identifier, const CaptureDevice& device, const MediaConstraints* constraints, String&& name, String&& hashSalt, UserMediaCaptureManager& manager, bool shouldCaptureInGPUProcess)
-    : RealtimeMediaSource(RealtimeMediaSource::Type::Audio, WTFMove(name), String::number(identifier.toUInt64()), WTFMove(hashSalt))
+    : RealtimeMediaSource(RealtimeMediaSource::Type::Audio, WTFMove(name), String { device.persistentId() }, WTFMove(hashSalt))
     , m_proxy(identifier, device, shouldCaptureInGPUProcess, constraints)
     , m_manager(manager)
 {

Modified: trunk/Source/WebKit/WebProcess/cocoa/RemoteRealtimeVideoSource.cpp (283172 => 283173)


--- trunk/Source/WebKit/WebProcess/cocoa/RemoteRealtimeVideoSource.cpp	2021-09-28 16:17:24 UTC (rev 283172)
+++ trunk/Source/WebKit/WebProcess/cocoa/RemoteRealtimeVideoSource.cpp	2021-09-28 16:20:25 UTC (rev 283173)
@@ -55,7 +55,7 @@
 }
 
 RemoteRealtimeVideoSource::RemoteRealtimeVideoSource(RealtimeMediaSourceIdentifier identifier, const CaptureDevice& device, const MediaConstraints* constraints, String&& name, String&& hashSalt, UserMediaCaptureManager& manager, bool shouldCaptureInGPUProcess)
-    : RealtimeVideoCaptureSource(WTFMove(name), String::number(identifier.toUInt64()), WTFMove(hashSalt))
+    : RealtimeVideoCaptureSource(WTFMove(name), String { device.persistentId() }, WTFMove(hashSalt))
     , m_proxy(identifier, device, shouldCaptureInGPUProcess, constraints)
     , m_manager(manager)
 {
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to