Changeset 197020 in webkit


Ignore:
Timestamp:
Feb 24, 2016 12:14:58 AM (8 years ago)
Author:
adam.bergkvist@ericsson.com
Message:

WebRTC: RTCPeerConnection: Sort out responsibilities of close() and stop()
https://bugs.webkit.org/show_bug.cgi?id=154581

Reviewed by Eric Carlson.

Source/WebCore:

Let RTCPeerConnection::close() contain all teardown logic be called by stop().
close() is also responisble for stopping the PeerConnectionBackend and stopping
all RTCRtpSender objects.

Test coverage:
fast/mediastream/RTCRtpSender-replaceTrack.html (updated)
fast/mediastream/RTCPeerConnection-closed-state.html

  • Modules/mediastream/RTCPeerConnection.cpp:

(WebCore::RTCPeerConnection::close):
(WebCore::RTCPeerConnection::stop):
(WebCore::RTCPeerConnection::RTCPeerConnection): Deleted.

  • Modules/mediastream/RTCPeerConnection.h:

LayoutTests:

Updated test with replaceTrack() call after the RTCPeerConnection object, that
created the RTCRtpSender, is closed.

  • fast/mediastream/RTCRtpSender-replaceTrack-expected.txt:
  • fast/mediastream/RTCRtpSender-replaceTrack.html:
Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r197012 r197020  
     12016-02-24  Adam Bergkvist  <adam.bergkvist@ericsson.com>
     2
     3        WebRTC: RTCPeerConnection: Sort out responsibilities of close() and stop()
     4        https://bugs.webkit.org/show_bug.cgi?id=154581
     5
     6        Reviewed by Eric Carlson.
     7
     8        Updated test with replaceTrack() call after the RTCPeerConnection object, that
     9        created the RTCRtpSender, is closed.
     10
     11        * fast/mediastream/RTCRtpSender-replaceTrack-expected.txt:
     12        * fast/mediastream/RTCRtpSender-replaceTrack.html:
     13
    1142016-02-23  Chris Dumez  <cdumez@apple.com>
    215
  • trunk/LayoutTests/fast/mediastream/RTCRtpSender-replaceTrack-expected.txt

    r194968 r197020  
    1717Stop sender, and try replacing the track
    1818PASS promise sender.replaceTrack(audioTrack2) rejected with [object DOMError]
     19Create a new sender
     20PASS sender = pc.addTrack(audioTrack2, stream) did not throw exception.
     21Close pc and try replacing the track
     22PASS promise sender.replaceTrack(audioTrack3) rejected with [object DOMError]
    1923End of promise chain
    2024PASS successfullyParsed is true
  • trunk/LayoutTests/fast/mediastream/RTCRtpSender-replaceTrack.html

    r194968 r197020  
    3030
    3131                audioTrack2 = audioTrack.clone();
     32                audioTrack3 = audioTrack.clone();
    3233
    3334                shouldBe("pc.getSenders().length", "0");
     
    5657                    pc.removeTrack(sender);
    5758                    return promiseShouldReject("sender.replaceTrack(audioTrack2)");
     59                })
     60                .catch(function () {
     61                    debug("Create a new sender");
     62                    shouldNotThrow("sender = pc.addTrack(audioTrack2, stream)");
     63                    debug("Close pc and try replacing the track");
     64                    pc.close();
     65                    return promiseShouldReject("sender.replaceTrack(audioTrack3)");
    5866                })
    5967                .catch(function () {
  • trunk/Source/WebCore/ChangeLog

    r197019 r197020  
     12016-02-24  Adam Bergkvist  <adam.bergkvist@ericsson.com>
     2
     3        WebRTC: RTCPeerConnection: Sort out responsibilities of close() and stop()
     4        https://bugs.webkit.org/show_bug.cgi?id=154581
     5
     6        Reviewed by Eric Carlson.
     7
     8        Let RTCPeerConnection::close() contain all teardown logic be called by stop().
     9        close() is also responisble for stopping the PeerConnectionBackend and stopping
     10        all RTCRtpSender objects.
     11
     12        Test coverage:
     13        fast/mediastream/RTCRtpSender-replaceTrack.html (updated)
     14        fast/mediastream/RTCPeerConnection-closed-state.html
     15
     16        * Modules/mediastream/RTCPeerConnection.cpp:
     17        (WebCore::RTCPeerConnection::close):
     18        (WebCore::RTCPeerConnection::stop):
     19        (WebCore::RTCPeerConnection::RTCPeerConnection): Deleted.
     20        * Modules/mediastream/RTCPeerConnection.h:
     21
    1222016-02-24  Adam Bergkvist  <adam.bergkvist@ericsson.com>
    223
  • trunk/Source/WebCore/Modules/mediastream/RTCPeerConnection.cpp

    r197019 r197020  
    8080    , m_iceConnectionState(IceConnectionState::New)
    8181    , m_configuration(WTFMove(configuration))
    82     , m_stopped(false)
    8382{
    8483    Document& document = downcast<Document>(context);
     
    368367        return;
    369368
    370     m_signalingState = SignalingState::Closed;
    371 }
    372 
    373 void RTCPeerConnection::stop()
    374 {
    375     if (m_stopped)
    376         return;
    377 
    378     m_stopped = true;
     369    m_backend->stop();
     370
    379371    m_iceConnectionState = IceConnectionState::Closed;
    380372    m_signalingState = SignalingState::Closed;
     373
     374    for (auto& sender : m_senderSet)
     375        sender->stop();
     376}
     377
     378void RTCPeerConnection::stop()
     379{
     380    close();
    381381}
    382382
  • trunk/Source/WebCore/Modules/mediastream/RTCPeerConnection.h

    r197019 r197020  
    148148
    149149    RefPtr<RTCConfiguration> m_configuration;
    150 
    151     bool m_stopped;
    152150};
    153151
Note: See TracChangeset for help on using the changeset viewer.