Changeset 240152 in webkit


Ignore:
Timestamp:
Jan 18, 2019 9:19:26 AM (5 years ago)
Author:
youenn@apple.com
Message:

A track source should be unmuted whenever reenabled after setDirection changes
https://bugs.webkit.org/show_bug.cgi?id=193554
<rdar://problem/47366196>

Reviewed by Eric Carlson.

Source/WebCore:

Ensure that track gets unmuted after being fired as part of track event.
Test is triggering some existing issues with MediaPlayerPrivateMediaStreamAVFObjC.
Given the enqueuing of samples happens in a different frame than the thread used to update media stream and the active video track,
some enqueued samples might not be from the right active video track or there might be no active video track.

Test: webrtc/video-setDirection.html

  • Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:

(WebCore::LibWebRTCMediaEndpoint::fireTrackEvent):

  • Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h:
  • platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:

(WebCore::MediaPlayerPrivateMediaStreamAVFObjC::enqueueVideoSample):
(WebCore::MediaPlayerPrivateMediaStreamAVFObjC::requestNotificationWhenReadyForVideoData):

LayoutTests:

  • webrtc/video-setDirection-expected.txt: Added.
  • webrtc/video-setDirection.html: Added.
Location:
trunk
Files:
2 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r240150 r240152  
     12019-01-18  Youenn Fablet  <youenn@apple.com>
     2
     3        A track source should be unmuted whenever reenabled after setDirection changes
     4        https://bugs.webkit.org/show_bug.cgi?id=193554
     5        <rdar://problem/47366196>
     6
     7        Reviewed by Eric Carlson.
     8
     9        * webrtc/video-setDirection-expected.txt: Added.
     10        * webrtc/video-setDirection.html: Added.
     11
    1122019-01-18  Jonathan Bedard  <jbedard@apple.com>
    213
  • trunk/Source/WebCore/ChangeLog

    r240148 r240152  
     12019-01-18  Youenn Fablet  <youenn@apple.com>
     2
     3        A track source should be unmuted whenever reenabled after setDirection changes
     4        https://bugs.webkit.org/show_bug.cgi?id=193554
     5        <rdar://problem/47366196>
     6
     7        Reviewed by Eric Carlson.
     8
     9        Ensure that track gets unmuted after being fired as part of track event.
     10        Test is triggering some existing issues with MediaPlayerPrivateMediaStreamAVFObjC.
     11        Given the enqueuing of samples happens in a different frame than the thread used to update media stream and the active video track,
     12        some enqueued samples might not be from the right active video track or there might be no active video track.
     13
     14        Test: webrtc/video-setDirection.html
     15
     16        * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
     17        (WebCore::LibWebRTCMediaEndpoint::fireTrackEvent):
     18        * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h:
     19        * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
     20        (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::enqueueVideoSample):
     21        (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::requestNotificationWhenReadyForVideoData):
     22
    1232019-01-18  Charlie Turner  <cturner@igalia.com>
    224
  • trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp

    r240120 r240152  
    414414}
    415415
    416 void LibWebRTCMediaEndpoint::fireTrackEvent(Ref<RTCRtpReceiver>&& receiver, Ref<MediaStreamTrack>&& track, const std::vector<rtc::scoped_refptr<webrtc::MediaStreamInterface>>& rtcStreams, RefPtr<RTCRtpTransceiver>&& transceiver)
     416void LibWebRTCMediaEndpoint::fireTrackEvent(Ref<RTCRtpReceiver>&& receiver, MediaStreamTrack& track, const std::vector<rtc::scoped_refptr<webrtc::MediaStreamInterface>>& rtcStreams, RefPtr<RTCRtpTransceiver>&& transceiver)
    417417{
    418418    Vector<RefPtr<MediaStream>> streams;
     
    420420        auto& mediaStream = mediaStreamFromRTCStream(*rtcStream.get());
    421421        streams.append(&mediaStream);
    422         mediaStream.addTrackFromPlatform(track.get());
     422        mediaStream.addTrackFromPlatform(track);
    423423    }
    424424    auto streamIds = WTF::map(streams, [](auto& stream) -> String {
    425425        return stream->id();
    426426    });
    427     m_remoteStreamsFromRemoteTrack.add(track.ptr(), WTFMove(streamIds));
     427    m_remoteStreamsFromRemoteTrack.add(&track, WTFMove(streamIds));
    428428
    429429    m_peerConnectionBackend.connection().fireEvent(RTCTrackEvent::create(eventNames().trackEvent,
    430         Event::CanBubble::No, Event::IsCancelable::No, WTFMove(receiver), WTFMove(track), WTFMove(streams), WTFMove(transceiver)));
     430        Event::CanBubble::No, Event::IsCancelable::No, WTFMove(receiver), &track, WTFMove(streams), WTFMove(transceiver)));
     431
     432    // FIXME: As per spec, we should set muted to 'false' when starting to receive the content from network.
     433    track.source().setMuted(false);
    431434}
    432435
  • trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h

    r240120 r240152  
    144144    void removeRemoteTrack(rtc::scoped_refptr<webrtc::RtpReceiverInterface>&&);
    145145
    146     void fireTrackEvent(Ref<RTCRtpReceiver>&&, Ref<MediaStreamTrack>&&, const std::vector<rtc::scoped_refptr<webrtc::MediaStreamInterface>>&, RefPtr<RTCRtpTransceiver>&&);
     146    void fireTrackEvent(Ref<RTCRtpReceiver>&&, MediaStreamTrack&, const std::vector<rtc::scoped_refptr<webrtc::MediaStreamInterface>>&, RefPtr<RTCRtpTransceiver>&&);
    147147
    148148    template<typename T>
  • trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm

    r239461 r240152  
    360360void MediaPlayerPrivateMediaStreamAVFObjC::enqueueVideoSample(MediaStreamTrackPrivate& track, MediaSample& sample)
    361361{
    362     ASSERT(m_videoTrackMap.contains(track.id()));
    363 
    364362    if (&track != m_mediaStreamPrivate->activeVideoTrack())
    365363        return;
     
    414412
    415413        [m_sampleBufferDisplayLayer stopRequestingMediaData];
     414
     415        if (!m_activeVideoTrack) {
     416            m_pendingVideoSampleQueue.clear();
     417            return;
     418        }
    416419
    417420        while (!m_pendingVideoSampleQueue.isEmpty()) {
Note: See TracChangeset for help on using the changeset viewer.