Title: [240206] trunk
- Revision
- 240206
- Author
- [email protected]
- Date
- 2019-01-19 16:28:44 -0800 (Sat, 19 Jan 2019)
Log Message
getUserMedia with a deviceId exact constraint with an empty string value should succeed
https://bugs.webkit.org/show_bug.cgi?id=193541
<rdar://problem/47357218>
Reviewed by Eric Carlson.
If there is a deviceId constraint, remove any empty string from ideal/exact string list.
This will make the device selection be solely based on other constraints.
An improvement might be for 'exact' constraint to pick the default device.
There is currently no such notion of a default device.
Picking the best fitting device seems a good tradeoff.
Covered by updated test.
* platform/mediastream/MediaConstraints.cpp:
(WebCore::MediaTrackConstraintSetMap::set):
* platform/mediastream/MediaConstraints.h:
(WebCore::StringConstraint::removeEmptyStringConstraint):
Modified Paths
Diff
Modified: trunk/LayoutTests/fast/mediastream/get-user-media-device-id-expected.txt (240205 => 240206)
--- trunk/LayoutTests/fast/mediastream/get-user-media-device-id-expected.txt 2019-01-19 23:31:43 UTC (rev 240205)
+++ trunk/LayoutTests/fast/mediastream/get-user-media-device-id-expected.txt 2019-01-20 00:28:44 UTC (rev 240206)
@@ -3,4 +3,5 @@
PASS Collect device IDs
PASS Pass device IDs as exact constraints
PASS Pass device IDs as optional constraints
+PASS Exact device IDs with special values: empty string, null, undefined
Modified: trunk/LayoutTests/fast/mediastream/get-user-media-device-id.html (240205 => 240206)
--- trunk/LayoutTests/fast/mediastream/get-user-media-device-id.html 2019-01-19 23:31:43 UTC (rev 240205)
+++ trunk/LayoutTests/fast/mediastream/get-user-media-device-id.html 2019-01-20 00:28:44 UTC (rev 240206)
@@ -70,6 +70,15 @@
}, "Pass device IDs as optional constraints");
+ promise_test(async (test) => {
+ await navigator.mediaDevices.getUserMedia({ audio: {deviceId: {exact: ""}}});
+ await navigator.mediaDevices.getUserMedia({ video: {deviceId: {exact: [""]}}});
+ await navigator.mediaDevices.getUserMedia({ audio: {deviceId: {exact: undefined}}});
+
+ await navigator.mediaDevices.getUserMedia({ audio: {deviceId: {exact: null}}}).then(assert_unreached, () => { });
+ await navigator.mediaDevices.getUserMedia({ audio: {deviceId: {exact: "test"}}}).then(assert_unreached, () => { });
+ }, "Exact device IDs with special values: empty string, null, undefined");
+
</script>
</head>
<body>
Modified: trunk/Source/WebCore/ChangeLog (240205 => 240206)
--- trunk/Source/WebCore/ChangeLog 2019-01-19 23:31:43 UTC (rev 240205)
+++ trunk/Source/WebCore/ChangeLog 2019-01-20 00:28:44 UTC (rev 240206)
@@ -1,3 +1,23 @@
+2019-01-19 Youenn Fablet <[email protected]>
+
+ getUserMedia with a deviceId exact constraint with an empty string value should succeed
+ https://bugs.webkit.org/show_bug.cgi?id=193541
+ <rdar://problem/47357218>
+
+ Reviewed by Eric Carlson.
+
+ If there is a deviceId constraint, remove any empty string from ideal/exact string list.
+ This will make the device selection be solely based on other constraints.
+ An improvement might be for 'exact' constraint to pick the default device.
+ There is currently no such notion of a default device.
+ Picking the best fitting device seems a good tradeoff.
+ Covered by updated test.
+
+ * platform/mediastream/MediaConstraints.cpp:
+ (WebCore::MediaTrackConstraintSetMap::set):
+ * platform/mediastream/MediaConstraints.h:
+ (WebCore::StringConstraint::removeEmptyStringConstraint):
+
2019-01-19 Eric Liang <[email protected]>
AXSelected attribute on RadioButton should not be settable.
Modified: trunk/Source/WebCore/platform/mediastream/MediaConstraints.cpp (240205 => 240206)
--- trunk/Source/WebCore/platform/mediastream/MediaConstraints.cpp 2019-01-19 23:31:43 UTC (rev 240205)
+++ trunk/Source/WebCore/platform/mediastream/MediaConstraints.cpp 2019-01-20 00:28:44 UTC (rev 240206)
@@ -315,6 +315,8 @@
m_facingMode = WTFMove(constraint);
break;
case MediaConstraintType::DeviceId:
+ if (constraint)
+ constraint->removeEmptyStringConstraint();
m_deviceId = WTFMove(constraint);
break;
case MediaConstraintType::GroupId:
Modified: trunk/Source/WebCore/platform/mediastream/MediaConstraints.h (240205 => 240206)
--- trunk/Source/WebCore/platform/mediastream/MediaConstraints.h 2019-01-19 23:31:43 UTC (rev 240205)
+++ trunk/Source/WebCore/platform/mediastream/MediaConstraints.h 2019-01-20 00:28:44 UTC (rev 240206)
@@ -610,6 +610,16 @@
return true;
}
+ void removeEmptyStringConstraint()
+ {
+ m_exact.removeAllMatching([](auto& constraint) {
+ return constraint.isEmpty();
+ });
+ m_ideal.removeAllMatching([](auto& constraint) {
+ return constraint.isEmpty();
+ });
+ }
+
private:
Vector<String> m_exact;
Vector<String> m_ideal;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes