From cfe3b6afd9c2e0b4cca26f19facc0015d1ed5874 Mon Sep 17 00:00:00 2001 From: Jonas Olsson Date: Mon, 12 Nov 2018 10:12:47 +0100 Subject: [PATCH] Remove most of api/ortc/. It's not currently used or maintained, so it shouldn't be a part of out API. Bug: webrtc:9824 Change-Id: Ic44c5ea3a9eab8fb75e87a5005cbf6cdd4b1d4ad Reviewed-on: https://webrtc-review.googlesource.com/c/107645 Commit-Queue: Jonas Olsson Reviewed-by: Karl Wiberg Reviewed-by: Minyue Li Cr-Commit-Position: refs/heads/master@{#25593} --- api/BUILD.gn | 21 -- api/ortc/mediadescription.cc | 13 -- api/ortc/mediadescription.h | 53 ----- api/ortc/mediadescription_unittest.cc | 30 --- api/ortc/ortcfactoryinterface.h | 232 -------------------- api/ortc/ortcrtpreceiverinterface.h | 84 ------- api/ortc/ortcrtpsenderinterface.h | 77 ------- api/ortc/rtptransportcontrollerinterface.h | 57 ----- api/ortc/sessiondescription.cc | 13 -- api/ortc/sessiondescription.h | 45 ---- api/ortc/sessiondescription_unittest.cc | 23 -- api/ortc/udptransportinterface.h | 49 ----- p2p/BUILD.gn | 3 - rtc_tools/network_tester/BUILD.gn | 1 + rtc_tools/network_tester/test_controller.cc | 17 +- rtc_tools/network_tester/test_controller.h | 5 +- 16 files changed, 13 insertions(+), 710 deletions(-) delete mode 100644 api/ortc/mediadescription.cc delete mode 100644 api/ortc/mediadescription.h delete mode 100644 api/ortc/mediadescription_unittest.cc delete mode 100644 api/ortc/ortcfactoryinterface.h delete mode 100644 api/ortc/ortcrtpreceiverinterface.h delete mode 100644 api/ortc/ortcrtpsenderinterface.h delete mode 100644 api/ortc/rtptransportcontrollerinterface.h delete mode 100644 api/ortc/sessiondescription.cc delete mode 100644 api/ortc/sessiondescription.h delete mode 100644 api/ortc/sessiondescription_unittest.cc delete mode 100644 api/ortc/udptransportinterface.h diff --git a/api/BUILD.gn b/api/BUILD.gn index 0d16698a11..9bee2cd82c 100644 --- a/api/BUILD.gn +++ b/api/BUILD.gn @@ -209,34 +209,16 @@ rtc_source_set("libjingle_logging_api") { rtc_source_set("ortc_api") { visibility = [ "*" ] sources = [ - "ortc/mediadescription.cc", - "ortc/mediadescription.h", - "ortc/ortcfactoryinterface.h", - "ortc/ortcrtpreceiverinterface.h", - "ortc/ortcrtpsenderinterface.h", "ortc/packettransportinterface.h", - "ortc/rtptransportcontrollerinterface.h", "ortc/rtptransportinterface.h", - "ortc/sessiondescription.cc", - "ortc/sessiondescription.h", "ortc/srtptransportinterface.h", - "ortc/udptransportinterface.h", ] - # For mediastreaminterface.h, etc. - # TODO(deadbeef): Create a separate target for the common things ORTC and - # PeerConnection code shares, so that ortc_api can depend on that instead of - # libjingle_peerconnection_api. deps = [ ":libjingle_peerconnection_api", "..:webrtc_common", - "../rtc_base:rtc_base", "//third_party/abseil-cpp/absl/types:optional", ] - if (!build_with_chromium && is_clang) { - # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163). - suppressed_configs += [ "//build/config/clang:find_bad_constructs" ] - } } rtc_source_set("rtc_stats_api") { @@ -633,8 +615,6 @@ if (rtc_include_tests) { sources = [ "array_view_unittest.cc", - "ortc/mediadescription_unittest.cc", - "ortc/sessiondescription_unittest.cc", "rtcerror_unittest.cc", "rtpparameters_unittest.cc", "test/loopback_media_transport_unittest.cc", @@ -649,7 +629,6 @@ if (rtc_include_tests) { ":array_view", ":libjingle_peerconnection_api", ":loopback_media_transport", - ":ortc_api", "../rtc_base:checks", "../rtc_base:rtc_base_approved", "../rtc_base:rtc_base_tests_utils", diff --git a/api/ortc/mediadescription.cc b/api/ortc/mediadescription.cc deleted file mode 100644 index d5155f22fe..0000000000 --- a/api/ortc/mediadescription.cc +++ /dev/null @@ -1,13 +0,0 @@ -/* - * 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/api/ortc/mediadescription.h b/api/ortc/mediadescription.h deleted file mode 100644 index 5cf1d1a67b..0000000000 --- a/api/ortc/mediadescription.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * 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 -#include -#include - -#include "absl/types/optional.h" -#include "api/cryptoparams.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 - absl::optional 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& sdes_params() { return sdes_params_; } - const std::vector& sdes_params() const { - return sdes_params_; - } - - private: - absl::optional mid_; - - std::vector sdes_params_; -}; - -} // namespace webrtc - -#endif // API_ORTC_MEDIADESCRIPTION_H_ diff --git a/api/ortc/mediadescription_unittest.cc b/api/ortc/mediadescription_unittest.cc deleted file mode 100644 index 9ff943af6f..0000000000 --- a/api/ortc/mediadescription_unittest.cc +++ /dev/null @@ -1,30 +0,0 @@ -/* - * 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& params = m.sdes_params(); - EXPECT_EQ(1u, params.size()); -} - -} // namespace webrtc diff --git a/api/ortc/ortcfactoryinterface.h b/api/ortc/ortcfactoryinterface.h deleted file mode 100644 index 9937352831..0000000000 --- a/api/ortc/ortcfactoryinterface.h +++ /dev/null @@ -1,232 +0,0 @@ -/* - * 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 -#include -#include // For std::move. - -#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/peerconnectioninterface.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> Create( - rtc::Thread* network_thread, - rtc::Thread* signaling_thread, - rtc::NetworkManager* network_manager, - rtc::PacketSocketFactory* socket_factory, - AudioDeviceModule* adm, - rtc::scoped_refptr audio_encoder_factory, - rtc::scoped_refptr 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> Create( - rtc::scoped_refptr audio_encoder_factory, - rtc::scoped_refptr 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> - 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> 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> - 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> CreateRtpSender( - rtc::scoped_refptr 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> 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> - 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> - CreateUdpTransport(int family, uint16_t min_port, uint16_t max_port) = 0; - - // Method for convenience that has no port range restrictions. - RTCErrorOr> 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 CreateAudioSource( - const cricket::AudioOptions& options) = 0; - - // Version of the above method that uses default options. - rtc::scoped_refptr CreateAudioSource() { - return CreateAudioSource(cricket::AudioOptions()); - } - - // Creates a new local video track wrapping |source|. The same |source| can - // be used in several tracks. - virtual rtc::scoped_refptr CreateVideoTrack( - const std::string& id, - VideoTrackSourceInterface* source) = 0; - - // Creates an new local audio track wrapping |source|. - virtual rtc::scoped_refptr CreateAudioTrack( - const std::string& id, - AudioSourceInterface* source) = 0; -}; - -} // namespace webrtc - -#endif // API_ORTC_ORTCFACTORYINTERFACE_H_ diff --git a/api/ortc/ortcrtpreceiverinterface.h b/api/ortc/ortcrtpreceiverinterface.h deleted file mode 100644 index 59ff977621..0000000000 --- a/api/ortc/ortcrtpreceiverinterface.h +++ /dev/null @@ -1,84 +0,0 @@ -/* - * 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 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/api/ortc/ortcrtpsenderinterface.h b/api/ortc/ortcrtpsenderinterface.h deleted file mode 100644 index fd4dfaa790..0000000000 --- a/api/ortc/ortcrtpsenderinterface.h +++ /dev/null @@ -1,77 +0,0 @@ -/* - * 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 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/api/ortc/rtptransportcontrollerinterface.h b/api/ortc/rtptransportcontrollerinterface.h deleted file mode 100644 index 85f37fa7a0..0000000000 --- a/api/ortc/rtptransportcontrollerinterface.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * 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 - -#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 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/api/ortc/sessiondescription.cc b/api/ortc/sessiondescription.cc deleted file mode 100644 index 1078884ecb..0000000000 --- a/api/ortc/sessiondescription.cc +++ /dev/null @@ -1,13 +0,0 @@ -/* - * 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/api/ortc/sessiondescription.h b/api/ortc/sessiondescription.h deleted file mode 100644 index ebbaa27d6f..0000000000 --- a/api/ortc/sessiondescription.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * 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 -#include - -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= - // - // 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/api/ortc/sessiondescription_unittest.cc b/api/ortc/sessiondescription_unittest.cc deleted file mode 100644 index e4611c6c6b..0000000000 --- a/api/ortc/sessiondescription_unittest.cc +++ /dev/null @@ -1,23 +0,0 @@ -/* - * 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()); -} -} // namespace webrtc diff --git a/api/ortc/udptransportinterface.h b/api/ortc/udptransportinterface.h deleted file mode 100644 index f246a25e9d..0000000000 --- a/api/ortc/udptransportinterface.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * 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_ diff --git a/p2p/BUILD.gn b/p2p/BUILD.gn index 252d182400..f0033f19d3 100644 --- a/p2p/BUILD.gn +++ b/p2p/BUILD.gn @@ -76,8 +76,6 @@ rtc_static_library("rtc_p2p") { "base/turnport.cc", "base/turnport.h", "base/udpport.h", - "base/udptransport.cc", - "base/udptransport.h", "client/basicportallocator.cc", "client/basicportallocator.h", "client/relayportfactoryinterface.h", @@ -176,7 +174,6 @@ if (rtc_include_tests) { "base/transportdescriptionfactory_unittest.cc", "base/turnport_unittest.cc", "base/turnserver_unittest.cc", - "base/udptransport_unittest.cc", "client/basicportallocator_unittest.cc", ] deps = [ diff --git a/rtc_tools/network_tester/BUILD.gn b/rtc_tools/network_tester/BUILD.gn index a5036dcea9..af84903b7f 100644 --- a/rtc_tools/network_tester/BUILD.gn +++ b/rtc_tools/network_tester/BUILD.gn @@ -44,6 +44,7 @@ if (rtc_enable_protobuf) { "../../p2p", "../../rtc_base:checks", "../../rtc_base:protobuf_utils", + "../../rtc_base:rtc_base", "../../rtc_base:rtc_base_approved", "../../rtc_base:rtc_task_queue", "../../rtc_base:sequenced_task_checker", diff --git a/rtc_tools/network_tester/test_controller.cc b/rtc_tools/network_tester/test_controller.cc index 9d8161bc05..9bfdfa7732 100644 --- a/rtc_tools/network_tester/test_controller.cc +++ b/rtc_tools/network_tester/test_controller.cc @@ -10,6 +10,9 @@ #include "rtc_tools/network_tester/test_controller.h" +#include "absl/types/optional.h" +#include "rtc_base/thread.h" + namespace webrtc { TestController::TestController(int min_port, @@ -24,17 +27,15 @@ TestController::TestController(int min_port, RTC_DCHECK_RUN_ON(&test_controller_thread_checker_); packet_sender_checker_.Detach(); send_data_.fill(42); - auto socket = + udp_socket_ = std::unique_ptr(socket_factory_.CreateUdpSocket( rtc::SocketAddress(rtc::GetAnyIP(AF_INET), 0), min_port, max_port)); - socket->SignalReadPacket.connect(this, &TestController::OnReadPacket); - udp_transport_.reset( - new cricket::UdpTransport("network tester transport", std::move(socket))); + udp_socket_->SignalReadPacket.connect(this, &TestController::OnReadPacket); } void TestController::SendConnectTo(const std::string& hostname, int port) { RTC_DCHECK_RUN_ON(&test_controller_thread_checker_); - udp_transport_->SetRemoteAddress(rtc::SocketAddress(hostname, port)); + remote_address_ = rtc::SocketAddress(hostname, port); NetworkTesterPacket packet; packet.set_type(NetworkTesterPacket::HAND_SHAKING); SendData(packet, absl::nullopt); @@ -57,8 +58,8 @@ void TestController::SendData(const NetworkTesterPacket& packet, packet.SerializeToArray(&send_data_[1], std::numeric_limits::max()); if (data_size && *data_size > packet_size) packet_size = *data_size; - udp_transport_->SendPacket(send_data_.data(), packet_size, - rtc::PacketOptions(), 0); + udp_socket_->SendTo((const void*)send_data_.data(), packet_size, + remote_address_, rtc::PacketOptions()); } void TestController::OnTestDone() { @@ -91,7 +92,7 @@ void TestController::OnReadPacket(rtc::AsyncPacketSocket* socket, case NetworkTesterPacket::HAND_SHAKING: { NetworkTesterPacket packet; packet.set_type(NetworkTesterPacket::TEST_START); - udp_transport_->SetRemoteAddress(remote_addr); + remote_address_ = remote_addr; SendData(packet, absl::nullopt); packet_sender_.reset(new PacketSender(this, config_file_path_)); packet_sender_->StartSending(); diff --git a/rtc_tools/network_tester/test_controller.h b/rtc_tools/network_tester/test_controller.h index 06a83e90d9..a65272a09d 100644 --- a/rtc_tools/network_tester/test_controller.h +++ b/rtc_tools/network_tester/test_controller.h @@ -18,7 +18,7 @@ #include #include "p2p/base/basicpacketsocketfactory.h" -#include "p2p/base/udptransport.h" +#include "rtc_base/asyncpacketsocket.h" #include "rtc_base/constructormagic.h" #include "rtc_base/ignore_wundef.h" #include "rtc_tools/network_tester/packet_logger.h" @@ -70,7 +70,8 @@ class TestController : public sigslot::has_slots<> { bool local_test_done_ RTC_GUARDED_BY(local_test_done_lock_); bool remote_test_done_; std::array send_data_; - std::unique_ptr udp_transport_; + std::unique_ptr udp_socket_; + rtc::SocketAddress remote_address_; std::unique_ptr packet_sender_; RTC_DISALLOW_COPY_AND_ASSIGN(TestController);