- Revision
- 271698
- Author
- you...@apple.com
- Date
- 2021-01-21 10:08:54 -0800 (Thu, 21 Jan 2021)
Log Message
Allow MediaStream and non MediaStream backed videos to play together
https://bugs.webkit.org/show_bug.cgi?id=199661
<rdar://problem/68622411>
Reviewed by Eric Carlson.
Source/WebCore:
Changing heuristic to always allow MediaStream backed videos to play concurrently with other videos.
To not break existing websites, we keep the existing behavior for non MediaStream backed videos.
Test: webrtc/concurrentVideoPlayback2.html
* platform/audio/PlatformMediaSession.cpp:
(WebCore::PlatformMediaSession::canPlayConcurrently const):
LayoutTests:
* webrtc/concurrentVideoPlayback-expected.txt:
* webrtc/concurrentVideoPlayback.html:
* webrtc/concurrentVideoPlayback2-expected.txt: Added.
* webrtc/concurrentVideoPlayback2.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (271697 => 271698)
--- trunk/LayoutTests/ChangeLog 2021-01-21 17:54:53 UTC (rev 271697)
+++ trunk/LayoutTests/ChangeLog 2021-01-21 18:08:54 UTC (rev 271698)
@@ -1,5 +1,18 @@
2021-01-21 Youenn Fablet <you...@apple.com>
+ Allow MediaStream and non MediaStream backed videos to play together
+ https://bugs.webkit.org/show_bug.cgi?id=199661
+ <rdar://problem/68622411>
+
+ Reviewed by Eric Carlson.
+
+ * webrtc/concurrentVideoPlayback-expected.txt:
+ * webrtc/concurrentVideoPlayback.html:
+ * webrtc/concurrentVideoPlayback2-expected.txt: Added.
+ * webrtc/concurrentVideoPlayback2.html: Added.
+
+2021-01-21 Youenn Fablet <you...@apple.com>
+
Check for TURN username/credentials sizes in RTCPeerConnection constructor
https://bugs.webkit.org/show_bug.cgi?id=220789
Modified: trunk/LayoutTests/webrtc/concurrentVideoPlayback-expected.txt (271697 => 271698)
--- trunk/LayoutTests/webrtc/concurrentVideoPlayback-expected.txt 2021-01-21 17:54:53 UTC (rev 271697)
+++ trunk/LayoutTests/webrtc/concurrentVideoPlayback-expected.txt 2021-01-21 18:08:54 UTC (rev 271698)
@@ -2,6 +2,5 @@
PASS Basic audio/video exchange
PASS Play MediaStream backed streams concurrently
-PASS Play regular video content should pause MediaStream backed video elements
-PASS Play MediaStream backed video elements should pause regular video content
+PASS Play regular video content should not pause MediaStream backed video elements
Modified: trunk/LayoutTests/webrtc/concurrentVideoPlayback.html (271697 => 271698)
--- trunk/LayoutTests/webrtc/concurrentVideoPlayback.html 2021-01-21 17:54:53 UTC (rev 271697)
+++ trunk/LayoutTests/webrtc/concurrentVideoPlayback.html 2021-01-21 18:08:54 UTC (rev 271698)
@@ -51,30 +51,10 @@
video3.src = "" '../media/content/audio-tracks');
await video3.play();
- let counter = 0;
- while (!video1.paused && ++counter < 20)
- await new Promise(resolve => setTimeout(resolve, 50));
-
- assert_true(video1.paused, "video1 paused");
- assert_true(video2.paused, "video2 paused");
- assert_false(video3.paused, "video3 paused");
-}, "Play regular video content should pause MediaStream backed video elements");
-
-promise_test(async (test) => {
- await video1.play();
-
- assert_true(video3.paused, "video3 paused");
-
- await video2.play();
-
- let counter = 0;
- while (!video3.paused && ++counter < 20)
- await new Promise(resolve => setTimeout(resolve, 50));
-
assert_false(video1.paused, "video1 paused");
assert_false(video2.paused, "video2 paused");
- assert_true(video3.paused, "video3 paused");
-}, "Play MediaStream backed video elements should pause regular video content");
+ assert_false(video3.paused, "video3 paused");
+}, "Play regular video content should not pause MediaStream backed video elements");
</script>
</body>
</html>
Added: trunk/LayoutTests/webrtc/concurrentVideoPlayback2-expected.txt (0 => 271698)
--- trunk/LayoutTests/webrtc/concurrentVideoPlayback2-expected.txt (rev 0)
+++ trunk/LayoutTests/webrtc/concurrentVideoPlayback2-expected.txt 2021-01-21 18:08:54 UTC (rev 271698)
@@ -0,0 +1,8 @@
+
+
+PASS Basic audio/video exchange
+PASS Play regular video content should not pause MediaStream backed video elements
+PASS Play regular video content should not pause MediaStream backed video elements but should pause not MediaStream backed video elements
+PASS Restart regular video content should not pause MediaStream backed video elements but should pause not MediaStream backed video elements
+PASS Pause/play MediaStream backed video elements should not change regular video content
+
Copied: trunk/LayoutTests/webrtc/concurrentVideoPlayback2.html (from rev 271697, trunk/LayoutTests/webrtc/concurrentVideoPlayback.html) (0 => 271698)
--- trunk/LayoutTests/webrtc/concurrentVideoPlayback2.html (rev 0)
+++ trunk/LayoutTests/webrtc/concurrentVideoPlayback2.html 2021-01-21 18:08:54 UTC (rev 271698)
@@ -0,0 +1,88 @@
+<!doctype html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <title>Testing concurrent video playing 2</title>
+ <script src=""
+ <script src=""
+ <script src=""
+ </head>
+ <body>
+ <video id="video1" autoplay controls></video>
+ <video id="video2" autoplay controls></video>
+ <video id="video3" autoplay controls></video>
+ <video id="video4" autoplay controls></video>
+ <script src =""
+ <script>
+promise_test(async (test) => {
+ localStream = await navigator.mediaDevices.getUserMedia({audio: true, video: true});
+
+ const remoteStream = await new Promise((resolve, reject) => {
+ createConnections((firstConnection) => {
+ firstConnection.addTrack(localStream.getVideoTracks()[0], localStream);
+ firstConnection.addTrack(localStream.getAudioTracks()[0], localStream);
+ }, (secondConnection) => {
+ secondConnection._ontrack_ = (trackEvent) => {
+ resolve(trackEvent.streams[0]);
+ };
+ });
+ setTimeout(() => reject("Test timed out"), 5000);
+ });
+
+ video1.srcObject = localStream;
+ video2.srcObject = remoteStream;
+ await video1.play();
+ await video2.play();
+}, "Basic audio/video exchange");
+
+promise_test(async (test) => {
+ if (window.internals)
+ internals.setMediaSessionRestrictions('videoaudio', 'ConcurrentPlaybackNotPermitted');
+
+ video3.src = "" '../media/content/audio-tracks');
+ await video3.play();
+
+ let counter = 0;
+ while (!video1.paused && ++counter < 20)
+ await new Promise(resolve => setTimeout(resolve, 50));
+
+ assert_false(video1.paused, "video1 paused");
+ assert_false(video2.paused, "video2 paused");
+ assert_false(video3.paused, "video3 paused");
+}, "Play regular video content should not pause MediaStream backed video elements");
+
+promise_test(async (test) => {
+ video4.src = "" '../media/content/audio-tracks');
+ await video4.play();
+
+ let counter = 0;
+ while (!video1.paused && ++counter < 20)
+ await new Promise(resolve => setTimeout(resolve, 50));
+
+ assert_false(video1.paused, "video1 paused");
+ assert_false(video2.paused, "video2 paused");
+ assert_true(video3.paused, "video3 paused");
+ assert_false(video4.paused, "video4 paused");
+}, "Play regular video content should not pause MediaStream backed video elements but should pause not MediaStream backed video elements");
+
+promise_test(async (test) => {
+ await video3.play();
+
+ assert_false(video1.paused, "video1 paused");
+ assert_false(video2.paused, "video2 paused");
+ assert_false(video3.paused, "video3 paused");
+ assert_true(video4.paused, "video4 paused");
+}, "Restart regular video content should not pause MediaStream backed video elements but should pause not MediaStream backed video elements");
+
+promise_test(async (test) => {
+ await video2.pause();
+ await video2.play();
+
+ assert_false(video1.paused, "video1 paused");
+ assert_false(video2.paused, "video2 paused");
+ assert_false(video3.paused, "video3 paused");
+ assert_true(video4.paused, "video4 paused");
+}, "Pause/play MediaStream backed video elements should not change regular video content");
+ </script>
+ </body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (271697 => 271698)
--- trunk/Source/WebCore/ChangeLog 2021-01-21 17:54:53 UTC (rev 271697)
+++ trunk/Source/WebCore/ChangeLog 2021-01-21 18:08:54 UTC (rev 271698)
@@ -1,5 +1,21 @@
2021-01-21 Youenn Fablet <you...@apple.com>
+ Allow MediaStream and non MediaStream backed videos to play together
+ https://bugs.webkit.org/show_bug.cgi?id=199661
+ <rdar://problem/68622411>
+
+ Reviewed by Eric Carlson.
+
+ Changing heuristic to always allow MediaStream backed videos to play concurrently with other videos.
+ To not break existing websites, we keep the existing behavior for non MediaStream backed videos.
+
+ Test: webrtc/concurrentVideoPlayback2.html
+
+ * platform/audio/PlatformMediaSession.cpp:
+ (WebCore::PlatformMediaSession::canPlayConcurrently const):
+
+2021-01-21 Youenn Fablet <you...@apple.com>
+
Check for TURN username/credentials sizes in RTCPeerConnection constructor
https://bugs.webkit.org/show_bug.cgi?id=220789
Modified: trunk/Source/WebCore/platform/audio/PlatformMediaSession.cpp (271697 => 271698)
--- trunk/Source/WebCore/platform/audio/PlatformMediaSession.cpp 2021-01-21 17:54:53 UTC (rev 271697)
+++ trunk/Source/WebCore/platform/audio/PlatformMediaSession.cpp 2021-01-21 18:08:54 UTC (rev 271698)
@@ -365,7 +365,7 @@
if (!groupID || !otherGroupID || groupID != otherGroupID)
return false;
- return m_client.hasMediaStreamSource() && otherSession.m_client.hasMediaStreamSource();
+ return m_client.hasMediaStreamSource() || otherSession.m_client.hasMediaStreamSource();
}
bool PlatformMediaSession::shouldOverridePauseDuringRouteChange() const