Move RtpTransportControllerSend to a new file.

Also move RtpTransportControllerSendInterface to its own header file.

BUG=webrtc:7135

Review-Url: https://codereview.webrtc.org/2808043002
Cr-Commit-Position: refs/heads/master@{#17840}
This commit is contained in:
nisse 2017-04-24 05:53:20 -07:00 committed by Commit bot
parent a244ec659d
commit cae45d0469
10 changed files with 121 additions and 77 deletions

View File

@ -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"

View File

@ -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"

View File

@ -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) {

View File

@ -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 {

View File

@ -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

View File

@ -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

View File

@ -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_

View File

@ -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"

View File

@ -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"

View File

@ -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 {