Title: [287335] branches/safari-612-branch
- Revision
- 287335
- Author
- [email protected]
- Date
- 2021-12-21 16:14:24 -0800 (Tue, 21 Dec 2021)
Log Message
Cherry-pick r287067. rdar://problem/86276497
Make sure to start a realtime outgoing source in case it is taken to another sender
https://bugs.webkit.org/show_bug.cgi?id=234296
<rdar://86276497>
Reviewed by Eric Carlson.
Source/WebCore:
We are asynchronously starting libwebrtc sources.
When a sender is created first and is assigned a source later, we take the source and assign it to the sender.
In that case, the source might not be started and we will not send any data.
Test: webrtc/addTransceiver-then-addTrack.html
* Modules/mediastream/libwebrtc/LibWebRTCRtpSenderBackend.cpp:
LayoutTests:
* webrtc/addTransceiver-then-addTrack-expected.txt: Added.
* webrtc/addTransceiver-then-addTrack.html: Added.
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@287067 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Modified Paths
Added Paths
Diff
Modified: branches/safari-612-branch/LayoutTests/ChangeLog (287334 => 287335)
--- branches/safari-612-branch/LayoutTests/ChangeLog 2021-12-21 23:59:01 UTC (rev 287334)
+++ branches/safari-612-branch/LayoutTests/ChangeLog 2021-12-22 00:14:24 UTC (rev 287335)
@@ -1,3 +1,42 @@
+2021-12-21 Alan Coon <[email protected]>
+
+ Cherry-pick r287067. rdar://problem/86276497
+
+ Make sure to start a realtime outgoing source in case it is taken to another sender
+ https://bugs.webkit.org/show_bug.cgi?id=234296
+ <rdar://86276497>
+
+ Reviewed by Eric Carlson.
+
+ Source/WebCore:
+
+ We are asynchronously starting libwebrtc sources.
+ When a sender is created first and is assigned a source later, we take the source and assign it to the sender.
+ In that case, the source might not be started and we will not send any data.
+
+ Test: webrtc/addTransceiver-then-addTrack.html
+
+ * Modules/mediastream/libwebrtc/LibWebRTCRtpSenderBackend.cpp:
+
+ LayoutTests:
+
+ * webrtc/addTransceiver-then-addTrack-expected.txt: Added.
+ * webrtc/addTransceiver-then-addTrack.html: Added.
+
+
+ git-svn-id: https://svn.webkit.org/repository/webkit/trunk@287067 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+ 2021-12-15 Youenn Fablet <[email protected]>
+
+ Make sure to start a realtime outgoing source in case it is taken to another sender
+ https://bugs.webkit.org/show_bug.cgi?id=234296
+ <rdar://86276497>
+
+ Reviewed by Eric Carlson.
+
+ * webrtc/addTransceiver-then-addTrack-expected.txt: Added.
+ * webrtc/addTransceiver-then-addTrack.html: Added.
+
2021-12-09 Robert Jenner <[email protected]>
REGRESSION(r285452-r285595):[ Monterey Release ] 2 accessibility (layout-tests) are constant text failures
Added: branches/safari-612-branch/LayoutTests/webrtc/addTransceiver-then-addTrack-expected.txt (0 => 287335)
--- branches/safari-612-branch/LayoutTests/webrtc/addTransceiver-then-addTrack-expected.txt (rev 0)
+++ branches/safari-612-branch/LayoutTests/webrtc/addTransceiver-then-addTrack-expected.txt 2021-12-22 00:14:24 UTC (rev 287335)
@@ -0,0 +1,4 @@
+
+
+PASS Ensure addTrack reuses transceiver as expected
+
Added: branches/safari-612-branch/LayoutTests/webrtc/addTransceiver-then-addTrack.html (0 => 287335)
--- branches/safari-612-branch/LayoutTests/webrtc/addTransceiver-then-addTrack.html (rev 0)
+++ branches/safari-612-branch/LayoutTests/webrtc/addTransceiver-then-addTrack.html 2021-12-22 00:14:24 UTC (rev 287335)
@@ -0,0 +1,106 @@
+<!doctype html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <script src=""
+ <script src=""
+ </head>
+ <body>
+ <video id="video" autoplay=""></video>
+ <canvas id="canvas" width="640" height="480"></canvas>
+ <script src =""
+ <script>
+function getStatsType(connection)
+{
+ return connection.getStats().then((report) => {
+ var reportTypes = [];
+ report.forEach((statItem) => {
+ if (reportTypes.indexOf(statItem.type) === -1)
+ reportTypes.push(statItem.type);
+ });
+ return reportTypes.sort();
+ });
+}
+
+function getAudioOutboundRTPStats(connection)
+{
+ return connection.getStats().then((report) => {
+ let stats;
+ report.forEach((statItem) => {
+ if (statItem.type === "outbound-rtp" && !("framesSent" in statItem))
+ stats = statItem;
+ });
+ return stats;
+ });
+}
+
+function getVideoOutboundRTPStats(connection)
+{
+ return connection.getStats().then((report) => {
+ let stats;
+ report.forEach((statItem) => {
+ if (statItem.type === "outbound-rtp" && "framesSent" in statItem)
+ stats = statItem;
+ });
+ return stats;
+ });
+}
+
+async function validateVideoIsEncoded(connection)
+{
+ let counter = 0;
+ for (counter = 0; counter < 50; ++counter) {
+ const stats = await getVideoOutboundRTPStats(connection);
+ if (stats.framesSent)
+ return true;
+ await new Promise(resolve => setTimeout(resolve, 50));
+ }
+ return false;
+}
+
+async function validateAudioIsEncoded(connection)
+{
+ let counter = 0;
+ for (counter = 0; counter < 50; ++counter) {
+ const stats = await getAudioOutboundRTPStats(connection);
+ if (stats.bytesSent)
+ return true;
+ await new Promise(resolve => setTimeout(resolve, 50));
+ }
+ return false;
+}
+
+var pc1, pc2;
+promise_test(async (test) => {
+ if (window.testRunner)
+ testRunner.setUserMediaPermission(true);
+
+ const localStream = await navigator.mediaDevices.getUserMedia({video: true, audio: true });
+ const stream = await new Promise((resolve, reject) => {
+ createConnections((firstConnection) => {
+ pc1 = firstConnection;
+ firstConnection.addTransceiver("audio");
+ const senderAudio = firstConnection.addTrack(localStream.getAudioTracks()[0]);
+ senderAudio.setStreams(localStream);
+ firstConnection.addTransceiver("video");
+ const senderVideo = firstConnection.addTrack(localStream.getVideoTracks()[0]);
+ senderVideo.setStreams(localStream);
+ }, (secondConnection) => {
+ pc2 = secondConnection;
+ secondConnection._ontrack_ = (trackEvent) => {
+ resolve(trackEvent.streams[0]);
+ };
+ });
+ setTimeout(() => reject("Test timed out"), 5000);
+ });
+
+ assert_equals(stream.getTracks().length, 2);
+ video.srcObject = stream;
+ await video.play();
+
+ assert_true(await validateAudioIsEncoded(pc1), "audio encoded");
+ assert_true(await validateVideoIsEncoded(pc1), "video encoded");
+}, "Ensure addTrack reuses transceiver as expected");
+ </script>
+ </body>
+</html>
Modified: branches/safari-612-branch/Source/WebCore/ChangeLog (287334 => 287335)
--- branches/safari-612-branch/Source/WebCore/ChangeLog 2021-12-21 23:59:01 UTC (rev 287334)
+++ branches/safari-612-branch/Source/WebCore/ChangeLog 2021-12-22 00:14:24 UTC (rev 287335)
@@ -1,3 +1,47 @@
+2021-12-21 Alan Coon <[email protected]>
+
+ Cherry-pick r287067. rdar://problem/86276497
+
+ Make sure to start a realtime outgoing source in case it is taken to another sender
+ https://bugs.webkit.org/show_bug.cgi?id=234296
+ <rdar://86276497>
+
+ Reviewed by Eric Carlson.
+
+ Source/WebCore:
+
+ We are asynchronously starting libwebrtc sources.
+ When a sender is created first and is assigned a source later, we take the source and assign it to the sender.
+ In that case, the source might not be started and we will not send any data.
+
+ Test: webrtc/addTransceiver-then-addTrack.html
+
+ * Modules/mediastream/libwebrtc/LibWebRTCRtpSenderBackend.cpp:
+
+ LayoutTests:
+
+ * webrtc/addTransceiver-then-addTrack-expected.txt: Added.
+ * webrtc/addTransceiver-then-addTrack.html: Added.
+
+
+ git-svn-id: https://svn.webkit.org/repository/webkit/trunk@287067 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+ 2021-12-15 Youenn Fablet <[email protected]>
+
+ Make sure to start a realtime outgoing source in case it is taken to another sender
+ https://bugs.webkit.org/show_bug.cgi?id=234296
+ <rdar://86276497>
+
+ Reviewed by Eric Carlson.
+
+ We are asynchronously starting libwebrtc sources.
+ When a sender is created first and is assigned a source later, we take the source and assign it to the sender.
+ In that case, the source might not be started and we will not send any data.
+
+ Test: webrtc/addTransceiver-then-addTrack.html
+
+ * Modules/mediastream/libwebrtc/LibWebRTCRtpSenderBackend.cpp:
+
2021-12-15 Alan Coon <[email protected]>
Cherry-pick r287079. rdar://problem/85892959
Modified: branches/safari-612-branch/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCRtpSenderBackend.cpp (287334 => 287335)
--- branches/safari-612-branch/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCRtpSenderBackend.cpp 2021-12-21 23:59:01 UTC (rev 287334)
+++ branches/safari-612-branch/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCRtpSenderBackend.cpp 2021-12-22 00:14:24 UTC (rev 287335)
@@ -194,7 +194,7 @@
void LibWebRTCRtpSenderBackend::setSource(Source&& source)
{
stopSource();
- m_source = WTFMove(source);
+ m_source = std::exchange(source, nullptr);
startSource();
}
@@ -201,9 +201,7 @@
void LibWebRTCRtpSenderBackend::takeSource(LibWebRTCRtpSenderBackend& backend)
{
ASSERT(backend.hasSource());
- stopSource();
- m_source = WTFMove(backend.m_source);
- backend.m_source = nullptr;
+ setSource(WTFMove(backend.m_source));
}
} // namespace WebCore
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes