Changeset 212338 in webkit


Ignore:
Timestamp:
Feb 14, 2017, 5:23:39 PM (9 years ago)
Author:
commit-queue@webkit.org
Message:

[WebRTC] Add support for libwebrtc negotiation needed event
https://bugs.webkit.org/show_bug.cgi?id=168267

Patch by Youenn Fablet <youennf@gmail.com> on 2017-02-14
Reviewed by Eric Carlson.

Source/WebCore:

Test: webrtc/negotiatedneeded-event-addStream.html

Moving generic code (markAsNeedingNegotiation) from MediaEndpointPeerConnection to PeerConnectionBackend.
This code handles the control of sending or not the negotiationneeded event.

Updating mock to use markAsNeedingNegotiation when streams are changed.
Updating libwebrtc backend to call markAsNeedingNegotiation when required by libwebrtc implementation.

  • Modules/mediastream/MediaEndpointPeerConnection.cpp:

(WebCore::MediaEndpointPeerConnection::setLocalDescriptionTask):

  • Modules/mediastream/MediaEndpointPeerConnection.h:
  • Modules/mediastream/PeerConnectionBackend.cpp:

(WebCore::PeerConnectionBackend::markAsNeedingNegotiation):

  • Modules/mediastream/PeerConnectionBackend.h:

(WebCore::PeerConnectionBackend::isNegotiationNeeded):
(WebCore::PeerConnectionBackend::clearNegotiationNeededState):

  • Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:

(WebCore::LibWebRTCMediaEndpoint::OnRenegotiationNeeded):

  • Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
  • Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.h:
  • testing/MockLibWebRTCPeerConnection.cpp:

(WebCore::MockLibWebRTCPeerConnection::AddStream):
(WebCore::MockLibWebRTCPeerConnection::RemoveStream):

LayoutTests:

  • fast/mediastream/RTCPeerConnection-more-media-to-negotiate-expected.txt:
  • platform/gtk/fast/mediastream/RTCPeerConnection-more-media-to-negotiate-expected.txt: Copied from LayoutTests/fast/mediastream/RTCPeerConnection-more-media-to-negotiate-expected.txt.
  • webrtc/negotiatedneeded-event-addStream-expected.txt: Added.
  • webrtc/negotiatedneeded-event-addStream.html: Added.
Location:
trunk
Files:
3 added
11 edited
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r212337 r212338  
     12017-02-14  Youenn Fablet  <youennf@gmail.com>
     2
     3        [WebRTC] Add support for libwebrtc negotiation needed event
     4        https://bugs.webkit.org/show_bug.cgi?id=168267
     5
     6        Reviewed by Eric Carlson.
     7
     8        * fast/mediastream/RTCPeerConnection-more-media-to-negotiate-expected.txt:
     9        * platform/gtk/fast/mediastream/RTCPeerConnection-more-media-to-negotiate-expected.txt: Copied from LayoutTests/fast/mediastream/RTCPeerConnection-more-media-to-negotiate-expected.txt.
     10        * webrtc/negotiatedneeded-event-addStream-expected.txt: Added.
     11        * webrtc/negotiatedneeded-event-addStream.html: Added.
     12
    1132017-02-14  Ryan Haddad  <ryanhaddad@apple.com>
    214
  • trunk/LayoutTests/fast/mediastream/RTCPeerConnection-more-media-to-negotiate-expected.txt

    r202339 r212338  
    1919Create an answer for the audio only offer
    2020Set answer as local description
    21 PASS negotiationneededevent fired: There is local media not negotiated that needs to be negotiated in a follow-up offer
    2221PASS Answer set
    2322PASS successfullyParsed is true
  • trunk/Source/WebCore/ChangeLog

    r212335 r212338  
     12017-02-14  Youenn Fablet  <youennf@gmail.com>
     2
     3        [WebRTC] Add support for libwebrtc negotiation needed event
     4        https://bugs.webkit.org/show_bug.cgi?id=168267
     5
     6        Reviewed by Eric Carlson.
     7
     8        Test: webrtc/negotiatedneeded-event-addStream.html
     9
     10        Moving generic code (markAsNeedingNegotiation) from MediaEndpointPeerConnection to PeerConnectionBackend.
     11        This code handles the control of sending or not the negotiationneeded event.
     12
     13        Updating mock to use markAsNeedingNegotiation when streams are changed.
     14        Updating libwebrtc backend to call markAsNeedingNegotiation when required by libwebrtc implementation.
     15
     16        * Modules/mediastream/MediaEndpointPeerConnection.cpp:
     17        (WebCore::MediaEndpointPeerConnection::setLocalDescriptionTask):
     18        * Modules/mediastream/MediaEndpointPeerConnection.h:
     19        * Modules/mediastream/PeerConnectionBackend.cpp:
     20        (WebCore::PeerConnectionBackend::markAsNeedingNegotiation):
     21        * Modules/mediastream/PeerConnectionBackend.h:
     22        (WebCore::PeerConnectionBackend::isNegotiationNeeded):
     23        (WebCore::PeerConnectionBackend::clearNegotiationNeededState):
     24        * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
     25        (WebCore::LibWebRTCMediaEndpoint::OnRenegotiationNeeded):
     26        * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
     27        * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.h:
     28        * testing/MockLibWebRTCPeerConnection.cpp:
     29        (WebCore::MockLibWebRTCPeerConnection::AddStream):
     30        (WebCore::MockLibWebRTCPeerConnection::RemoveStream):
     31
    1322017-02-14  Brady Eidson  <beidson@apple.com>
    233
  • trunk/Source/WebCore/Modules/mediastream/MediaEndpointPeerConnection.cpp

    r212329 r212338  
    421421        m_peerConnection.updateIceGatheringState(IceGatheringState::Gathering);
    422422
    423     if (m_peerConnection.internalSignalingState() == SignalingState::Stable && m_negotiationNeeded)
    424         m_peerConnection.scheduleNegotiationNeededEvent();
    425 
     423    markAsNeedingNegotiation();
    426424    setLocalDescriptionSucceeded();
    427425}
     
    732730}
    733731
    734 void MediaEndpointPeerConnection::markAsNeedingNegotiation()
    735 {
    736     if (m_negotiationNeeded)
    737         return;
    738 
    739     m_negotiationNeeded = true;
    740 
    741     if (m_peerConnection.internalSignalingState() == SignalingState::Stable)
    742         m_peerConnection.scheduleNegotiationNeededEvent();
    743 }
    744 
    745732void MediaEndpointPeerConnection::emulatePlatformEvent(const String& action)
    746733{
  • trunk/Source/WebCore/Modules/mediastream/MediaEndpointPeerConnection.h

    r212329 r212338  
    6565    void replaceTrack(RTCRtpSender&, RefPtr<MediaStreamTrack>&&, DOMPromise<void>&&) final;
    6666
    67     bool isNegotiationNeeded() const final { return m_negotiationNeeded; };
    68     void markAsNeedingNegotiation() final;
    69     void clearNegotiationNeededState() final { m_negotiationNeeded = false; };
    70 
    7167    void emulatePlatformEvent(const String& action) final;
    7268
     
    130126
    131127    HashMap<String, RefPtr<MediaStream>> m_remoteStreamMap;
    132 
    133     bool m_negotiationNeeded { false };
    134128};
    135129
  • trunk/Source/WebCore/Modules/mediastream/PeerConnectionBackend.cpp

    r209390 r212338  
    297297}
    298298
     299void PeerConnectionBackend::markAsNeedingNegotiation()
     300{
     301    if (m_negotiationNeeded)
     302        return;
     303   
     304    m_negotiationNeeded = true;
     305   
     306    if (m_peerConnection.internalSignalingState() == PeerConnectionStates::SignalingState::Stable)
     307        m_peerConnection.scheduleNegotiationNeededEvent();
     308}
     309
    299310} // namespace WebCore
    300311
  • trunk/Source/WebCore/Modules/mediastream/PeerConnectionBackend.h

    r212329 r212338  
    9696    virtual void replaceTrack(RTCRtpSender&, RefPtr<MediaStreamTrack>&&, DOMPromise<void>&&) = 0;
    9797
    98     virtual bool isNegotiationNeeded() const = 0;
    99     virtual void markAsNeedingNegotiation() = 0;
    100     virtual void clearNegotiationNeededState() = 0;
     98    void markAsNeedingNegotiation();
     99    bool isNegotiationNeeded() const { return m_negotiationNeeded; };
     100    void clearNegotiationNeededState() { m_negotiationNeeded = false; };
    101101
    102102    virtual void emulatePlatformEvent(const String& action) = 0;
     
    138138    std::optional<DOMPromise<void>> m_setDescriptionPromise;
    139139    std::optional<DOMPromise<void>> m_addIceCandidatePromise;
     140   
     141    bool m_negotiationNeeded { false };
    140142};
    141143
  • trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp

    r212329 r212338  
    381381void LibWebRTCMediaEndpoint::OnRenegotiationNeeded()
    382382{
    383     notImplemented();
     383    callOnMainThread([protectedThis = makeRef(*this)] {
     384        if (protectedThis->isStopped())
     385            return;
     386        protectedThis->m_peerConnectionBackend.markAsNeedingNegotiation();
     387    });
    384388}
    385389
  • trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp

    r212329 r212338  
    202202}
    203203
    204 void LibWebRTCPeerConnectionBackend::markAsNeedingNegotiation()
    205 {
    206     // FIXME: Implement this
    207 }
    208 
    209204Ref<RTCRtpReceiver> LibWebRTCPeerConnectionBackend::createReceiver(const String&, const String& trackKind, const String& trackId)
    210205{
  • trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.h

    r212329 r212338  
    7171    Vector<RefPtr<MediaStream>> getRemoteStreams() const final { return { }; }
    7272    void replaceTrack(RTCRtpSender&, RefPtr<MediaStreamTrack>&&, DOMPromise<void>&&) final { }
    73     bool isNegotiationNeeded() const final { return false; }
    74     void markAsNeedingNegotiation() final;
    75     void clearNegotiationNeededState() final { }
    7673
    7774    void emulatePlatformEvent(const String&) final { }
  • trunk/Source/WebCore/testing/MockLibWebRTCPeerConnection.cpp

    r212269 r212338  
    227227{
    228228    m_stream = stream;
     229    LibWebRTCProvider::callOnWebRTCSignalingThread([observer = &m_observer] {
     230        observer->OnRenegotiationNeeded();
     231    });
    229232    return true;
    230233}
     
    232235void MockLibWebRTCPeerConnection::RemoveStream(webrtc::MediaStreamInterface*)
    233236{
     237    LibWebRTCProvider::callOnWebRTCSignalingThread([observer = &m_observer] {
     238        observer->OnRenegotiationNeeded();
     239    });
    234240    m_stream = nullptr;
    235241}
Note: See TracChangeset for help on using the changeset viewer.