Title: [261447] trunk/Source/WebCore
Revision
261447
Author
[email protected]
Date
2020-05-09 17:05:59 -0700 (Sat, 09 May 2020)

Log Message

REGRESSION(r258493): CRASH running fast/mediastream/RTCPeerConnection tests
https://bugs.webkit.org/show_bug.cgi?id=211666
<rdar://problem/63055644>

Reviewed by Eric Carlson.

MockMediaStreamTrack advertises that it's a webrtc::VideoTrackInterface, but doesn't inherit from
that interface, leading to a crash when its pointer is cast to webrtc::VideoTrackInterface and a
virtual method called on the resulting pointer. Since it's only used in one place, and since there's
an existing mock webrtc::VideoTrackInterface object in that same file, remove MockMediaStreamTrack
and replace the one place it's used with MockLibWebRTCVideoTrack.

* testing/MockLibWebRTCPeerConnection.h:
(WebCore::MockMediaStreamTrack::state const): Deleted.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (261446 => 261447)


--- trunk/Source/WebCore/ChangeLog	2020-05-10 00:02:35 UTC (rev 261446)
+++ trunk/Source/WebCore/ChangeLog	2020-05-10 00:05:59 UTC (rev 261447)
@@ -1,3 +1,20 @@
+2020-05-09  Jer Noble  <[email protected]>
+
+        REGRESSION(r258493): CRASH running fast/mediastream/RTCPeerConnection tests
+        https://bugs.webkit.org/show_bug.cgi?id=211666
+        <rdar://problem/63055644>
+
+        Reviewed by Eric Carlson.
+
+        MockMediaStreamTrack advertises that it's a webrtc::VideoTrackInterface, but doesn't inherit from
+        that interface, leading to a crash when its pointer is cast to webrtc::VideoTrackInterface and a
+        virtual method called on the resulting pointer. Since it's only used in one place, and since there's
+        an existing mock webrtc::VideoTrackInterface object in that same file, remove MockMediaStreamTrack
+        and replace the one place it's used with MockLibWebRTCVideoTrack.
+
+        * testing/MockLibWebRTCPeerConnection.h:
+        (WebCore::MockMediaStreamTrack::state const): Deleted.
+
 2020-05-09  David Kilzer  <[email protected]>
 
         XML external entity resources should only be loaded from XML MIME types

Modified: trunk/Source/WebCore/testing/MockLibWebRTCPeerConnection.h (261446 => 261447)


--- trunk/Source/WebCore/testing/MockLibWebRTCPeerConnection.h	2020-05-10 00:02:35 UTC (rev 261446)
+++ trunk/Source/WebCore/testing/MockLibWebRTCPeerConnection.h	2020-05-10 00:05:59 UTC (rev 261447)
@@ -129,7 +129,7 @@
     TrackState state() const final { return kLive; }
     bool set_enabled(bool enabled) final { m_enabled = enabled; return true; }
 
-    bool m_enabled;
+    bool m_enabled { true };
     std::string m_id;
     rtc::scoped_refptr<webrtc::VideoTrackSourceInterface> m_source;
 };
@@ -189,19 +189,6 @@
     rtc::scoped_refptr<webrtc::MediaStreamTrackInterface> m_track;
 };
 
-class MockMediaStreamTrack : public webrtc::MediaStreamTrackInterface {
-public:
-    MockMediaStreamTrack() = default;
-private:
-    std::string kind() const final { return "video"; }
-    std::string id() const final { return "mymocktrack"; }
-    bool enabled() const final { return true; }
-    bool set_enabled(bool) final { return true; }
-    TrackState state() const  { return TrackState::kLive; }
-    void RegisterObserver(webrtc::ObserverInterface*) final { }
-    void UnregisterObserver(webrtc::ObserverInterface*) final { }
-};
-
 class MockRtpReceiver : public webrtc::RtpReceiverInterface {
 private:
     cricket::MediaType media_type() const final { return cricket::MEDIA_TYPE_VIDEO; }
@@ -213,7 +200,7 @@
     rtc::scoped_refptr<webrtc::MediaStreamTrackInterface> track() const final
     {
         if (!m_track)
-            const_cast<MockRtpReceiver*>(this)->m_track = new rtc::RefCountedObject<MockMediaStreamTrack>();
+            const_cast<MockRtpReceiver*>(this)->m_track = new rtc::RefCountedObject<MockLibWebRTCVideoTrack>("", nullptr);
         return m_track;
     }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to