summaryrefslogtreecommitdiffstats
path: root/third_party/libwebrtc/webrtc/api/ortc
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/libwebrtc/webrtc/api/ortc')
-rw-r--r--third_party/libwebrtc/webrtc/api/ortc/mediadescription.cc13
-rw-r--r--third_party/libwebrtc/webrtc/api/ortc/mediadescription.h53
-rw-r--r--third_party/libwebrtc/webrtc/api/ortc/mediadescription_unittest.cc30
-rw-r--r--third_party/libwebrtc/webrtc/api/ortc/ortcfactoryinterface.h246
-rw-r--r--third_party/libwebrtc/webrtc/api/ortc/ortcrtpreceiverinterface.h84
-rw-r--r--third_party/libwebrtc/webrtc/api/ortc/ortcrtpsenderinterface.h77
-rw-r--r--third_party/libwebrtc/webrtc/api/ortc/packettransportinterface.h38
-rw-r--r--third_party/libwebrtc/webrtc/api/ortc/rtptransportcontrollerinterface.h57
-rw-r--r--third_party/libwebrtc/webrtc/api/ortc/rtptransportinterface.h123
-rw-r--r--third_party/libwebrtc/webrtc/api/ortc/sessiondescription.cc13
-rw-r--r--third_party/libwebrtc/webrtc/api/ortc/sessiondescription.h45
-rw-r--r--third_party/libwebrtc/webrtc/api/ortc/sessiondescription_unittest.cc23
-rw-r--r--third_party/libwebrtc/webrtc/api/ortc/srtptransportinterface.h48
-rw-r--r--third_party/libwebrtc/webrtc/api/ortc/udptransportinterface.h49
14 files changed, 899 insertions, 0 deletions
diff --git a/third_party/libwebrtc/webrtc/api/ortc/mediadescription.cc b/third_party/libwebrtc/webrtc/api/ortc/mediadescription.cc
new file mode 100644
index 0000000000..d5155f22fe
--- /dev/null
+++ b/third_party/libwebrtc/webrtc/api/ortc/mediadescription.cc
@@ -0,0 +1,13 @@
+/*
+ * 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.
+ */
+
+#include "api/ortc/mediadescription.h"
+
+namespace webrtc {}
diff --git a/third_party/libwebrtc/webrtc/api/ortc/mediadescription.h b/third_party/libwebrtc/webrtc/api/ortc/mediadescription.h
new file mode 100644
index 0000000000..1a6d0e9037
--- /dev/null
+++ b/third_party/libwebrtc/webrtc/api/ortc/mediadescription.h
@@ -0,0 +1,53 @@
+/*
+ * 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_ORTC_MEDIADESCRIPTION_H_
+#define API_ORTC_MEDIADESCRIPTION_H_
+
+#include <string>
+#include <utility>
+#include <vector>
+
+#include "api/cryptoparams.h"
+#include "api/optional.h"
+
+namespace webrtc {
+
+// A structured representation of a media description within an SDP session
+// description.
+class MediaDescription {
+ public:
+ explicit MediaDescription(std::string mid) : mid_(std::move(mid)) {}
+
+ ~MediaDescription() {}
+
+ // The mid(media stream identification) is used for identifying media streams
+ // within a session description.
+ // https://tools.ietf.org/html/rfc5888#section-6
+ rtc::Optional<std::string> mid() const { return mid_; }
+ void set_mid(std::string mid) { mid_.emplace(std::move(mid)); }
+
+ // Security keys and parameters for this media stream. Can be used to
+ // negotiate parameters for SRTP.
+ // https://tools.ietf.org/html/rfc4568#page-5
+ std::vector<cricket::CryptoParams>& sdes_params() { return sdes_params_; }
+ const std::vector<cricket::CryptoParams>& sdes_params() const {
+ return sdes_params_;
+ }
+
+ private:
+ rtc::Optional<std::string> mid_;
+
+ std::vector<cricket::CryptoParams> sdes_params_;
+};
+
+} // namespace webrtc
+
+#endif // API_ORTC_MEDIADESCRIPTION_H_
diff --git a/third_party/libwebrtc/webrtc/api/ortc/mediadescription_unittest.cc b/third_party/libwebrtc/webrtc/api/ortc/mediadescription_unittest.cc
new file mode 100644
index 0000000000..9ff943af6f
--- /dev/null
+++ b/third_party/libwebrtc/webrtc/api/ortc/mediadescription_unittest.cc
@@ -0,0 +1,30 @@
+/*
+ * 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.
+ */
+
+#include "api/ortc/mediadescription.h"
+#include "test/gtest.h"
+
+namespace webrtc {
+
+class MediaDescriptionTest : public testing::Test {};
+
+TEST_F(MediaDescriptionTest, CreateMediaDescription) {
+ MediaDescription m("a");
+ EXPECT_EQ("a", m.mid());
+}
+
+TEST_F(MediaDescriptionTest, AddSdesParam) {
+ MediaDescription m("a");
+ m.sdes_params().push_back(cricket::CryptoParams());
+ const std::vector<cricket::CryptoParams>& params = m.sdes_params();
+ EXPECT_EQ(1u, params.size());
+}
+
+} // namespace webrtc
diff --git a/third_party/libwebrtc/webrtc/api/ortc/ortcfactoryinterface.h b/third_party/libwebrtc/webrtc/api/ortc/ortcfactoryinterface.h
new file mode 100644
index 0000000000..d99fcd4465
--- /dev/null
+++ b/third_party/libwebrtc/webrtc/api/ortc/ortcfactoryinterface.h
@@ -0,0 +1,246 @@
+/*
+ * 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_ORTC_ORTCFACTORYINTERFACE_H_
+#define API_ORTC_ORTCFACTORYINTERFACE_H_
+
+#include <memory>
+#include <string>
+#include <utility> // For std::move.
+
+#include "api/mediaconstraintsinterface.h"
+#include "api/mediastreaminterface.h"
+#include "api/mediatypes.h"
+#include "api/ortc/ortcrtpreceiverinterface.h"
+#include "api/ortc/ortcrtpsenderinterface.h"
+#include "api/ortc/packettransportinterface.h"
+#include "api/ortc/rtptransportcontrollerinterface.h"
+#include "api/ortc/rtptransportinterface.h"
+#include "api/ortc/srtptransportinterface.h"
+#include "api/ortc/udptransportinterface.h"
+#include "api/rtcerror.h"
+#include "api/rtpparameters.h"
+#include "rtc_base/network.h"
+#include "rtc_base/scoped_ref_ptr.h"
+#include "rtc_base/thread.h"
+
+namespace webrtc {
+
+// TODO(deadbeef): This should be part of /api/, but currently it's not and
+// including its header violates checkdeps rules.
+class AudioDeviceModule;
+
+// WARNING: This is experimental/under development, so use at your own risk; no
+// guarantee about API stability is guaranteed here yet.
+//
+// This class is the ORTC analog of PeerConnectionFactory. It acts as a factory
+// for ORTC objects that can be connected to each other.
+//
+// Some of these objects may not be represented by the ORTC specification, but
+// follow the same general principles.
+//
+// If one of the factory methods takes another object as an argument, it MUST
+// have been created by the same OrtcFactory.
+//
+// On object lifetimes: objects should be destroyed in this order:
+// 1. Objects created by the factory.
+// 2. The factory itself.
+// 3. Objects passed into OrtcFactoryInterface::Create.
+class OrtcFactoryInterface {
+ public:
+ // |network_thread| is the thread on which packets are sent and received.
+ // If null, a new rtc::Thread with a default socket server is created.
+ //
+ // |signaling_thread| is used for callbacks to the consumer of the API. If
+ // null, the current thread will be used, which assumes that the API consumer
+ // is running a message loop on this thread (either using an existing
+ // rtc::Thread, or by calling rtc::Thread::Current()->ProcessMessages).
+ //
+ // |network_manager| is used to determine which network interfaces are
+ // available. This is used for ICE, for example. If null, a default
+ // implementation will be used. Only accessed on |network_thread|.
+ //
+ // |socket_factory| is used (on the network thread) for creating sockets. If
+ // it's null, a default implementation will be used, which assumes
+ // |network_thread| is a normal rtc::Thread.
+ //
+ // |adm| is optional, and allows a different audio device implementation to
+ // be injected; otherwise a platform-specific module will be used that will
+ // use the default audio input.
+ //
+ // |audio_encoder_factory| and |audio_decoder_factory| are used to
+ // instantiate audio codecs; they determine what codecs are supported.
+ //
+ // Note that the OrtcFactoryInterface does not take ownership of any of the
+ // objects passed in by raw pointer, and as previously stated, these objects
+ // can't be destroyed before the factory is.
+ static RTCErrorOr<std::unique_ptr<OrtcFactoryInterface>> Create(
+ rtc::Thread* network_thread,
+ rtc::Thread* signaling_thread,
+ rtc::NetworkManager* network_manager,
+ rtc::PacketSocketFactory* socket_factory,
+ AudioDeviceModule* adm,
+ rtc::scoped_refptr<AudioEncoderFactory> audio_encoder_factory,
+ rtc::scoped_refptr<AudioDecoderFactory> audio_decoder_factory);
+
+ // Constructor for convenience which uses default implementations where
+ // possible (though does still require that the current thread runs a message
+ // loop; see above).
+ static RTCErrorOr<std::unique_ptr<OrtcFactoryInterface>> Create(
+ rtc::scoped_refptr<AudioEncoderFactory> audio_encoder_factory,
+ rtc::scoped_refptr<AudioDecoderFactory> audio_decoder_factory) {
+ return Create(nullptr, nullptr, nullptr, nullptr, nullptr,
+ audio_encoder_factory, audio_decoder_factory);
+ }
+
+ virtual ~OrtcFactoryInterface() {}
+
+ // Creates an RTP transport controller, which is used in calls to
+ // CreateRtpTransport methods. If your application has some notion of a
+ // "call", you should create one transport controller per call.
+ //
+ // However, if you only are using one RtpTransport object, this doesn't need
+ // to be called explicitly; CreateRtpTransport will create one automatically
+ // if |rtp_transport_controller| is null. See below.
+ //
+ // TODO(deadbeef): Add MediaConfig and RtcEventLog arguments?
+ virtual RTCErrorOr<std::unique_ptr<RtpTransportControllerInterface>>
+ CreateRtpTransportController() = 0;
+
+ // Creates an RTP transport using the provided packet transports and
+ // transport controller.
+ //
+ // |rtp| will be used for sending RTP packets, and |rtcp| for RTCP packets.
+ //
+ // |rtp| can't be null. |rtcp| must be non-null if and only if
+ // |rtp_parameters.rtcp.mux| is false, indicating that RTCP muxing isn't used.
+ // Note that if RTCP muxing isn't enabled initially, it can still enabled
+ // later through SetParameters.
+ //
+ // If |transport_controller| is null, one will automatically be created, and
+ // its lifetime managed by the returned RtpTransport. This should only be
+ // done if a single RtpTransport is being used to communicate with the remote
+ // endpoint.
+ virtual RTCErrorOr<std::unique_ptr<RtpTransportInterface>> CreateRtpTransport(
+ const RtpTransportParameters& rtp_parameters,
+ PacketTransportInterface* rtp,
+ PacketTransportInterface* rtcp,
+ RtpTransportControllerInterface* transport_controller) = 0;
+
+ // Creates an SrtpTransport which is an RTP transport that uses SRTP.
+ virtual RTCErrorOr<std::unique_ptr<SrtpTransportInterface>>
+ CreateSrtpTransport(
+ const RtpTransportParameters& rtp_parameters,
+ PacketTransportInterface* rtp,
+ PacketTransportInterface* rtcp,
+ RtpTransportControllerInterface* transport_controller) = 0;
+
+ // Returns the capabilities of an RTP sender of type |kind|. These
+ // capabilities can be used to determine what RtpParameters to use to create
+ // an RtpSender.
+ //
+ // If for some reason you pass in MEDIA_TYPE_DATA, returns an empty structure.
+ virtual RtpCapabilities GetRtpSenderCapabilities(
+ cricket::MediaType kind) const = 0;
+
+ // Creates an RTP sender with |track|. Will not start sending until Send is
+ // called. This is provided as a convenience; it's equivalent to calling
+ // CreateRtpSender with a kind (see below), followed by SetTrack.
+ //
+ // |track| and |transport| must not be null.
+ virtual RTCErrorOr<std::unique_ptr<OrtcRtpSenderInterface>> CreateRtpSender(
+ rtc::scoped_refptr<MediaStreamTrackInterface> track,
+ RtpTransportInterface* transport) = 0;
+
+ // Overload of CreateRtpSender allows creating the sender without a track.
+ //
+ // |kind| must be MEDIA_TYPE_AUDIO or MEDIA_TYPE_VIDEO.
+ virtual RTCErrorOr<std::unique_ptr<OrtcRtpSenderInterface>> CreateRtpSender(
+ cricket::MediaType kind,
+ RtpTransportInterface* transport) = 0;
+
+ // Returns the capabilities of an RTP receiver of type |kind|. These
+ // capabilities can be used to determine what RtpParameters to use to create
+ // an RtpReceiver.
+ //
+ // If for some reason you pass in MEDIA_TYPE_DATA, returns an empty structure.
+ virtual RtpCapabilities GetRtpReceiverCapabilities(
+ cricket::MediaType kind) const = 0;
+
+ // Creates an RTP receiver of type |kind|. Will not start receiving media
+ // until Receive is called.
+ //
+ // |kind| must be MEDIA_TYPE_AUDIO or MEDIA_TYPE_VIDEO.
+ //
+ // |transport| must not be null.
+ virtual RTCErrorOr<std::unique_ptr<OrtcRtpReceiverInterface>>
+ CreateRtpReceiver(cricket::MediaType kind,
+ RtpTransportInterface* transport) = 0;
+
+ // Create a UDP transport with IP address family |family|, using a port
+ // within the specified range.
+ //
+ // |family| must be AF_INET or AF_INET6.
+ //
+ // |min_port|/|max_port| values of 0 indicate no range restriction.
+ //
+ // Returns an error if the transport wasn't successfully created.
+ virtual RTCErrorOr<std::unique_ptr<UdpTransportInterface>>
+ CreateUdpTransport(int family, uint16_t min_port, uint16_t max_port) = 0;
+
+ // Method for convenience that has no port range restrictions.
+ RTCErrorOr<std::unique_ptr<UdpTransportInterface>> CreateUdpTransport(
+ int family) {
+ return CreateUdpTransport(family, 0, 0);
+ }
+
+ // NOTE: The methods below to create tracks/sources return scoped_refptrs
+ // rather than unique_ptrs, because these interfaces are also used with
+ // PeerConnection, where everything is ref-counted.
+
+ // Creates a audio source representing the default microphone input.
+ // |options| decides audio processing settings.
+ virtual rtc::scoped_refptr<AudioSourceInterface> CreateAudioSource(
+ const cricket::AudioOptions& options) = 0;
+
+ // Version of the above method that uses default options.
+ rtc::scoped_refptr<AudioSourceInterface> CreateAudioSource() {
+ return CreateAudioSource(cricket::AudioOptions());
+ }
+
+ // Creates a video source object wrapping and taking ownership of |capturer|.
+ //
+ // |constraints| can be used for selection of resolution and frame rate, and
+ // may be null if no constraints are desired.
+ virtual rtc::scoped_refptr<VideoTrackSourceInterface> CreateVideoSource(
+ std::unique_ptr<cricket::VideoCapturer> capturer,
+ const MediaConstraintsInterface* constraints) = 0;
+
+ // Version of the above method that omits |constraints|.
+ rtc::scoped_refptr<VideoTrackSourceInterface> CreateVideoSource(
+ std::unique_ptr<cricket::VideoCapturer> capturer) {
+ return CreateVideoSource(std::move(capturer), nullptr);
+ }
+
+ // Creates a new local video track wrapping |source|. The same |source| can
+ // be used in several tracks.
+ virtual rtc::scoped_refptr<VideoTrackInterface> CreateVideoTrack(
+ const std::string& id,
+ VideoTrackSourceInterface* source) = 0;
+
+ // Creates an new local audio track wrapping |source|.
+ virtual rtc::scoped_refptr<AudioTrackInterface> CreateAudioTrack(
+ const std::string& id,
+ AudioSourceInterface* source) = 0;
+};
+
+} // namespace webrtc
+
+#endif // API_ORTC_ORTCFACTORYINTERFACE_H_
diff --git a/third_party/libwebrtc/webrtc/api/ortc/ortcrtpreceiverinterface.h b/third_party/libwebrtc/webrtc/api/ortc/ortcrtpreceiverinterface.h
new file mode 100644
index 0000000000..59ff977621
--- /dev/null
+++ b/third_party/libwebrtc/webrtc/api/ortc/ortcrtpreceiverinterface.h
@@ -0,0 +1,84 @@
+/*
+ * 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.
+ */
+
+// This file contains interfaces for RtpReceivers:
+// http://publications.ortc.org/2016/20161202/#rtcrtpreceiver*
+//
+// However, underneath the RtpReceiver is an RtpTransport, rather than a
+// DtlsTransport. This is to allow different types of RTP transports (besides
+// DTLS-SRTP) to be used.
+
+#ifndef API_ORTC_ORTCRTPRECEIVERINTERFACE_H_
+#define API_ORTC_ORTCRTPRECEIVERINTERFACE_H_
+
+#include "api/mediastreaminterface.h"
+#include "api/mediatypes.h"
+#include "api/ortc/rtptransportinterface.h"
+#include "api/rtcerror.h"
+#include "api/rtpparameters.h"
+
+namespace webrtc {
+
+// Note: Since receiver capabilities may depend on how the OrtcFactory was
+// created, instead of a static "GetCapabilities" method on this interface,
+// there is a "GetRtpReceiverCapabilities" method on the OrtcFactory.
+class OrtcRtpReceiverInterface {
+ public:
+ virtual ~OrtcRtpReceiverInterface() {}
+
+ // Returns a track representing the media received by this receiver.
+ //
+ // Currently, this will return null until Receive has been successfully
+ // called. Also, a new track will be created every time the primary SSRC
+ // changes.
+ //
+ // If encodings are removed, GetTrack will return null. Though deactivating
+ // an encoding (setting |active| to false) will not do this.
+ //
+ // In the future, these limitations will be fixed, and GetTrack will return
+ // the same track for the lifetime of the RtpReceiver. So it's not
+ // recommended to write code that depends on this non-standard behavior.
+ virtual rtc::scoped_refptr<MediaStreamTrackInterface> GetTrack() const = 0;
+
+ // Once supported, will switch to receiving media on a new transport.
+ // However, this is not currently supported and will always return an error.
+ virtual RTCError SetTransport(RtpTransportInterface* transport) = 0;
+ // Returns previously set (or constructed-with) transport.
+ virtual RtpTransportInterface* GetTransport() const = 0;
+
+ // Start receiving media with |parameters| (if |parameters| contains an
+ // active encoding).
+ //
+ // There are no limitations to how the parameters can be changed after the
+ // initial call to Receive, as long as they're valid (for example, they can't
+ // use the same payload type for two codecs).
+ virtual RTCError Receive(const RtpParameters& parameters) = 0;
+ // Returns parameters that were last successfully passed into Receive, or
+ // empty parameters if that hasn't yet occurred.
+ //
+ // Note that for parameters that are described as having an "implementation
+ // default" value chosen, GetParameters() will return those chosen defaults,
+ // with the exception of SSRCs which have special behavior. See
+ // rtpparameters.h for more details.
+ virtual RtpParameters GetParameters() const = 0;
+
+ // Audio or video receiver?
+ //
+ // Once GetTrack() starts always returning a track, this method will be
+ // redundant, as one can call "GetTrack()->kind()". However, it's still a
+ // nice convenience, and is symmetric with OrtcRtpSenderInterface::GetKind.
+ virtual cricket::MediaType GetKind() const = 0;
+
+ // TODO(deadbeef): GetContributingSources
+};
+
+} // namespace webrtc
+
+#endif // API_ORTC_ORTCRTPRECEIVERINTERFACE_H_
diff --git a/third_party/libwebrtc/webrtc/api/ortc/ortcrtpsenderinterface.h b/third_party/libwebrtc/webrtc/api/ortc/ortcrtpsenderinterface.h
new file mode 100644
index 0000000000..fd4dfaa790
--- /dev/null
+++ b/third_party/libwebrtc/webrtc/api/ortc/ortcrtpsenderinterface.h
@@ -0,0 +1,77 @@
+/*
+ * 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.
+ */
+
+// This file contains interfaces for RtpSenders:
+// http://publications.ortc.org/2016/20161202/#rtcrtpsender*
+//
+// However, underneath the RtpSender is an RtpTransport, rather than a
+// DtlsTransport. This is to allow different types of RTP transports (besides
+// DTLS-SRTP) to be used.
+
+#ifndef API_ORTC_ORTCRTPSENDERINTERFACE_H_
+#define API_ORTC_ORTCRTPSENDERINTERFACE_H_
+
+#include "api/mediastreaminterface.h"
+#include "api/mediatypes.h"
+#include "api/ortc/rtptransportinterface.h"
+#include "api/rtcerror.h"
+#include "api/rtpparameters.h"
+
+namespace webrtc {
+
+// Note: Since sender capabilities may depend on how the OrtcFactory was
+// created, instead of a static "GetCapabilities" method on this interface,
+// there is a "GetRtpSenderCapabilities" method on the OrtcFactory.
+class OrtcRtpSenderInterface {
+ public:
+ virtual ~OrtcRtpSenderInterface() {}
+
+ // Sets the source of media that will be sent by this sender.
+ //
+ // If Send has already been called, will immediately switch to sending this
+ // track. If |track| is null, will stop sending media.
+ //
+ // Returns INVALID_PARAMETER error if an audio track is set on a video
+ // RtpSender, or vice-versa.
+ virtual RTCError SetTrack(MediaStreamTrackInterface* track) = 0;
+ // Returns previously set (or constructed-with) track.
+ virtual rtc::scoped_refptr<MediaStreamTrackInterface> GetTrack() const = 0;
+
+ // Once supported, will switch to sending media on a new transport. However,
+ // this is not currently supported and will always return an error.
+ virtual RTCError SetTransport(RtpTransportInterface* transport) = 0;
+ // Returns previously set (or constructed-with) transport.
+ virtual RtpTransportInterface* GetTransport() const = 0;
+
+ // Start sending media with |parameters| (if |parameters| contains an active
+ // encoding).
+ //
+ // There are no limitations to how the parameters can be changed after the
+ // initial call to Send, as long as they're valid (for example, they can't
+ // use the same payload type for two codecs).
+ virtual RTCError Send(const RtpParameters& parameters) = 0;
+ // Returns parameters that were last successfully passed into Send, or empty
+ // parameters if that hasn't yet occurred.
+ //
+ // Note that for parameters that are described as having an "implementation
+ // default" value chosen, GetParameters() will return those chosen defaults,
+ // with the exception of SSRCs which have special behavior. See
+ // rtpparameters.h for more details.
+ virtual RtpParameters GetParameters() const = 0;
+
+ // Audio or video sender?
+ virtual cricket::MediaType GetKind() const = 0;
+
+ // TODO(deadbeef): SSRC conflict signal.
+};
+
+} // namespace webrtc
+
+#endif // API_ORTC_ORTCRTPSENDERINTERFACE_H_
diff --git a/third_party/libwebrtc/webrtc/api/ortc/packettransportinterface.h b/third_party/libwebrtc/webrtc/api/ortc/packettransportinterface.h
new file mode 100644
index 0000000000..9d53ad311b
--- /dev/null
+++ b/third_party/libwebrtc/webrtc/api/ortc/packettransportinterface.h
@@ -0,0 +1,38 @@
+/*
+ * 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_ORTC_PACKETTRANSPORTINTERFACE_H_
+#define API_ORTC_PACKETTRANSPORTINTERFACE_H_
+
+namespace rtc {
+
+class PacketTransportInternal;
+
+} // namespace rtc
+
+namespace webrtc {
+
+// Base class for different packet-based transports.
+class PacketTransportInterface {
+ public:
+ virtual ~PacketTransportInterface() {}
+
+ protected:
+ // Only for internal use. Returns a pointer to an internal interface, for use
+ // by the implementation.
+ virtual rtc::PacketTransportInternal* GetInternal() = 0;
+
+ // Classes that can use this internal interface.
+ friend class RtpTransportControllerAdapter;
+};
+
+} // namespace webrtc
+
+#endif // API_ORTC_PACKETTRANSPORTINTERFACE_H_
diff --git a/third_party/libwebrtc/webrtc/api/ortc/rtptransportcontrollerinterface.h b/third_party/libwebrtc/webrtc/api/ortc/rtptransportcontrollerinterface.h
new file mode 100644
index 0000000000..85f37fa7a0
--- /dev/null
+++ b/third_party/libwebrtc/webrtc/api/ortc/rtptransportcontrollerinterface.h
@@ -0,0 +1,57 @@
+/*
+ * 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_ORTC_RTPTRANSPORTCONTROLLERINTERFACE_H_
+#define API_ORTC_RTPTRANSPORTCONTROLLERINTERFACE_H_
+
+#include <vector>
+
+#include "api/ortc/rtptransportinterface.h"
+
+namespace webrtc {
+
+class RtpTransportControllerAdapter;
+
+// Used to group RTP transports between a local endpoint and the same remote
+// endpoint, for the purpose of sharing bandwidth estimation and other things.
+//
+// Comparing this to the PeerConnection model, non-budled audio/video would use
+// two RtpTransports with a single RtpTransportController, whereas bundled
+// media would use a single RtpTransport, and two PeerConnections would use
+// independent RtpTransportControllers.
+//
+// RtpTransports are associated with this controller when they're created, by
+// passing the controller into OrtcFactory's relevant "CreateRtpTransport"
+// method. When a transport is destroyed, it's automatically disassociated.
+// GetTransports returns all currently associated transports.
+//
+// This is the RTP equivalent of "IceTransportController" in ORTC; RtpTransport
+// is to RtpTransportController as IceTransport is to IceTransportController.
+class RtpTransportControllerInterface {
+ public:
+ virtual ~RtpTransportControllerInterface() {}
+
+ // Returns all transports associated with this controller (see explanation
+ // above). No ordering is guaranteed.
+ virtual std::vector<RtpTransportInterface*> GetTransports() const = 0;
+
+ protected:
+ // Only for internal use. Returns a pointer to an internal interface, for use
+ // by the implementation.
+ virtual RtpTransportControllerAdapter* GetInternal() = 0;
+
+ // Classes that can use this internal interface.
+ friend class OrtcFactory;
+ friend class RtpTransportAdapter;
+};
+
+} // namespace webrtc
+
+#endif // API_ORTC_RTPTRANSPORTCONTROLLERINTERFACE_H_
diff --git a/third_party/libwebrtc/webrtc/api/ortc/rtptransportinterface.h b/third_party/libwebrtc/webrtc/api/ortc/rtptransportinterface.h
new file mode 100644
index 0000000000..3c58fad9fd
--- /dev/null
+++ b/third_party/libwebrtc/webrtc/api/ortc/rtptransportinterface.h
@@ -0,0 +1,123 @@
+/*
+ * 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_ORTC_RTPTRANSPORTINTERFACE_H_
+#define API_ORTC_RTPTRANSPORTINTERFACE_H_
+
+#include <string>
+
+#include "api/optional.h"
+#include "api/ortc/packettransportinterface.h"
+#include "api/rtcerror.h"
+#include "common_types.h" // NOLINT(build/include)
+
+namespace webrtc {
+
+class RtpTransportAdapter;
+
+struct RtcpParameters final {
+ // The SSRC to be used in the "SSRC of packet sender" field. If not set, one
+ // will be chosen by the implementation.
+ // TODO(deadbeef): Not implemented.
+ rtc::Optional<uint32_t> ssrc;
+
+ // The Canonical Name (CNAME) used by RTCP (e.g. in SDES messages).
+ //
+ // If empty in the construction of the RtpTransport, one will be generated by
+ // the implementation, and returned in GetRtcpParameters. Multiple
+ // RtpTransports created by the same OrtcFactory will use the same generated
+ // CNAME.
+ //
+ // If empty when passed into SetParameters, the CNAME simply won't be
+ // modified.
+ std::string cname;
+
+ // Send reduced-size RTCP?
+ bool reduced_size = false;
+
+ // Send RTCP multiplexed on the RTP transport?
+ bool mux = true;
+
+ bool operator==(const RtcpParameters& o) const {
+ return ssrc == o.ssrc && cname == o.cname &&
+ reduced_size == o.reduced_size && mux == o.mux;
+ }
+ bool operator!=(const RtcpParameters& o) const { return !(*this == o); }
+};
+
+struct RtpTransportParameters final {
+ RtcpParameters rtcp;
+
+ // Enabled periodic sending of keep-alive packets, that help prevent timeouts
+ // on the network level, such as NAT bindings. See RFC6263 section 4.6.
+ RtpKeepAliveConfig keepalive;
+
+ bool operator==(const RtpTransportParameters& o) const {
+ return rtcp == o.rtcp && keepalive == o.keepalive;
+ }
+ bool operator!=(const RtpTransportParameters& o) const {
+ return !(*this == o);
+ }
+};
+
+// Base class for different types of RTP transports that can be created by an
+// OrtcFactory. Used by RtpSenders/RtpReceivers.
+//
+// This is not present in the standard ORTC API, but exists here for a few
+// reasons. Firstly, it allows different types of RTP transports to be used:
+// DTLS-SRTP (which is required for the web), but also SDES-SRTP and
+// unencrypted RTP. It also simplifies the handling of RTCP muxing, and
+// provides a better API point for it.
+//
+// Note that Edge's implementation of ORTC provides a similar API point, called
+// RTCSrtpSdesTransport:
+// https://msdn.microsoft.com/en-us/library/mt502527(v=vs.85).aspx
+class RtpTransportInterface {
+ public:
+ virtual ~RtpTransportInterface() {}
+
+ // Returns packet transport that's used to send RTP packets.
+ virtual PacketTransportInterface* GetRtpPacketTransport() const = 0;
+
+ // Returns separate packet transport that's used to send RTCP packets. If
+ // RTCP multiplexing is being used, returns null.
+ virtual PacketTransportInterface* GetRtcpPacketTransport() const = 0;
+
+ // Set/get RTP/RTCP transport params. Can be used to enable RTCP muxing or
+ // reduced-size RTCP if initially not enabled.
+ //
+ // Changing |mux| from "true" to "false" is not allowed, and changing the
+ // CNAME is currently unsupported.
+ // RTP keep-alive settings need to be set before before an RtpSender has
+ // started sending, altering the payload type or timeout interval after this
+ // point is not supported. The parameters must also match across all RTP
+ // transports for a given RTP transport controller.
+ virtual RTCError SetParameters(const RtpTransportParameters& parameters) = 0;
+ // Returns last set or constructed-with parameters. If |cname| was empty in
+ // construction, the generated CNAME will be present in the returned
+ // parameters (see above).
+ virtual RtpTransportParameters GetParameters() const = 0;
+
+ protected:
+ // Only for internal use. Returns a pointer to an internal interface, for use
+ // by the implementation.
+ virtual RtpTransportAdapter* GetInternal() = 0;
+
+ // Classes that can use this internal interface.
+ friend class OrtcFactory;
+ friend class OrtcRtpSenderAdapter;
+ friend class OrtcRtpReceiverAdapter;
+ friend class RtpTransportControllerAdapter;
+ friend class RtpTransportAdapter;
+};
+
+} // namespace webrtc
+
+#endif // API_ORTC_RTPTRANSPORTINTERFACE_H_
diff --git a/third_party/libwebrtc/webrtc/api/ortc/sessiondescription.cc b/third_party/libwebrtc/webrtc/api/ortc/sessiondescription.cc
new file mode 100644
index 0000000000..1078884ecb
--- /dev/null
+++ b/third_party/libwebrtc/webrtc/api/ortc/sessiondescription.cc
@@ -0,0 +1,13 @@
+/*
+ * 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.
+ */
+
+#include "api/ortc/sessiondescription.h"
+
+namespace webrtc {}
diff --git a/third_party/libwebrtc/webrtc/api/ortc/sessiondescription.h b/third_party/libwebrtc/webrtc/api/ortc/sessiondescription.h
new file mode 100644
index 0000000000..ebbaa27d6f
--- /dev/null
+++ b/third_party/libwebrtc/webrtc/api/ortc/sessiondescription.h
@@ -0,0 +1,45 @@
+/*
+ * 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_ORTC_SESSIONDESCRIPTION_H_
+#define API_ORTC_SESSIONDESCRIPTION_H_
+
+#include <string>
+#include <utility>
+
+namespace webrtc {
+
+// A structured representation of an SDP session description.
+class SessionDescription {
+ public:
+ SessionDescription(int64_t session_id, std::string session_version)
+ : session_id_(session_id), session_version_(std::move(session_version)) {}
+
+ // https://tools.ietf.org/html/rfc4566#section-5.2
+ // o=<username> <sess-id> <sess-version> <nettype> <addrtype>
+ // <unicast-address>
+ // session_id_ is the "sess-id" field.
+ // session_version_ is the "sess-version" field.
+ int64_t session_id() { return session_id_; }
+ void set_session_id(int64_t session_id) { session_id_ = session_id; }
+
+ const std::string& session_version() const { return session_version_; }
+ void set_session_version(std::string session_version) {
+ session_version_ = std::move(session_version);
+ }
+
+ private:
+ int64_t session_id_;
+ std::string session_version_;
+};
+
+} // namespace webrtc
+
+#endif // API_ORTC_SESSIONDESCRIPTION_H_
diff --git a/third_party/libwebrtc/webrtc/api/ortc/sessiondescription_unittest.cc b/third_party/libwebrtc/webrtc/api/ortc/sessiondescription_unittest.cc
new file mode 100644
index 0000000000..fd6f43de43
--- /dev/null
+++ b/third_party/libwebrtc/webrtc/api/ortc/sessiondescription_unittest.cc
@@ -0,0 +1,23 @@
+/*
+ * 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.
+ */
+
+#include "api/ortc/sessiondescription.h"
+#include "test/gtest.h"
+
+namespace webrtc {
+
+class SessionDescriptionTest : public testing::Test {};
+
+TEST_F(SessionDescriptionTest, CreateSessionDescription) {
+ SessionDescription s(-1, "0");
+ EXPECT_EQ(-1, s.session_id());
+ EXPECT_EQ("0", s.session_version());
+}
+}
diff --git a/third_party/libwebrtc/webrtc/api/ortc/srtptransportinterface.h b/third_party/libwebrtc/webrtc/api/ortc/srtptransportinterface.h
new file mode 100644
index 0000000000..41c8ccc9c1
--- /dev/null
+++ b/third_party/libwebrtc/webrtc/api/ortc/srtptransportinterface.h
@@ -0,0 +1,48 @@
+/*
+ * 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_ORTC_SRTPTRANSPORTINTERFACE_H_
+#define API_ORTC_SRTPTRANSPORTINTERFACE_H_
+
+#include "api/ortc/rtptransportinterface.h"
+#include "api/rtcerror.h"
+#include "api/cryptoparams.h"
+
+namespace webrtc {
+
+// The subclass of the RtpTransport which uses SRTP. The keying information
+// is explicitly passed in from the application.
+//
+// If using SDP and SDES (RFC4568) for signaling, then after applying the
+// answer, the negotiated keying information from the offer and answer would be
+// set and the SRTP would be active.
+//
+// Note that Edge's implementation of ORTC provides a similar API point, called
+// RTCSrtpSdesTransport:
+// https://msdn.microsoft.com/en-us/library/mt502527(v=vs.85).aspx
+class SrtpTransportInterface : public RtpTransportInterface {
+ public:
+ virtual ~SrtpTransportInterface() {}
+
+ // There are some limitations of the current implementation:
+ // 1. Send and receive keys must use the same crypto suite.
+ // 2. The keys can't be changed after initially set.
+ // 3. The keys must be set before creating a sender/receiver using the SRTP
+ // transport.
+ // Set the SRTP keying material for sending RTP and RTCP.
+ virtual RTCError SetSrtpSendKey(const cricket::CryptoParams& params) = 0;
+
+ // Set the SRTP keying material for receiving RTP and RTCP.
+ virtual RTCError SetSrtpReceiveKey(const cricket::CryptoParams& params) = 0;
+};
+
+} // namespace webrtc
+
+#endif // API_ORTC_SRTPTRANSPORTINTERFACE_H_
diff --git a/third_party/libwebrtc/webrtc/api/ortc/udptransportinterface.h b/third_party/libwebrtc/webrtc/api/ortc/udptransportinterface.h
new file mode 100644
index 0000000000..f246a25e9d
--- /dev/null
+++ b/third_party/libwebrtc/webrtc/api/ortc/udptransportinterface.h
@@ -0,0 +1,49 @@
+/*
+ * 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_ORTC_UDPTRANSPORTINTERFACE_H_
+#define API_ORTC_UDPTRANSPORTINTERFACE_H_
+
+#include "api/ortc/packettransportinterface.h"
+#include "api/proxy.h"
+#include "rtc_base/socketaddress.h"
+
+namespace webrtc {
+
+// Interface for a raw UDP transport (not using ICE), meaning a combination of
+// a local/remote IP address/port.
+//
+// An instance can be instantiated using OrtcFactory.
+//
+// Each instance reserves a UDP port, which will be freed when the
+// UdpTransportInterface destructor is called.
+//
+// Calling SetRemoteAddress sets the destination of outgoing packets; without a
+// destination, packets can't be sent, but they can be received.
+class UdpTransportInterface : public virtual PacketTransportInterface {
+ public:
+ // Get the address of the socket allocated for this transport.
+ virtual rtc::SocketAddress GetLocalAddress() const = 0;
+
+ // Sets the address to which packets will be delivered.
+ //
+ // Calling with a "nil" (default-constructed) address is legal, and unsets
+ // any previously set destination.
+ //
+ // However, calling with an incomplete address (port or IP not set) will
+ // fail.
+ virtual bool SetRemoteAddress(const rtc::SocketAddress& dest) = 0;
+ // Simple getter. If never set, returns nil address.
+ virtual rtc::SocketAddress GetRemoteAddress() const = 0;
+};
+
+} // namespace webrtc
+
+#endif // API_ORTC_UDPTRANSPORTINTERFACE_H_