diff --git a/api/BUILD.gn b/api/BUILD.gn index dc83db9cce..375cf9d257 100644 --- a/api/BUILD.gn +++ b/api/BUILD.gn @@ -368,21 +368,6 @@ rtc_source_set("rtc_event_log_output_file") { ] } -rtc_source_set("ortc_api") { - visibility = [ "*" ] - sources = [ - "ortc/packet_transport_interface.h", - "ortc/rtp_transport_interface.h", - "ortc/srtp_transport_interface.h", - ] - - deps = [ - ":libjingle_peerconnection_api", - ":rtp_headers", - "//third_party/abseil-cpp/absl/types:optional", - ] -} - rtc_source_set("rtc_stats_api") { visibility = [ "*" ] cflags = [] diff --git a/api/ortc/packet_transport_interface.h b/api/ortc/packet_transport_interface.h deleted file mode 100644 index 78e280a8ab..0000000000 --- a/api/ortc/packet_transport_interface.h +++ /dev/null @@ -1,38 +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_PACKET_TRANSPORT_INTERFACE_H_ -#define API_ORTC_PACKET_TRANSPORT_INTERFACE_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_PACKET_TRANSPORT_INTERFACE_H_ diff --git a/api/ortc/rtp_transport_interface.h b/api/ortc/rtp_transport_interface.h deleted file mode 100644 index 2e168858dc..0000000000 --- a/api/ortc/rtp_transport_interface.h +++ /dev/null @@ -1,83 +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_RTP_TRANSPORT_INTERFACE_H_ -#define API_ORTC_RTP_TRANSPORT_INTERFACE_H_ - -#include - -#include "absl/types/optional.h" -#include "api/ortc/packet_transport_interface.h" -#include "api/rtc_error.h" -#include "api/rtp_headers.h" -#include "api/rtp_parameters.h" - -namespace webrtc { - -struct RtpTransportParameters final { - RtcpParameters rtcp; - - bool operator==(const RtpTransportParameters& o) const { - return rtcp == o.rtcp; - } - 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: - // Classes that can use this internal interface. - friend class OrtcFactory; - friend class OrtcRtpSenderAdapter; - friend class OrtcRtpReceiverAdapter; - friend class RtpTransportControllerAdapter; -}; - -} // namespace webrtc - -#endif // API_ORTC_RTP_TRANSPORT_INTERFACE_H_ diff --git a/api/ortc/srtp_transport_interface.h b/api/ortc/srtp_transport_interface.h deleted file mode 100644 index 65ef1eff18..0000000000 --- a/api/ortc/srtp_transport_interface.h +++ /dev/null @@ -1,48 +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_SRTP_TRANSPORT_INTERFACE_H_ -#define API_ORTC_SRTP_TRANSPORT_INTERFACE_H_ - -#include "api/crypto_params.h" -#include "api/ortc/rtp_transport_interface.h" -#include "api/rtc_error.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_SRTP_TRANSPORT_INTERFACE_H_ diff --git a/p2p/BUILD.gn b/p2p/BUILD.gn index e404896e5d..c389e81052 100644 --- a/p2p/BUILD.gn +++ b/p2p/BUILD.gn @@ -87,7 +87,6 @@ rtc_static_library("rtc_p2p") { deps = [ "../api:libjingle_peerconnection_api", - "../api:ortc_api", "../api:scoped_refptr", "../api/transport:enums", "../logging:ice_log", @@ -159,7 +158,6 @@ if (rtc_include_tests) { ":p2p_server_utils", ":rtc_p2p", "../api:libjingle_peerconnection_api", - "../api:ortc_api", "../rtc_base", "../rtc_base:gunit_helpers", "../rtc_base:rtc_base_approved", @@ -205,7 +203,6 @@ if (rtc_include_tests) { ":p2p_test_utils", ":rtc_p2p", "../api:libjingle_peerconnection_api", - "../api:ortc_api", "../api:scoped_refptr", "../api/units:time_delta", "../rtc_base", diff --git a/p2p/base/fake_packet_transport.h b/p2p/base/fake_packet_transport.h index 6f79aadda1..f59aa39b45 100644 --- a/p2p/base/fake_packet_transport.h +++ b/p2p/base/fake_packet_transport.h @@ -13,7 +13,6 @@ #include -#include "api/ortc/packet_transport_interface.h" #include "p2p/base/packet_transport_internal.h" #include "rtc_base/async_invoker.h" #include "rtc_base/copy_on_write_buffer.h" diff --git a/p2p/base/packet_transport_internal.cc b/p2p/base/packet_transport_internal.cc index 8fda899d64..0904cb2d3e 100644 --- a/p2p/base/packet_transport_internal.cc +++ b/p2p/base/packet_transport_internal.cc @@ -16,10 +16,6 @@ PacketTransportInternal::PacketTransportInternal() = default; PacketTransportInternal::~PacketTransportInternal() = default; -PacketTransportInternal* PacketTransportInternal::GetInternal() { - return this; -} - bool PacketTransportInternal::GetOption(rtc::Socket::Option opt, int* value) { return false; } diff --git a/p2p/base/packet_transport_internal.h b/p2p/base/packet_transport_internal.h index 24723e9fce..a5321835a9 100644 --- a/p2p/base/packet_transport_internal.h +++ b/p2p/base/packet_transport_internal.h @@ -15,8 +15,6 @@ #include #include "absl/types/optional.h" -// This is included for PacketOptions. -#include "api/ortc/packet_transport_interface.h" #include "p2p/base/port.h" #include "rtc_base/async_packet_socket.h" #include "rtc_base/network_route.h" @@ -28,9 +26,7 @@ namespace rtc { struct PacketOptions; struct SentPacket; -class RTC_EXPORT PacketTransportInternal - : public virtual webrtc::PacketTransportInterface, - public sigslot::has_slots<> { +class RTC_EXPORT PacketTransportInternal : public sigslot::has_slots<> { public: virtual const std::string& transport_name() const = 0; @@ -102,8 +98,6 @@ class RTC_EXPORT PacketTransportInternal protected: PacketTransportInternal(); ~PacketTransportInternal() override; - - PacketTransportInternal* GetInternal() override; }; } // namespace rtc diff --git a/pc/BUILD.gn b/pc/BUILD.gn index 62a818609e..120d3f83a7 100644 --- a/pc/BUILD.gn +++ b/pc/BUILD.gn @@ -77,7 +77,6 @@ rtc_static_library("rtc_pc_base") { "../api:audio_options_api", "../api:call_api", "../api:libjingle_peerconnection_api", - "../api:ortc_api", "../api:rtp_headers", "../api:scoped_refptr", "../api/video:builtin_video_bitrate_allocator_factory", diff --git a/pc/rtp_transport.cc b/pc/rtp_transport.cc index e6129b5983..b7d3a9d893 100644 --- a/pc/rtp_transport.cc +++ b/pc/rtp_transport.cc @@ -164,26 +164,6 @@ bool RtpTransport::UnregisterRtpDemuxerSink(RtpPacketSinkInterface* sink) { return true; } -RTCError RtpTransport::SetParameters(const RtpTransportParameters& parameters) { - if (parameters_.rtcp.mux && !parameters.rtcp.mux) { - LOG_AND_RETURN_ERROR(RTCErrorType::INVALID_STATE, - "Disabling RTCP muxing is not allowed."); - } - - RtpTransportParameters new_parameters = parameters; - - if (new_parameters.rtcp.cname.empty()) { - new_parameters.rtcp.cname = parameters_.rtcp.cname; - } - - parameters_ = new_parameters; - return RTCError::OK(); -} - -RtpTransportParameters RtpTransport::GetParameters() const { - return parameters_; -} - void RtpTransport::DemuxPacket(rtc::CopyOnWriteBuffer packet, int64_t packet_time_us) { webrtc::RtpPacketReceived parsed_packet(&header_extension_map_); diff --git a/pc/rtp_transport.h b/pc/rtp_transport.h index 4573d3cce2..269a61a09f 100644 --- a/pc/rtp_transport.h +++ b/pc/rtp_transport.h @@ -49,17 +49,6 @@ class RtpTransport : public RtpTransportInternal { } void SetRtcpPacketTransport(rtc::PacketTransportInternal* rtcp) override; - PacketTransportInterface* GetRtpPacketTransport() const override { - return rtp_packet_transport_; - } - PacketTransportInterface* GetRtcpPacketTransport() const override { - return rtcp_packet_transport_; - } - - // TODO(zstein): Use these RtcpParameters for configuration elsewhere. - RTCError SetParameters(const RtpTransportParameters& parameters) override; - RtpTransportParameters GetParameters() const override; - bool IsReadyToSend() const override { return ready_to_send_; } bool IsWritable(bool rtcp) const override; @@ -119,18 +108,6 @@ class RtpTransport : public RtpTransportInternal { bool IsTransportWritable(); - // SRTP specific methods. - // TODO(zhihuang): Improve the inheritance model so that the RtpTransport - // doesn't need to implement SRTP specfic methods. - RTCError SetSrtpSendKey(const cricket::CryptoParams& params) override { - RTC_NOTREACHED(); - return RTCError::OK(); - } - RTCError SetSrtpReceiveKey(const cricket::CryptoParams& params) override { - RTC_NOTREACHED(); - return RTCError::OK(); - } - bool rtcp_mux_enabled_; rtc::PacketTransportInternal* rtp_packet_transport_ = nullptr; @@ -140,7 +117,6 @@ class RtpTransport : public RtpTransportInternal { bool rtp_ready_to_send_ = false; bool rtcp_ready_to_send_ = false; - RtpTransportParameters parameters_; RtpDemuxer rtp_demuxer_; // Used for identifying the MID for RtpDemuxer. diff --git a/pc/rtp_transport_internal.h b/pc/rtp_transport_internal.h index f8a5f2bb1a..fce1f9bf71 100644 --- a/pc/rtp_transport_internal.h +++ b/pc/rtp_transport_internal.h @@ -13,7 +13,6 @@ #include -#include "api/ortc/srtp_transport_interface.h" #include "call/rtp_demuxer.h" #include "p2p/base/ice_transport_internal.h" #include "pc/session_description.h" @@ -32,9 +31,10 @@ namespace webrtc { // it is not accessible to API consumers but is accessible to internal classes // in order to send and receive RTP and RTCP packets belonging to a single RTP // session. Additional convenience and configuration methods are also provided. -class RtpTransportInternal : public SrtpTransportInterface, - public sigslot::has_slots<> { +class RtpTransportInternal : public sigslot::has_slots<> { public: + virtual ~RtpTransportInternal() = default; + virtual void SetRtcpMuxEnabled(bool enable) = 0; // TODO(zstein): Remove PacketTransport setters. Clients should pass these diff --git a/pc/rtp_transport_unittest.cc b/pc/rtp_transport_unittest.cc index 54f182d2a6..4248ba788c 100644 --- a/pc/rtp_transport_unittest.cc +++ b/pc/rtp_transport_unittest.cc @@ -31,27 +31,6 @@ constexpr uint16_t kRemoteNetId = 2; constexpr int kLastPacketId = 100; constexpr int kTransportOverheadPerPacket = 28; // Ipv4(20) + UDP(8). -TEST(RtpTransportTest, SetRtcpParametersCantDisableRtcpMux) { - RtpTransport transport(kMuxDisabled); - RtpTransportParameters params; - transport.SetParameters(params); - params.rtcp.mux = false; - EXPECT_FALSE(transport.SetParameters(params).ok()); -} - -TEST(RtpTransportTest, SetRtcpParametersEmptyCnameUsesExisting) { - static const char kName[] = "name"; - RtpTransport transport(kMuxDisabled); - RtpTransportParameters params_with_name; - params_with_name.rtcp.cname = kName; - transport.SetParameters(params_with_name); - EXPECT_EQ(transport.GetParameters().rtcp.cname, kName); - - RtpTransportParameters params_without_name; - transport.SetParameters(params_without_name); - EXPECT_EQ(transport.GetParameters().rtcp.cname, kName); -} - class SignalObserver : public sigslot::has_slots<> { public: explicit SignalObserver(RtpTransport* transport) { diff --git a/pc/srtp_transport.h b/pc/srtp_transport.h index e725733e05..ed923792f1 100644 --- a/pc/srtp_transport.h +++ b/pc/srtp_transport.h @@ -40,8 +40,8 @@ class SrtpTransport : public RtpTransport { virtual ~SrtpTransport() = default; // SrtpTransportInterface specific implementation. - RTCError SetSrtpSendKey(const cricket::CryptoParams& params) override; - RTCError SetSrtpReceiveKey(const cricket::CryptoParams& params) override; + virtual RTCError SetSrtpSendKey(const cricket::CryptoParams& params); + virtual RTCError SetSrtpReceiveKey(const cricket::CryptoParams& params); bool SendRtpPacket(rtc::CopyOnWriteBuffer* packet, const rtc::PacketOptions& options,