Title: [240421] branches/safari-607-branch
- Revision
- 240421
- Author
- [email protected]
- Date
- 2019-01-23 22:42:32 -0800 (Wed, 23 Jan 2019)
Log Message
Cherry-pick r240206. 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: branches/safari-607-branch/LayoutTests/fast/mediastream/get-user-media-device-id-expected.txt (240420 => 240421)
--- branches/safari-607-branch/LayoutTests/fast/mediastream/get-user-media-device-id-expected.txt 2019-01-24 06:42:28 UTC (rev 240420)
+++ branches/safari-607-branch/LayoutTests/fast/mediastream/get-user-media-device-id-expected.txt 2019-01-24 06:42:32 UTC (rev 240421)
@@ -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: branches/safari-607-branch/LayoutTests/fast/mediastream/get-user-media-device-id.html (240420 => 240421)
--- branches/safari-607-branch/LayoutTests/fast/mediastream/get-user-media-device-id.html 2019-01-24 06:42:28 UTC (rev 240420)
+++ branches/safari-607-branch/LayoutTests/fast/mediastream/get-user-media-device-id.html 2019-01-24 06:42:32 UTC (rev 240421)
@@ -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: branches/safari-607-branch/Source/WebCore/ChangeLog (240420 => 240421)
--- branches/safari-607-branch/Source/WebCore/ChangeLog 2019-01-24 06:42:28 UTC (rev 240420)
+++ branches/safari-607-branch/Source/WebCore/ChangeLog 2019-01-24 06:42:32 UTC (rev 240421)
@@ -1,3 +1,25 @@
+2019-01-19 Youenn Fablet <[email protected]>
+
+ Cherry-pick r240206. rdar://problem/47357218
+
+ 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-23 Alan Coon <[email protected]>
Cherry-pick r239965. rdar://problem/47295360
Modified: branches/safari-607-branch/Source/WebCore/platform/mediastream/MediaConstraints.cpp (240420 => 240421)
--- branches/safari-607-branch/Source/WebCore/platform/mediastream/MediaConstraints.cpp 2019-01-24 06:42:28 UTC (rev 240420)
+++ branches/safari-607-branch/Source/WebCore/platform/mediastream/MediaConstraints.cpp 2019-01-24 06:42:32 UTC (rev 240421)
@@ -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: branches/safari-607-branch/Source/WebCore/platform/mediastream/MediaConstraints.h (240420 => 240421)
--- branches/safari-607-branch/Source/WebCore/platform/mediastream/MediaConstraints.h 2019-01-24 06:42:28 UTC (rev 240420)
+++ branches/safari-607-branch/Source/WebCore/platform/mediastream/MediaConstraints.h 2019-01-24 06:42:32 UTC (rev 240421)
@@ -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