Implement transceiver.stop()

This adds RtpTransceiver.StopStandard(), which behaves according to
the specification at
https://w3c.github.io/webrtc-pc/#dom-rtcrtptransceiver-stop

It modifies RTCPeerConnection.getTransceivers() to return only
transceivers that have not been stopped.

Rebase of armax' https://webrtc-review.googlesource.com/c/src/+/172762

Bug: chromium:980879
Change-Id: I7d383ee874ccc0a006fdcf280496b5d4235425ce
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/180580
Reviewed-by: Kári Helgason <kthelgason@webrtc.org>
Reviewed-by: Sami Kalliomäki <sakal@webrtc.org>
Reviewed-by: Guido Urdaneta <guidou@webrtc.org>
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31893}
This commit is contained in:
Harald Alvestrand
2020-08-10 14:41:03 +02:00
committed by Commit Bot
parent 582102c9b7
commit 11dc6571cb
24 changed files with 604 additions and 253 deletions

View File

@ -89,6 +89,16 @@ class RTC_EXPORT RtpTransceiverInterface : public rtc::RefCountInterface {
// https://w3c.github.io/webrtc-pc/#dom-rtcrtptransceiver-stopped
virtual bool stopped() const = 0;
// The stopping attribute indicates that the user has indicated that the
// sender of this transceiver will stop sending, and that the receiver will
// no longer receive. It is always true if stopped() is true.
// If stopping() is true and stopped() is false, it means that the
// transceiver's stop() method has been called, but the negotiation with
// the other end for shutting down the transceiver is not yet done.
// https://w3c.github.io/webrtc-pc/#dfn-stopping-0
// TODO(hta): Remove default implementation.
virtual bool stopping() const;
// The direction attribute indicates the preferred direction of this
// transceiver, which will be used in calls to CreateOffer and CreateAnswer.
// https://w3c.github.io/webrtc-pc/#dom-rtcrtptransceiver-direction
@ -99,7 +109,10 @@ class RTC_EXPORT RtpTransceiverInterface : public rtc::RefCountInterface {
// CreateOffer and CreateAnswer mark the corresponding media descriptions as
// sendrecv, sendonly, recvonly, or inactive.
// https://w3c.github.io/webrtc-pc/#dom-rtcrtptransceiver-direction
virtual void SetDirection(RtpTransceiverDirection new_direction) = 0;
// TODO(hta): Deprecate SetDirection without error and rename
// SetDirectionWithError to SetDirection, remove default implementations.
virtual void SetDirection(RtpTransceiverDirection new_direction);
virtual RTCError SetDirectionWithError(RtpTransceiverDirection new_direction);
// The current_direction attribute indicates the current direction negotiated
// for this transceiver. If this transceiver has never been represented in an
@ -114,10 +127,19 @@ class RTC_EXPORT RtpTransceiverInterface : public rtc::RefCountInterface {
// Exposed in the public interface for use by Chromium.
virtual absl::optional<RtpTransceiverDirection> fired_direction() const;
// The Stop method irreversibly stops the RtpTransceiver. The sender of this
// transceiver will no longer send, the receiver will no longer receive.
// Initiates a stop of the transceiver.
// The stop is complete when stopped() returns true.
// A stopped transceiver can be reused for a different track.
// https://w3c.github.io/webrtc-pc/#dom-rtcrtptransceiver-stop
virtual void Stop() = 0;
// TODO(hta): Rename to Stop() when users of the non-standard Stop() are
// updated.
virtual RTCError StopStandard();
// Stops a transceiver immediately, without waiting for signalling.
// This is an internal function, and is exposed for historical reasons.
// https://w3c.github.io/webrtc-pc/#dfn-stop-the-rtcrtptransceiver
virtual void StopInternal();
RTC_DEPRECATED virtual void Stop();
// The SetCodecPreferences method overrides the default codec preferences used
// by WebRTC for this transceiver.