createAnswer() SDP Rejected by setLocalDescription()
authoryouenn@apple.com <youenn@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 28 May 2019 23:13:55 +0000 (23:13 +0000)
committeryouenn@apple.com <youenn@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 28 May 2019 23:13:55 +0000 (23:13 +0000)
https://bugs.webkit.org/show_bug.cgi?id=195930
<rdar://problem/49030489>

Reviewed by Eric Carlson.

Source/ThirdParty/libwebrtc:

Make sure to check packetization mode parameter when matching H264 video codec.

* Source/webrtc/media/base/codec.cc:
* WebKit/0001-fix-195930.patch: Added.

LayoutTests:

* webrtc/h264-packetization-mode-expected.txt: Added.
* webrtc/h264-packetization-mode.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@245829 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/webrtc/h264-packetization-mode-expected.txt [new file with mode: 0644]
LayoutTests/webrtc/h264-packetization-mode.html [new file with mode: 0644]
Source/ThirdParty/libwebrtc/ChangeLog
Source/ThirdParty/libwebrtc/Source/webrtc/media/base/codec.cc
Source/ThirdParty/libwebrtc/WebKit/0001-fix-195930.patch [new file with mode: 0644]

index 68a908a..144fd27 100644 (file)
@@ -1,3 +1,14 @@
+2019-05-28  Youenn Fablet  <youenn@apple.com>
+
+        createAnswer() SDP Rejected by setLocalDescription()
+        https://bugs.webkit.org/show_bug.cgi?id=195930
+        <rdar://problem/49030489>
+
+        Reviewed by Eric Carlson.
+
+        * webrtc/h264-packetization-mode-expected.txt: Added.
+        * webrtc/h264-packetization-mode.html: Added.
+
 2019-05-28  Shawn Roberts  <sroberts@apple.com>
 
         Unreviewed, rolling out r245475.
diff --git a/LayoutTests/webrtc/h264-packetization-mode-expected.txt b/LayoutTests/webrtc/h264-packetization-mode-expected.txt
new file mode 100644 (file)
index 0000000..5f88811
--- /dev/null
@@ -0,0 +1,6 @@
+
+PASS Make sure packetization mode 1 is offered 
+PASS Offer without explicit H264 packetization mode 
+PASS Offer with explicit H264 packetization mode 0 
+PASS Offer with explicit H264 packetization mode 1 
+
diff --git a/LayoutTests/webrtc/h264-packetization-mode.html b/LayoutTests/webrtc/h264-packetization-mode.html
new file mode 100644 (file)
index 0000000..5a4ae6d
--- /dev/null
@@ -0,0 +1,70 @@
+<!doctype html>
+<html>
+    <head>
+        <meta charset="utf-8">
+        <title>Testing H264 packetization mode</title>
+        <script src="../resources/testharness.js"></script>
+        <script src="../resources/testharnessreport.js"></script>
+    </head>
+    <body>
+        <script>
+promise_test(async t => {
+    const pc = new RTCPeerConnection;
+    pc.addTransceiver("video");
+    const offer = await pc.createOffer();
+
+    assert_true(offer.sdp.indexOf("packetization-mode=1;profile-level-id=42e01f") !== -1, "baseline, packetization mode 1");
+    assert_false(offer.sdp.indexOf("packetization-mode=0") !== -1, "packetization mode 0 is not offered");
+}, "Make sure packetization mode 1 is offered");
+
+const sdpStart = `v=0
+o=- 3761869441 3761869441 IN IP4 0.0.0.0
+s=test
+c=IN IP4 0.0.0.0
+t=0 0
+a=group:BUNDLE video0
+m=video 1 RTP/SAVPF 99
+a=setup:actpass
+a=rtcp:9 IN IP4 0.0.0.0
+a=rtcp-mux
+a=recvonly
+a=mid:video0
+a=rtpmap:99 H264/90000
+a=ssrc:3599710107 cname:test-cname
+a=ice-ufrag:ZLgu
+a=ice-pwd:3/gb3GZYQ2wgxAHnFRT1bf
+a=fingerprint:sha-256 5A:08:09:0D:E9:1C:78:20:65:64:95:6E:FE:29:91:E1:CC:6E:47:F1:A4:7A:8E:F9:6F:4D:A4:7A:7A:A2:76:BF`;
+
+promise_test(async t => {
+    const sdp = sdpStart +`
+`;
+    const pc = new RTCPeerConnection();
+    await pc.setRemoteDescription(new RTCSessionDescription({sdp: sdp, type: 'offer'})).then(() => {
+        assert_unreached();
+    }, (e) => {
+        assert_equals(e.name, "InvalidAccessError");
+        assert_equals(e.message, "Failed to set remote offer sdp: Failed to set remote video description send parameters.");
+    });
+}, "Offer without explicit H264 packetization mode");
+
+promise_test(async t => {
+    const sdp = sdpStart +`
+a=fmtp:99 profile-level-id=42e01f;level-asymmetry-allowed=1;packetization-mode=0
+`;
+    const pc = new RTCPeerConnection();
+    await pc.setRemoteDescription(new RTCSessionDescription({sdp: sdp, type: 'offer'})).then(() => {
+        assert_unreached();
+    }, (e) => {
+        assert_equals(e.name, "InvalidAccessError");
+        assert_equals(e.message, "Failed to set remote offer sdp: Failed to set remote video description send parameters.");
+    });
+}, "Offer with explicit H264 packetization mode 0");
+
+promise_test(async t => {
+    const sdp = sdpStart +`
+a=fmtp:99 profile-level-id=42e01f;level-asymmetry-allowed=1;packetization-mode=1
+`;
+     const pc = new RTCPeerConnection;
+    return pc.setRemoteDescription(new RTCSessionDescription({sdp: sdp, type: 'offer'}));
+}, "Offer with explicit H264 packetization mode 1");
+</script>
index 3865cf8..8aff98d 100644 (file)
@@ -1,3 +1,16 @@
+2019-05-28  Youenn Fablet  <youenn@apple.com>
+
+        createAnswer() SDP Rejected by setLocalDescription()
+        https://bugs.webkit.org/show_bug.cgi?id=195930
+        <rdar://problem/49030489>
+
+        Reviewed by Eric Carlson.
+
+        Make sure to check packetization mode parameter when matching H264 video codec.
+
+        * Source/webrtc/media/base/codec.cc:
+        * WebKit/0001-fix-195930.patch: Added.
+
 2019-05-09  Andy Estes  <aestes@apple.com>
 
         Fix 32-bit watchOS engineering builds after r244726.
index 0a1c715..8e58932 100644 (file)
@@ -383,7 +383,7 @@ bool IsSameCodec(const std::string& name1,
     return false;
   // For every format besides H264 and VP9, comparing names is enough.
   if (absl::EqualsIgnoreCase(name1, kH264CodecName))
-    return webrtc::H264::IsSameH264Profile(params1, params2);
+    return webrtc::H264::IsSameH264Profile(params1, params2) && IsSameH264PacketizationMode(params1, params2);
   if (absl::EqualsIgnoreCase(name1, kVp9CodecName))
     return webrtc::IsSameVP9Profile(params1, params2);
   return true;
diff --git a/Source/ThirdParty/libwebrtc/WebKit/0001-fix-195930.patch b/Source/ThirdParty/libwebrtc/WebKit/0001-fix-195930.patch
new file mode 100644 (file)
index 0000000..0b225e9
--- /dev/null
@@ -0,0 +1,25 @@
+From b6477d2493b4cf0875838ddcd725ed40a8725cc2 Mon Sep 17 00:00:00 2001
+From: Youenn Fablet <youenn@apple.com>
+Date: Tue, 28 May 2019 09:58:04 -0700
+Subject: [PATCH] fix-195930
+
+---
+ Source/ThirdParty/libwebrtc/Source/webrtc/media/base/codec.cc | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/Source/ThirdParty/libwebrtc/Source/webrtc/media/base/codec.cc b/Source/ThirdParty/libwebrtc/Source/webrtc/media/base/codec.cc
+index 0a1c7156af8..c4cd02d8db4 100644
+--- a/Source/ThirdParty/libwebrtc/Source/webrtc/media/base/codec.cc
++++ b/Source/ThirdParty/libwebrtc/Source/webrtc/media/base/codec.cc
+@@ -383,7 +383,7 @@ bool IsSameCodec(const std::string& name1,
+     return false;
+   // For every format besides H264 and VP9, comparing names is enough.
+   if (absl::EqualsIgnoreCase(name1, kH264CodecName))
+-    return webrtc::H264::IsSameH264Profile(params1, params2);
++      return webrtc::H264::IsSameH264Profile(params1, params2) && IsSameH264PacketizationMode(params1, params2);
+   if (absl::EqualsIgnoreCase(name1, kVp9CodecName))
+     return webrtc::IsSameVP9Profile(params1, params2);
+   return true;
+-- 
+2.20.1 (Apple Git-117)
+