Changeset 261447 in webkit


Ignore:
Timestamp:
May 9, 2020 5:05:59 PM (4 years ago)
Author:
jer.noble@apple.com
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.

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r261443 r261447  
     12020-05-09  Jer Noble  <jer.noble@apple.com>
     2
     3        REGRESSION(r258493): CRASH running fast/mediastream/RTCPeerConnection tests
     4        https://bugs.webkit.org/show_bug.cgi?id=211666
     5        <rdar://problem/63055644>
     6
     7        Reviewed by Eric Carlson.
     8
     9        MockMediaStreamTrack advertises that it's a webrtc::VideoTrackInterface, but doesn't inherit from
     10        that interface, leading to a crash when its pointer is cast to webrtc::VideoTrackInterface and a
     11        virtual method called on the resulting pointer. Since it's only used in one place, and since there's
     12        an existing mock webrtc::VideoTrackInterface object in that same file, remove MockMediaStreamTrack
     13        and replace the one place it's used with MockLibWebRTCVideoTrack.
     14
     15        * testing/MockLibWebRTCPeerConnection.h:
     16        (WebCore::MockMediaStreamTrack::state const): Deleted.
     17
    1182020-05-09  David Kilzer  <ddkilzer@apple.com>
    219
  • trunk/Source/WebCore/testing/MockLibWebRTCPeerConnection.h

    r259345 r261447  
    130130    bool set_enabled(bool enabled) final { m_enabled = enabled; return true; }
    131131
    132     bool m_enabled;
     132    bool m_enabled { true };
    133133    std::string m_id;
    134134    rtc::scoped_refptr<webrtc::VideoTrackSourceInterface> m_source;
     
    190190};
    191191
    192 class MockMediaStreamTrack : public webrtc::MediaStreamTrackInterface {
    193 public:
    194     MockMediaStreamTrack() = default;
    195 private:
    196     std::string kind() const final { return "video"; }
    197     std::string id() const final { return "mymocktrack"; }
    198     bool enabled() const final { return true; }
    199     bool set_enabled(bool) final { return true; }
    200     TrackState state() const  { return TrackState::kLive; }
    201     void RegisterObserver(webrtc::ObserverInterface*) final { }
    202     void UnregisterObserver(webrtc::ObserverInterface*) final { }
    203 };
    204 
    205192class MockRtpReceiver : public webrtc::RtpReceiverInterface {
    206193private:
     
    214201    {
    215202        if (!m_track)
    216             const_cast<MockRtpReceiver*>(this)->m_track = new rtc::RefCountedObject<MockMediaStreamTrack>();
     203            const_cast<MockRtpReceiver*>(this)->m_track = new rtc::RefCountedObject<MockLibWebRTCVideoTrack>("", nullptr);
    217204        return m_track;
    218205    }
Note: See TracChangeset for help on using the changeset viewer.