Calling removeTrack with RTCRtpSender does not set SenderTrack to null
authoryouenn@apple.com <youenn@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 13 Mar 2018 21:14:13 +0000 (21:14 +0000)
committeryouenn@apple.com <youenn@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 13 Mar 2018 21:14:13 +0000 (21:14 +0000)
https://bugs.webkit.org/show_bug.cgi?id=183308

Reviewed by Eric Carlson.

LayoutTests/imported/w3c:

* web-platform-tests/webrtc/RTCPeerConnection-removeTrack.https-expected.txt:

Source/WebCore:

Covered by updated test.

* Modules/mediastream/RTCRtpSender.cpp:
(WebCore::RTCRtpSender::stop): Set track to null when being stopped i.e. removed.
* Modules/mediastream/RTCRtpSender.h:

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

LayoutTests/imported/w3c/ChangeLog
LayoutTests/imported/w3c/web-platform-tests/webrtc/RTCPeerConnection-removeTrack.https-expected.txt
Source/WebCore/ChangeLog
Source/WebCore/Modules/mediastream/RTCRtpSender.cpp
Source/WebCore/Modules/mediastream/RTCRtpSender.h

index ed4195b..c35a044 100644 (file)
@@ -1,3 +1,12 @@
+2018-03-13  Youenn Fablet  <youenn@apple.com>
+
+        Calling removeTrack with RTCRtpSender does not set SenderTrack to null
+        https://bugs.webkit.org/show_bug.cgi?id=183308
+
+        Reviewed by Eric Carlson.
+
+        * web-platform-tests/webrtc/RTCPeerConnection-removeTrack.https-expected.txt:
+
 2018-03-12  Chris Dumez  <cdumez@apple.com>
 
         Return boolean from DOMTokenList's replace() method
index c333412..aae4e59 100644 (file)
@@ -6,7 +6,7 @@ PASS addTrack - Calling removeTrack on different connection that is closed shoul
 FAIL addTransceiver - Calling removeTrack on different connection should throw InvalidAccessError assert_throws: function "() => pc2.removeTrack(sender)" did not throw
 FAIL addTrack - Calling removeTrack on different connection should throw InvalidAccessError assert_throws: function "() => pc2.removeTrack(sender)" did not throw
 FAIL addTransceiver - Calling removeTrack with valid sender should set sender.track to null assert_equals: expected (object) null but got (undefined) undefined
-FAIL addTrack - Calling removeTrack with valid sender should set sender.track to null assert_equals: expected null but got object "[object MediaStreamTrack]"
+PASS addTrack - Calling removeTrack with valid sender should set sender.track to null 
 FAIL Calling removeTrack with currentDirection sendrecv should set direction to recvonly assert_equals: expected (object) null but got (undefined) undefined
 FAIL Calling removeTrack with currentDirection sendonly should set direction to inactive assert_equals: expected (object) null but got (undefined) undefined
 FAIL Calling removeTrack with currentDirection recvonly should not change direction assert_equals: expected (object) null but got (undefined) undefined
index be6fb0c..b5be5be 100644 (file)
@@ -1,5 +1,18 @@
 2018-03-13  Youenn Fablet  <youenn@apple.com>
 
+        Calling removeTrack with RTCRtpSender does not set SenderTrack to null
+        https://bugs.webkit.org/show_bug.cgi?id=183308
+
+        Reviewed by Eric Carlson.
+
+        Covered by updated test.
+
+        * Modules/mediastream/RTCRtpSender.cpp:
+        (WebCore::RTCRtpSender::stop): Set track to null when being stopped i.e. removed.
+        * Modules/mediastream/RTCRtpSender.h:
+
+2018-03-13  Youenn Fablet  <youenn@apple.com>
+
         Changing link element rel attribute from preload to stylesheet should succeed loading the stylesheet
         https://bugs.webkit.org/show_bug.cgi?id=183601
         <rdar://problem/38309441>
index 864bb98..93db3db 100644 (file)
@@ -62,6 +62,13 @@ void RTCRtpSender::setTrackToNull()
     m_track = nullptr;
 }
 
+void RTCRtpSender::stop()
+{
+    m_trackId = { };
+    m_track = nullptr;
+    m_backend = nullptr;
+}
+
 void RTCRtpSender::setTrack(Ref<MediaStreamTrack>&& track)
 {
     ASSERT(!isStopped());
index 30e958b..8958df6 100644 (file)
@@ -56,7 +56,7 @@ public:
     void setMediaStreamIds(Vector<String>&& mediaStreamIds) { m_mediaStreamIds = WTFMove(mediaStreamIds); }
 
     bool isStopped() const { return !m_backend; }
-    void stop() { m_backend = nullptr; }
+    void stop();
     void setTrack(Ref<MediaStreamTrack>&&);
     void setTrackToNull();