webrtc_m130/api/rtp_transceiver_interface.h

177 lines
8.2 KiB
C
Raw Normal View History

/*
* Copyright 2017 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef API_RTP_TRANSCEIVER_INTERFACE_H_
#define API_RTP_TRANSCEIVER_INTERFACE_H_
#include <string>
Reland "Add AddTransceiver and GetTransceivers to PeerConnection" This reverts commit 8b13f96e2d4b0449e54a3665121a4302ceb56e80. Original change's description: > Revert "Add AddTransceiver and GetTransceivers to PeerConnection" > > This reverts commit f93d2800d9b0d5818a5a383def0aaef3d441df3a. > > Reason for revert: https://logs.chromium.org/v/?s=chromium%2Fbb%2Fchromium.webrtc.fyi%2Fios-device%2F5804%2F%2B%2Frecipes%2Fsteps%2Fcompile%2F0%2Fstdout > > Original change's description: > > Add AddTransceiver and GetTransceivers to PeerConnection > > > > WebRTC 1.0 has added the transceiver API to PeerConnection. This > > is the first step towards exposing this to WebRTC consumers. For > > now, transceivers can be added and fetched but there is not yet > > support for creating offers/answers or setting local/remote > > descriptions. That support ("Unified Plan") will be added in > > follow-up CLs. > > > > The transceiver API is currently only available if the application > > opts in by specifying the kUnifiedPlan SDP semantics when creating > > the PeerConnection. > > > > Bug: webrtc:7600 > > Change-Id: I0b8ee24b489b45bb4c5f60b699bd20c61af01d8e > > Reviewed-on: https://webrtc-review.googlesource.com/23880 > > Commit-Queue: Steve Anton <steveanton@webrtc.org> > > Reviewed-by: Peter Thatcher <pthatcher@webrtc.org> > > Reviewed-by: Henrik Boström <hbos@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#20896} > > TBR=steveanton@webrtc.org,zhihuang@webrtc.org,hbos@webrtc.org,pthatcher@webrtc.org > > Change-Id: Ie91ea4988dba25c20e2532114d3a9d859a932d4c > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: webrtc:7600 > Reviewed-on: https://webrtc-review.googlesource.com/26400 > Reviewed-by: Steve Anton <steveanton@webrtc.org> > Commit-Queue: Steve Anton <steveanton@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#20897} TBR=steveanton@webrtc.org,zhihuang@webrtc.org,hbos@webrtc.org,pthatcher@webrtc.org Change-Id: I19fdf08c54f09302794e998a0ffddb82ae0d7b41 No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: webrtc:7600 Reviewed-on: https://webrtc-review.googlesource.com/26401 Commit-Queue: Steve Anton <steveanton@webrtc.org> Reviewed-by: Steve Anton <steveanton@webrtc.org> Cr-Commit-Position: refs/heads/master@{#20898}
2017-11-27 13:01:52 -08:00
#include <vector>
#include "absl/base/attributes.h"
#include "absl/types/optional.h"
#include "api/array_view.h"
#include "api/media_types.h"
#include "api/rtp_parameters.h"
#include "api/rtp_receiver_interface.h"
#include "api/rtp_sender_interface.h"
#include "api/rtp_transceiver_direction.h"
#include "api/scoped_refptr.h"
#include "rtc_base/ref_count.h"
#include "rtc_base/system/rtc_export.h"
namespace webrtc {
Reland "Add AddTransceiver and GetTransceivers to PeerConnection" This reverts commit 8b13f96e2d4b0449e54a3665121a4302ceb56e80. Original change's description: > Revert "Add AddTransceiver and GetTransceivers to PeerConnection" > > This reverts commit f93d2800d9b0d5818a5a383def0aaef3d441df3a. > > Reason for revert: https://logs.chromium.org/v/?s=chromium%2Fbb%2Fchromium.webrtc.fyi%2Fios-device%2F5804%2F%2B%2Frecipes%2Fsteps%2Fcompile%2F0%2Fstdout > > Original change's description: > > Add AddTransceiver and GetTransceivers to PeerConnection > > > > WebRTC 1.0 has added the transceiver API to PeerConnection. This > > is the first step towards exposing this to WebRTC consumers. For > > now, transceivers can be added and fetched but there is not yet > > support for creating offers/answers or setting local/remote > > descriptions. That support ("Unified Plan") will be added in > > follow-up CLs. > > > > The transceiver API is currently only available if the application > > opts in by specifying the kUnifiedPlan SDP semantics when creating > > the PeerConnection. > > > > Bug: webrtc:7600 > > Change-Id: I0b8ee24b489b45bb4c5f60b699bd20c61af01d8e > > Reviewed-on: https://webrtc-review.googlesource.com/23880 > > Commit-Queue: Steve Anton <steveanton@webrtc.org> > > Reviewed-by: Peter Thatcher <pthatcher@webrtc.org> > > Reviewed-by: Henrik Boström <hbos@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#20896} > > TBR=steveanton@webrtc.org,zhihuang@webrtc.org,hbos@webrtc.org,pthatcher@webrtc.org > > Change-Id: Ie91ea4988dba25c20e2532114d3a9d859a932d4c > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: webrtc:7600 > Reviewed-on: https://webrtc-review.googlesource.com/26400 > Reviewed-by: Steve Anton <steveanton@webrtc.org> > Commit-Queue: Steve Anton <steveanton@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#20897} TBR=steveanton@webrtc.org,zhihuang@webrtc.org,hbos@webrtc.org,pthatcher@webrtc.org Change-Id: I19fdf08c54f09302794e998a0ffddb82ae0d7b41 No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: webrtc:7600 Reviewed-on: https://webrtc-review.googlesource.com/26401 Commit-Queue: Steve Anton <steveanton@webrtc.org> Reviewed-by: Steve Anton <steveanton@webrtc.org> Cr-Commit-Position: refs/heads/master@{#20898}
2017-11-27 13:01:52 -08:00
// Structure for initializing an RtpTransceiver in a call to
// PeerConnectionInterface::AddTransceiver.
// https://w3c.github.io/webrtc-pc/#dom-rtcrtptransceiverinit
struct RTC_EXPORT RtpTransceiverInit final {
RtpTransceiverInit();
RtpTransceiverInit(const RtpTransceiverInit&);
~RtpTransceiverInit();
Reland "Add AddTransceiver and GetTransceivers to PeerConnection" This reverts commit 8b13f96e2d4b0449e54a3665121a4302ceb56e80. Original change's description: > Revert "Add AddTransceiver and GetTransceivers to PeerConnection" > > This reverts commit f93d2800d9b0d5818a5a383def0aaef3d441df3a. > > Reason for revert: https://logs.chromium.org/v/?s=chromium%2Fbb%2Fchromium.webrtc.fyi%2Fios-device%2F5804%2F%2B%2Frecipes%2Fsteps%2Fcompile%2F0%2Fstdout > > Original change's description: > > Add AddTransceiver and GetTransceivers to PeerConnection > > > > WebRTC 1.0 has added the transceiver API to PeerConnection. This > > is the first step towards exposing this to WebRTC consumers. For > > now, transceivers can be added and fetched but there is not yet > > support for creating offers/answers or setting local/remote > > descriptions. That support ("Unified Plan") will be added in > > follow-up CLs. > > > > The transceiver API is currently only available if the application > > opts in by specifying the kUnifiedPlan SDP semantics when creating > > the PeerConnection. > > > > Bug: webrtc:7600 > > Change-Id: I0b8ee24b489b45bb4c5f60b699bd20c61af01d8e > > Reviewed-on: https://webrtc-review.googlesource.com/23880 > > Commit-Queue: Steve Anton <steveanton@webrtc.org> > > Reviewed-by: Peter Thatcher <pthatcher@webrtc.org> > > Reviewed-by: Henrik Boström <hbos@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#20896} > > TBR=steveanton@webrtc.org,zhihuang@webrtc.org,hbos@webrtc.org,pthatcher@webrtc.org > > Change-Id: Ie91ea4988dba25c20e2532114d3a9d859a932d4c > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: webrtc:7600 > Reviewed-on: https://webrtc-review.googlesource.com/26400 > Reviewed-by: Steve Anton <steveanton@webrtc.org> > Commit-Queue: Steve Anton <steveanton@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#20897} TBR=steveanton@webrtc.org,zhihuang@webrtc.org,hbos@webrtc.org,pthatcher@webrtc.org Change-Id: I19fdf08c54f09302794e998a0ffddb82ae0d7b41 No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: webrtc:7600 Reviewed-on: https://webrtc-review.googlesource.com/26401 Commit-Queue: Steve Anton <steveanton@webrtc.org> Reviewed-by: Steve Anton <steveanton@webrtc.org> Cr-Commit-Position: refs/heads/master@{#20898}
2017-11-27 13:01:52 -08:00
// Direction of the RtpTransceiver. See RtpTransceiverInterface::direction().
RtpTransceiverDirection direction = RtpTransceiverDirection::kSendRecv;
// The added RtpTransceiver will be added to these streams.
std::vector<std::string> stream_ids;
Reland "Add AddTransceiver and GetTransceivers to PeerConnection" This reverts commit 8b13f96e2d4b0449e54a3665121a4302ceb56e80. Original change's description: > Revert "Add AddTransceiver and GetTransceivers to PeerConnection" > > This reverts commit f93d2800d9b0d5818a5a383def0aaef3d441df3a. > > Reason for revert: https://logs.chromium.org/v/?s=chromium%2Fbb%2Fchromium.webrtc.fyi%2Fios-device%2F5804%2F%2B%2Frecipes%2Fsteps%2Fcompile%2F0%2Fstdout > > Original change's description: > > Add AddTransceiver and GetTransceivers to PeerConnection > > > > WebRTC 1.0 has added the transceiver API to PeerConnection. This > > is the first step towards exposing this to WebRTC consumers. For > > now, transceivers can be added and fetched but there is not yet > > support for creating offers/answers or setting local/remote > > descriptions. That support ("Unified Plan") will be added in > > follow-up CLs. > > > > The transceiver API is currently only available if the application > > opts in by specifying the kUnifiedPlan SDP semantics when creating > > the PeerConnection. > > > > Bug: webrtc:7600 > > Change-Id: I0b8ee24b489b45bb4c5f60b699bd20c61af01d8e > > Reviewed-on: https://webrtc-review.googlesource.com/23880 > > Commit-Queue: Steve Anton <steveanton@webrtc.org> > > Reviewed-by: Peter Thatcher <pthatcher@webrtc.org> > > Reviewed-by: Henrik Boström <hbos@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#20896} > > TBR=steveanton@webrtc.org,zhihuang@webrtc.org,hbos@webrtc.org,pthatcher@webrtc.org > > Change-Id: Ie91ea4988dba25c20e2532114d3a9d859a932d4c > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: webrtc:7600 > Reviewed-on: https://webrtc-review.googlesource.com/26400 > Reviewed-by: Steve Anton <steveanton@webrtc.org> > Commit-Queue: Steve Anton <steveanton@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#20897} TBR=steveanton@webrtc.org,zhihuang@webrtc.org,hbos@webrtc.org,pthatcher@webrtc.org Change-Id: I19fdf08c54f09302794e998a0ffddb82ae0d7b41 No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: webrtc:7600 Reviewed-on: https://webrtc-review.googlesource.com/26401 Commit-Queue: Steve Anton <steveanton@webrtc.org> Reviewed-by: Steve Anton <steveanton@webrtc.org> Cr-Commit-Position: refs/heads/master@{#20898}
2017-11-27 13:01:52 -08:00
std::vector<RtpEncodingParameters> send_encodings;
};
// The RtpTransceiverInterface maps to the RTCRtpTransceiver defined by the
// WebRTC specification. A transceiver represents a combination of an RtpSender
// and an RtpReceiver than share a common mid. As defined in JSEP, an
// RtpTransceiver is said to be associated with a media description if its mid
// property is non-null; otherwise, it is said to be disassociated.
// JSEP: https://tools.ietf.org/html/draft-ietf-rtcweb-jsep-24
//
// Note that RtpTransceivers are only supported when using PeerConnection with
// Unified Plan SDP.
//
// This class is thread-safe.
//
// WebRTC specification for RTCRtpTransceiver, the JavaScript analog:
// https://w3c.github.io/webrtc-pc/#dom-rtcrtptransceiver
class RTC_EXPORT RtpTransceiverInterface : public rtc::RefCountInterface {
public:
// Media type of the transceiver. Any sender(s)/receiver(s) will have this
// type as well.
virtual cricket::MediaType media_type() const = 0;
// The mid attribute is the mid negotiated and present in the local and
// remote descriptions. Before negotiation is complete, the mid value may be
// null. After rollbacks, the value may change from a non-null value to null.
// https://w3c.github.io/webrtc-pc/#dom-rtcrtptransceiver-mid
virtual absl::optional<std::string> mid() const = 0;
// The sender attribute exposes the RtpSender corresponding to the RTP media
// that may be sent with the transceiver's mid. The sender is always present,
// regardless of the direction of media.
// https://w3c.github.io/webrtc-pc/#dom-rtcrtptransceiver-sender
virtual rtc::scoped_refptr<RtpSenderInterface> sender() const = 0;
// The receiver attribute exposes the RtpReceiver corresponding to the RTP
// media that may be received with the transceiver's mid. The receiver is
// always present, regardless of the direction of media.
// https://w3c.github.io/webrtc-pc/#dom-rtcrtptransceiver-receiver
virtual rtc::scoped_refptr<RtpReceiverInterface> receiver() const = 0;
// The stopped attribute indicates that the sender of this transceiver will no
// longer send, and that the receiver will no longer receive. It is true if
// either stop has been called or if setting the local or remote description
// has caused the RtpTransceiver to be stopped.
// 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
Reland "Remove some default implementations in api/rtp_transcever_interface" This reverts commit 226a2e32d03df3a2cf4bf3c616ac00dcd91ed3d2. Reason for revert: Downstream fixed (will submit when true) Original change's description: > Revert "Remove some default implementations in api/rtp_transcever_interface" > > This reverts commit 40941ee72d30676296f3545004e7a6e30b959612. > > Reason for revert: breaks downstream project > > Original change's description: > > Remove some default implementations in api/rtp_transcever_interface > > > > Bug: webrtc:11839 > > Change-Id: I6ddc0468e75bc346e12fc3dc64236ca2ab52e708 > > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/244504 > > Reviewed-by: Henrik Boström <hbos@webrtc.org> > > Commit-Queue: Harald Alvestrand <hta@webrtc.org> > > Cr-Commit-Position: refs/heads/main@{#35701} > > # Not skipping CQ checks because original CL landed > 1 day ago. > > Bug: webrtc:11839 > Change-Id: I8a3eb0a279b28ed8b55745af97596c4a853669be > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/247186 > Reviewed-by: Björn Terelius <terelius@webrtc.org> > Owners-Override: Artem Titov <titovartem@webrtc.org> > Commit-Queue: Artem Titov <titovartem@webrtc.org> > Cr-Commit-Position: refs/heads/main@{#35713} # Not skipping CQ checks because this is a reland. Bug: webrtc:11839 Change-Id: Ie25f1a5fdb4ef8ebf200780755a69dc09dd28ccb Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/247189 Reviewed-by: Henrik Boström <hbos@webrtc.org> Reviewed-by: Artem Titov <titovartem@webrtc.org> Reviewed-by: Björn Terelius <terelius@webrtc.org> Commit-Queue: Harald Alvestrand <hta@webrtc.org> Cr-Commit-Position: refs/heads/main@{#35737}
2022-01-17 21:20:49 +00:00
virtual bool stopping() const = 0;
// 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
virtual RtpTransceiverDirection direction() const = 0;
// Sets the preferred direction of this transceiver. An update of
// directionality does not take effect immediately. Instead, future calls to
// CreateOffer and CreateAnswer mark the corresponding media descriptions as
// sendrecv, sendonly, recvonly, or inactive.
// https://w3c.github.io/webrtc-pc/#dom-rtcrtptransceiver-direction
// TODO(hta): Deprecate SetDirection without error and rename
// SetDirectionWithError to SetDirection, remove default implementations.
ABSL_DEPRECATED("Use SetDirectionWithError instead")
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
// offer/answer exchange, or if the transceiver is stopped, the value is null.
// https://w3c.github.io/webrtc-pc/#dom-rtcrtptransceiver-currentdirection
virtual absl::optional<RtpTransceiverDirection> current_direction() const = 0;
// An internal slot designating for which direction the relevant
// PeerConnection events have been fired. This is to ensure that events like
// OnAddTrack only get fired once even if the same session description is
// applied again.
// Exposed in the public interface for use by Chromium.
virtual absl::optional<RtpTransceiverDirection> fired_direction() const;
// 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
// 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();
ABSL_DEPRECATED("Use StopStandard instead") virtual void Stop();
// The SetCodecPreferences method overrides the default codec preferences used
// by WebRTC for this transceiver.
// https://w3c.github.io/webrtc-pc/#dom-rtcrtptransceiver-setcodecpreferences
virtual RTCError SetCodecPreferences(
Reland "Remove some default implementations in api/rtp_transcever_interface" This reverts commit 226a2e32d03df3a2cf4bf3c616ac00dcd91ed3d2. Reason for revert: Downstream fixed (will submit when true) Original change's description: > Revert "Remove some default implementations in api/rtp_transcever_interface" > > This reverts commit 40941ee72d30676296f3545004e7a6e30b959612. > > Reason for revert: breaks downstream project > > Original change's description: > > Remove some default implementations in api/rtp_transcever_interface > > > > Bug: webrtc:11839 > > Change-Id: I6ddc0468e75bc346e12fc3dc64236ca2ab52e708 > > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/244504 > > Reviewed-by: Henrik Boström <hbos@webrtc.org> > > Commit-Queue: Harald Alvestrand <hta@webrtc.org> > > Cr-Commit-Position: refs/heads/main@{#35701} > > # Not skipping CQ checks because original CL landed > 1 day ago. > > Bug: webrtc:11839 > Change-Id: I8a3eb0a279b28ed8b55745af97596c4a853669be > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/247186 > Reviewed-by: Björn Terelius <terelius@webrtc.org> > Owners-Override: Artem Titov <titovartem@webrtc.org> > Commit-Queue: Artem Titov <titovartem@webrtc.org> > Cr-Commit-Position: refs/heads/main@{#35713} # Not skipping CQ checks because this is a reland. Bug: webrtc:11839 Change-Id: Ie25f1a5fdb4ef8ebf200780755a69dc09dd28ccb Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/247189 Reviewed-by: Henrik Boström <hbos@webrtc.org> Reviewed-by: Artem Titov <titovartem@webrtc.org> Reviewed-by: Björn Terelius <terelius@webrtc.org> Commit-Queue: Harald Alvestrand <hta@webrtc.org> Cr-Commit-Position: refs/heads/main@{#35737}
2022-01-17 21:20:49 +00:00
rtc::ArrayView<RtpCodecCapability> codecs) = 0;
virtual std::vector<RtpCodecCapability> codec_preferences() const = 0;
// Returns the set of header extensions that was set
// with SetHeaderExtensionsToNegotiate, or a default set if it has not been
// called.
// https://w3c.github.io/webrtc-extensions/#rtcrtptransceiver-interface
virtual std::vector<RtpHeaderExtensionCapability>
GetHeaderExtensionsToNegotiate() const = 0;
// Returns either the empty set if negotation has not yet
// happened, or a vector of the negotiated header extensions.
// https://w3c.github.io/webrtc-extensions/#rtcrtptransceiver-interface
virtual std::vector<RtpHeaderExtensionCapability>
GetNegotiatedHeaderExtensions() const = 0;
// The SetHeaderExtensionsToNegotiate method modifies the next SDP negotiation
// so that it negotiates use of header extensions which are not kStopped.
// https://w3c.github.io/webrtc-extensions/#rtcrtptransceiver-interface
virtual webrtc::RTCError SetHeaderExtensionsToNegotiate(
rtc::ArrayView<const RtpHeaderExtensionCapability> header_extensions) = 0;
protected:
~RtpTransceiverInterface() override = default;
};
} // namespace webrtc
#endif // API_RTP_TRANSCEIVER_INTERFACE_H_