RTCRtpTransceiver.stopped should be true when applying a remote description with...
authoryouenn@apple.com <youenn@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 14 Dec 2018 02:19:20 +0000 (02:19 +0000)
committeryouenn@apple.com <youenn@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 14 Dec 2018 02:19:20 +0000 (02:19 +0000)
https://bugs.webkit.org/show_bug.cgi?id=192685

Reviewed by Eric Carlson.

LayoutTests/imported/w3c:

* web-platform-tests/webrtc/RTCPeerConnection-setDescription-transceiver-expected.txt:
* web-platform-tests/webrtc/RTCPeerConnection-setDescription-transceiver.html:

Source/WebCore:

In case the remote description contains a rejected m section,
the corresponding transceiver should be marked as stopped.
Libwebrtc backend has that information so pipe it up to JS.

Covered by updated WPT test.

* Modules/mediastream/RTCRtpTransceiver.cpp:
(WebCore::RTCRtpTransceiver::stopped const):
* Modules/mediastream/RTCRtpTransceiver.h:
(WebCore::RTCRtpTransceiver::stopped const): Deleted.
* Modules/mediastream/RTCRtpTransceiverBackend.h:
* Modules/mediastream/libwebrtc/LibWebRTCRtpTransceiverBackend.cpp:
(WebCore::LibWebRTCRtpTransceiverBackend::stopped const):
* Modules/mediastream/libwebrtc/LibWebRTCRtpTransceiverBackend.h:

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

LayoutTests/imported/w3c/ChangeLog
LayoutTests/imported/w3c/web-platform-tests/webrtc/RTCPeerConnection-setDescription-transceiver-expected.txt
LayoutTests/imported/w3c/web-platform-tests/webrtc/RTCPeerConnection-setDescription-transceiver.html
Source/WebCore/ChangeLog
Source/WebCore/Modules/mediastream/RTCRtpTransceiver.cpp
Source/WebCore/Modules/mediastream/RTCRtpTransceiver.h
Source/WebCore/Modules/mediastream/RTCRtpTransceiverBackend.h
Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCRtpTransceiverBackend.cpp
Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCRtpTransceiverBackend.h

index 7ff7fd9..01c2d41 100644 (file)
@@ -1,3 +1,13 @@
+2018-12-13  Youenn Fablet  <youenn@apple.com>
+
+        RTCRtpTransceiver.stopped should be true when applying a remote description with the corresponding m section rejected
+        https://bugs.webkit.org/show_bug.cgi?id=192685
+
+        Reviewed by Eric Carlson.
+
+        * web-platform-tests/webrtc/RTCPeerConnection-setDescription-transceiver-expected.txt:
+        * web-platform-tests/webrtc/RTCPeerConnection-setDescription-transceiver.html:
+
 2018-12-10  Rob Buis  <rbuis@igalia.com>
 
         XMLHttpRequest removes spaces from content-types before processing
index 6b88ae6..dfaf02f 100644 (file)
@@ -4,4 +4,5 @@ PASS setRemoteDescription(offer) with m= section and no existing transceiver sho
 FAIL setLocalDescription(rollback) should unset transceiver.mid promise_test: Unhandled rejection with value: object "InvalidStateError: Description type incompatible with current signaling state"
 FAIL setLocalDescription(rollback) should only unset transceiver mids associated with current round promise_test: Unhandled rejection with value: object "InvalidStateError: Description type incompatible with current signaling state"
 FAIL setRemoteDescription(rollback) should remove newly created transceiver from transceiver list promise_test: Unhandled rejection with value: object "InvalidStateError: Description type incompatible with current signaling state"
+PASS setRemoteDescription should stop the transceiver if its corresponding m section is rejected 
 
index 5fc957d..fd1b16e 100644 (file)
     });
   }, 'setRemoteDescription(rollback) should remove newly created transceiver from transceiver list');
 
+  promise_test(async t => {
+    const pc1 = new RTCPeerConnection();
+    t.add_cleanup(() => pc1.close());
+    const pc2 = new RTCPeerConnection();
+    t.add_cleanup(() => pc2.close());
+
+    pc1.addTransceiver('audio');
+    const offer = await pc1.createOffer();
+    await pc1.setLocalDescription(offer);
+
+    assert_false(pc1.getTransceivers()[0].stopped, 'Transceiver is not stopped');
+
+    await pc2.setRemoteDescription(offer);
+    pc2.getTransceivers()[0].stop();
+    const answer = await pc2.createAnswer();
+
+    await pc1.setRemoteDescription(answer);
+
+    assert_true(pc1.getTransceivers()[0].stopped, 'Transceiver is stopped');
+  }, 'setRemoteDescription should stop the transceiver if its corresponding m section is rejected');
+
   /*
     TODO
       - Steps for transceiver direction is added to tip of tree draft, but not yet
index a3665ca..4c6c381 100644 (file)
@@ -1,3 +1,25 @@
+2018-12-13  Youenn Fablet  <youenn@apple.com>
+
+        RTCRtpTransceiver.stopped should be true when applying a remote description with the corresponding m section rejected
+        https://bugs.webkit.org/show_bug.cgi?id=192685
+
+        Reviewed by Eric Carlson.
+
+        In case the remote description contains a rejected m section,
+        the corresponding transceiver should be marked as stopped.
+        Libwebrtc backend has that information so pipe it up to JS.
+
+        Covered by updated WPT test.
+
+        * Modules/mediastream/RTCRtpTransceiver.cpp:
+        (WebCore::RTCRtpTransceiver::stopped const):
+        * Modules/mediastream/RTCRtpTransceiver.h:
+        (WebCore::RTCRtpTransceiver::stopped const): Deleted.
+        * Modules/mediastream/RTCRtpTransceiverBackend.h:
+        * Modules/mediastream/libwebrtc/LibWebRTCRtpTransceiverBackend.cpp:
+        (WebCore::LibWebRTCRtpTransceiverBackend::stopped const):
+        * Modules/mediastream/libwebrtc/LibWebRTCRtpTransceiverBackend.h:
+
 2018-12-13  Mark Lam  <mark.lam@apple.com>
 
         Ensure that StructureFlags initialization always starts with Base::StructureFlags.
index 601246e..a4015c3 100644 (file)
@@ -114,6 +114,13 @@ void RtpTransceiverSet::append(Ref<RTCRtpTransceiver>&& transceiver)
     m_transceivers.append(WTFMove(transceiver));
 }
 
+bool RTCRtpTransceiver::stopped() const
+{
+    if (m_backend)
+        return m_backend->stopped();
+    return m_stopped;
+}
+
 } // namespace WebCore
 
 #endif // ENABLE(WEB_RTC)
index b991d72..7d1814c 100644 (file)
@@ -62,7 +62,7 @@ public:
     RTCRtpSender& sender() { return m_sender.get(); }
     RTCRtpReceiver& receiver() { return m_receiver.get(); }
 
-    bool stopped() const { return m_stopped; }
+    bool stopped() const;
     void stop();
 
     // FIXME: Temporary solution to keep track of ICE states for this transceiver. Later, each
index f280ea4..670b2d8 100644 (file)
@@ -40,6 +40,7 @@ public:
 
     virtual String mid() = 0;
     virtual void stop() = 0;
+    virtual bool stopped() const = 0;
 };
 
 } // namespace WebCore
index 850cfe9..a898340 100644 (file)
@@ -73,6 +73,11 @@ void LibWebRTCRtpTransceiverBackend::stop()
     m_rtcTransceiver->Stop();
 }
 
+bool LibWebRTCRtpTransceiverBackend::stopped() const
+{
+    return m_rtcTransceiver->stopped();
+}
+
 } // namespace WebCore
 
 #endif // ENABLE(WEB_RTC) && USE(LIBWEBRTC)
index 3a6326e..3112d6b 100644 (file)
@@ -59,6 +59,7 @@ private:
     void setDirection(RTCRtpTransceiverDirection) final;
     String mid() final;
     void stop() final;
+    bool stopped() const final;
 
     rtc::scoped_refptr<webrtc::RtpTransceiverInterface> m_rtcTransceiver;
 };