diff --git a/webrtc/audio/audio_send_stream.cc b/webrtc/audio/audio_send_stream.cc index 7f0d825610..a45c74f748 100644 --- a/webrtc/audio/audio_send_stream.cc +++ b/webrtc/audio/audio_send_stream.cc @@ -20,7 +20,7 @@ #include "webrtc/base/logging.h" #include "webrtc/base/task_queue.h" #include "webrtc/base/timeutils.h" -#include "webrtc/call/rtp_transport_controller_send.h" +#include "webrtc/call/rtp_transport_controller_send_interface.h" #include "webrtc/modules/bitrate_controller/include/bitrate_controller.h" #include "webrtc/modules/congestion_controller/include/send_side_congestion_controller.h" #include "webrtc/modules/pacing/paced_sender.h" diff --git a/webrtc/audio/audio_send_stream_unittest.cc b/webrtc/audio/audio_send_stream_unittest.cc index 69781cd3d1..91201d67f6 100644 --- a/webrtc/audio/audio_send_stream_unittest.cc +++ b/webrtc/audio/audio_send_stream_unittest.cc @@ -15,7 +15,7 @@ #include "webrtc/audio/audio_state.h" #include "webrtc/audio/conversion.h" #include "webrtc/base/task_queue.h" -#include "webrtc/call/rtp_transport_controller_send.h" +#include "webrtc/call/rtp_transport_controller_send_interface.h" #include "webrtc/logging/rtc_event_log/mock/mock_rtc_event_log.h" #include "webrtc/modules/audio_mixer/audio_mixer_impl.h" #include "webrtc/modules/audio_processing/include/mock_audio_processing.h" diff --git a/webrtc/call/BUILD.gn b/webrtc/call/BUILD.gn index f1345cf5ac..b56b4a20f6 100644 --- a/webrtc/call/BUILD.gn +++ b/webrtc/call/BUILD.gn @@ -16,7 +16,7 @@ rtc_source_set("call_interfaces") { "audio_state.h", "call.h", "flexfec_receive_stream.h", - "rtp_transport_controller_send.h", + "rtp_transport_controller_send_interface.h", "syncable.cc", "syncable.h", ] @@ -38,6 +38,8 @@ rtc_static_library("call") { "call.cc", "flexfec_receive_stream_impl.cc", "flexfec_receive_stream_impl.h", + "rtp_transport_controller_send.cc", + "rtp_transport_controller_send.h", ] if (!build_with_chromium && is_clang) { diff --git a/webrtc/call/call.cc b/webrtc/call/call.cc index c7e49dee1a..0e64269d4e 100644 --- a/webrtc/call/call.cc +++ b/webrtc/call/call.cc @@ -38,7 +38,6 @@ #include "webrtc/logging/rtc_event_log/rtc_event_log.h" #include "webrtc/modules/bitrate_controller/include/bitrate_controller.h" #include "webrtc/modules/congestion_controller/include/receive_side_congestion_controller.h" -#include "webrtc/modules/congestion_controller/include/send_side_congestion_controller.h" #include "webrtc/modules/pacing/paced_sender.h" #include "webrtc/modules/rtp_rtcp/include/flexfec_receiver.h" #include "webrtc/modules/rtp_rtcp/include/rtp_header_parser.h" @@ -87,40 +86,6 @@ bool UseSendSideBwe(const FlexfecReceiveStream::Config& config) { return UseSendSideBwe(config.rtp_header_extensions, config.transport_cc); } -class RtpTransportControllerSend : public RtpTransportControllerSendInterface { - public: - RtpTransportControllerSend(Clock* clock, webrtc::RtcEventLog* event_log); - - void RegisterNetworkObserver( - SendSideCongestionController::Observer* observer); - - // Implements RtpTransportControllerSendInterface - PacketRouter* packet_router() override { return &packet_router_; } - SendSideCongestionController* send_side_cc() override { - return &send_side_cc_; - } - TransportFeedbackObserver* transport_feedback_observer() override { - return &send_side_cc_; - } - RtpPacketSender* packet_sender() override { return send_side_cc_.pacer(); } - - private: - PacketRouter packet_router_; - SendSideCongestionController send_side_cc_; -}; - -RtpTransportControllerSend::RtpTransportControllerSend( - Clock* clock, - webrtc::RtcEventLog* event_log) - : send_side_cc_(clock, nullptr /* observer */, event_log, &packet_router_) { -} - -void RtpTransportControllerSend::RegisterNetworkObserver( - SendSideCongestionController::Observer* observer) { - // Must be called only once. - send_side_cc_.RegisterNetworkObserver(observer); -} - } // namespace namespace internal { diff --git a/webrtc/call/rtp_transport_controller_send.cc b/webrtc/call/rtp_transport_controller_send.cc new file mode 100644 index 0000000000..a006f289f6 --- /dev/null +++ b/webrtc/call/rtp_transport_controller_send.cc @@ -0,0 +1,27 @@ +/* + * Copyright (c) 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 "webrtc/call/rtp_transport_controller_send.h" + +namespace webrtc { + +RtpTransportControllerSend::RtpTransportControllerSend( + Clock* clock, + webrtc::RtcEventLog* event_log) + : send_side_cc_(clock, nullptr /* observer */, event_log, &packet_router_) { +} + +void RtpTransportControllerSend::RegisterNetworkObserver( + SendSideCongestionController::Observer* observer) { + // Must be called only once. + send_side_cc_.RegisterNetworkObserver(observer); +} + +} // namespace webrtc diff --git a/webrtc/call/rtp_transport_controller_send.h b/webrtc/call/rtp_transport_controller_send.h index 117bca069c..2bbb547ffd 100644 --- a/webrtc/call/rtp_transport_controller_send.h +++ b/webrtc/call/rtp_transport_controller_send.h @@ -11,46 +11,39 @@ #ifndef WEBRTC_CALL_RTP_TRANSPORT_CONTROLLER_SEND_H_ #define WEBRTC_CALL_RTP_TRANSPORT_CONTROLLER_SEND_H_ +#include "webrtc/base/constructormagic.h" +#include "webrtc/call/rtp_transport_controller_send_interface.h" +#include "webrtc/modules/congestion_controller/include/send_side_congestion_controller.h" + namespace webrtc { +class Clock; +class RtcEventLog; -class Module; -class PacketRouter; -class RtpPacketSender; -class SendSideCongestionController; -class TransportFeedbackObserver; - -// An RtpTransportController should own everything related to the RTP -// transport to/from a remote endpoint. We should have separate -// interfaces for send and receive side, even if they are implemented -// by the same class. This is an ongoing refactoring project. At some -// point, this class should be promoted to a public api under -// webrtc/api/rtp/. -// -// For a start, this object is just a collection of the objects needed -// by the VideoSendStream constructor. The plan is to move ownership -// of all RTP-related objects here, and add methods to create per-ssrc -// objects which would then be passed to VideoSendStream. Eventually, -// direct accessors like packet_router() should be removed. -// -// This should also have a reference to the underlying -// webrtc::Transport(s). Currently, webrtc::Transport is implemented by -// WebRtcVideoChannel2 and WebRtcVoiceMediaChannel, and owned by -// WebrtcSession. Video and audio always uses different transport -// objects, even in the common case where they are bundled over the -// same underlying transport. -// -// Extracting the logic of the webrtc::Transport from BaseChannel and -// subclasses into a separate class seems to be a prerequesite for -// moving the transport here. -class RtpTransportControllerSendInterface { +// TODO(nisse): When we get the underlying transports here, we should +// have one object implementing RtpTransportControllerSendInterface +// per transport, sharing the same congestion controller. +class RtpTransportControllerSend : public RtpTransportControllerSendInterface { public: - virtual ~RtpTransportControllerSendInterface() {} - virtual PacketRouter* packet_router() = 0; - // Currently returning the same pointer, but with different types. - virtual SendSideCongestionController* send_side_cc() = 0; - virtual TransportFeedbackObserver* transport_feedback_observer() = 0; + RtpTransportControllerSend(Clock* clock, webrtc::RtcEventLog* event_log); - virtual RtpPacketSender* packet_sender() = 0; + void RegisterNetworkObserver( + SendSideCongestionController::Observer* observer); + + // Implements RtpTransportControllerSendInterface + PacketRouter* packet_router() override { return &packet_router_; } + SendSideCongestionController* send_side_cc() override { + return &send_side_cc_; + } + TransportFeedbackObserver* transport_feedback_observer() override { + return &send_side_cc_; + } + RtpPacketSender* packet_sender() override { return send_side_cc_.pacer(); } + + private: + PacketRouter packet_router_; + SendSideCongestionController send_side_cc_; + + RTC_DISALLOW_COPY_AND_ASSIGN(RtpTransportControllerSend); }; } // namespace webrtc diff --git a/webrtc/call/rtp_transport_controller_send_interface.h b/webrtc/call/rtp_transport_controller_send_interface.h new file mode 100644 index 0000000000..31f07463a3 --- /dev/null +++ b/webrtc/call/rtp_transport_controller_send_interface.h @@ -0,0 +1,57 @@ +/* + * Copyright (c) 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 WEBRTC_CALL_RTP_TRANSPORT_CONTROLLER_SEND_INTERFACE_H_ +#define WEBRTC_CALL_RTP_TRANSPORT_CONTROLLER_SEND_INTERFACE_H_ + +namespace webrtc { + +class PacketRouter; +class RtpPacketSender; +class SendSideCongestionController; +class TransportFeedbackObserver; + +// An RtpTransportController should own everything related to the RTP +// transport to/from a remote endpoint. We should have separate +// interfaces for send and receive side, even if they are implemented +// by the same class. This is an ongoing refactoring project. At some +// point, this class should be promoted to a public api under +// webrtc/api/rtp/. +// +// For a start, this object is just a collection of the objects needed +// by the VideoSendStream constructor. The plan is to move ownership +// of all RTP-related objects here, and add methods to create per-ssrc +// objects which would then be passed to VideoSendStream. Eventually, +// direct accessors like packet_router() should be removed. +// +// This should also have a reference to the underlying +// webrtc::Transport(s). Currently, webrtc::Transport is implemented by +// WebRtcVideoChannel2 and WebRtcVoiceMediaChannel, and owned by +// WebrtcSession. Video and audio always uses different transport +// objects, even in the common case where they are bundled over the +// same underlying transport. +// +// Extracting the logic of the webrtc::Transport from BaseChannel and +// subclasses into a separate class seems to be a prerequesite for +// moving the transport here. +class RtpTransportControllerSendInterface { + public: + virtual ~RtpTransportControllerSendInterface() {} + virtual PacketRouter* packet_router() = 0; + // Currently returning the same pointer, but with different types. + virtual SendSideCongestionController* send_side_cc() = 0; + virtual TransportFeedbackObserver* transport_feedback_observer() = 0; + + virtual RtpPacketSender* packet_sender() = 0; +}; + +} // namespace webrtc + +#endif // WEBRTC_CALL_RTP_TRANSPORT_CONTROLLER_SEND_INTERFACE_H_ diff --git a/webrtc/video/video_send_stream.cc b/webrtc/video/video_send_stream.cc index 411f2796b4..c7cc872611 100644 --- a/webrtc/video/video_send_stream.cc +++ b/webrtc/video/video_send_stream.cc @@ -22,7 +22,7 @@ #include "webrtc/base/logging.h" #include "webrtc/base/trace_event.h" #include "webrtc/base/weak_ptr.h" -#include "webrtc/call/rtp_transport_controller_send.h" +#include "webrtc/call/rtp_transport_controller_send_interface.h" #include "webrtc/common_types.h" #include "webrtc/common_video/include/video_bitrate_allocator.h" #include "webrtc/modules/bitrate_controller/include/bitrate_controller.h" diff --git a/webrtc/voice_engine/channel.cc b/webrtc/voice_engine/channel.cc index b5e1cad73b..8c9b00179f 100644 --- a/webrtc/voice_engine/channel.cc +++ b/webrtc/voice_engine/channel.cc @@ -24,7 +24,7 @@ #include "webrtc/base/task_queue.h" #include "webrtc/base/thread_checker.h" #include "webrtc/base/timeutils.h" -#include "webrtc/call/rtp_transport_controller_send.h" +#include "webrtc/call/rtp_transport_controller_send_interface.h" #include "webrtc/config.h" #include "webrtc/logging/rtc_event_log/rtc_event_log.h" #include "webrtc/modules/audio_coding/codecs/audio_format_conversion.h" diff --git a/webrtc/voice_engine/channel_proxy.cc b/webrtc/voice_engine/channel_proxy.cc index f00548efbf..74234a232d 100644 --- a/webrtc/voice_engine/channel_proxy.cc +++ b/webrtc/voice_engine/channel_proxy.cc @@ -15,7 +15,7 @@ #include "webrtc/api/call/audio_sink.h" #include "webrtc/base/checks.h" #include "webrtc/base/logging.h" -#include "webrtc/call/rtp_transport_controller_send.h" +#include "webrtc/call/rtp_transport_controller_send_interface.h" #include "webrtc/voice_engine/channel.h" namespace webrtc {