Filter SDP c lines
authoryouenn@apple.com <youenn@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 15 Jul 2019 14:32:48 +0000 (14:32 +0000)
committeryouenn@apple.com <youenn@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 15 Jul 2019 14:32:48 +0000 (14:32 +0000)
https://bugs.webkit.org/show_bug.cgi?id=199791

Reviewed by Eric Carlson.

Source/WebCore:

As discussed in https://github.com/rtcweb-wg/mdns-ice-candidates/issues/91,
use 0.0.0.0 for c lines when filtering the SDP.
Covered by updated test.

* Modules/mediastream/PeerConnectionBackend.cpp:
(WebCore::PeerConnectionBackend::filterSDP const):

LayoutTests:

* webrtc/datachannel/filter-ice-candidate.html:

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

LayoutTests/ChangeLog
LayoutTests/webrtc/datachannel/filter-ice-candidate.html
Source/WebCore/ChangeLog
Source/WebCore/Modules/mediastream/PeerConnectionBackend.cpp

index 8f55d72..cbf7b88 100644 (file)
@@ -1,3 +1,12 @@
+2019-07-15  Youenn Fablet  <youenn@apple.com>
+
+        Filter SDP c lines
+        https://bugs.webkit.org/show_bug.cgi?id=199791
+
+        Reviewed by Eric Carlson.
+
+        * webrtc/datachannel/filter-ice-candidate.html:
+
 2019-07-14  Dean Jackson  <dino@apple.com>
 
         WebGL not supported on WKWebView on UIKit for Mac
index 8e7b033..96937b7 100644 (file)
@@ -24,8 +24,10 @@ promise_test((test) => {
                 return;
             }
             assert_equals(pc.localDescription.sdp.indexOf("a=candidate"), -1);
+            assert_true(pc.localDescription.sdp.indexOf("c=IN IP4 0.0.0.0") != -1 || pc.localDescription.sdp.indexOf("c=IN IP6 ::") != -1);
             if (counter === 0) {
                 pc.createOffer().then((offer) => {
+                    assert_true(offer.sdp.indexOf("c=IN IP4 0.0.0.0") != -1 || pc.localDescription.sdp.indexOf("c=IN IP6 ::") != -1);
                     assert_equals(offer.sdp.indexOf("a=candidate"), -1);
                     resolve();
                 });
@@ -54,10 +56,12 @@ promise_test((test) => {
                 counter++;
                 return;
             }
+            assert_true(pc.localDescription.sdp.indexOf("c=IN IP4 0.0.0.0") == -1 && pc.localDescription.sdp.indexOf("c=IN IP6 ::") === -1);
             assert_false(pc.localDescription.sdp.indexOf("a=candidate") === -1);
             if (counter !== 0) {
                 // Redoing an offer now that we have some candidates.
                 pc.createOffer().then((offer) => {
+                    assert_true(offer.sdp.indexOf("c=IN IP4 0.0.0.0") == -1 && pc.localDescription.sdp.indexOf("c=IN IP6 ::") === -1);
                     assert_false(offer.sdp.indexOf("a=candidate") === -1);
                     resolve();
                 });
index af26e65..d2eb69a 100644 (file)
@@ -1,3 +1,17 @@
+2019-07-15  Youenn Fablet  <youenn@apple.com>
+
+        Filter SDP c lines
+        https://bugs.webkit.org/show_bug.cgi?id=199791
+
+        Reviewed by Eric Carlson.
+
+        As discussed in https://github.com/rtcweb-wg/mdns-ice-candidates/issues/91,
+        use 0.0.0.0 for c lines when filtering the SDP.
+        Covered by updated test.
+
+        * Modules/mediastream/PeerConnectionBackend.cpp:
+        (WebCore::PeerConnectionBackend::filterSDP const):
+
 2019-07-15  Zalan Bujtas  <zalan@apple.com>
 
         naver.com: Video stops when tapping on the video to use buttons
index 21adefe..39c73a8 100644 (file)
@@ -412,7 +412,11 @@ String PeerConnectionBackend::filterSDP(String&& sdp) const
 
     StringBuilder filteredSDP;
     sdp.split('\n', [&filteredSDP](StringView line) {
-        if (!line.startsWith("a=candidate"))
+        if (line.startsWith("c=IN IP4"))
+            filteredSDP.append("c=IN IP4 0.0.0.0");
+        else if (line.startsWith("c=IN IP6"))
+            filteredSDP.append("c=IN IP6 ::");
+        else if (!line.startsWith("a=candidate"))
             filteredSDP.append(line);
         else if (line.find(" host ", 11) == notFound)
             filteredSDP.append(filterICECandidate(line.toString()));