Index: webrtc/video/video_send_stream.cc |
diff --git a/webrtc/video/video_send_stream.cc b/webrtc/video/video_send_stream.cc |
index 466b5c2f00ad0f7adb7ff6947456d9ef5632431d..14e7ea1f579d974ef31de580ab19be50841e7515 100644 |
--- a/webrtc/video/video_send_stream.cc |
+++ b/webrtc/video/video_send_stream.cc |
@@ -23,6 +23,7 @@ |
#include "webrtc/base/logging.h" |
#include "webrtc/base/trace_event.h" |
#include "webrtc/base/weak_ptr.h" |
+#include "webrtc/call/rtp_transport_controller.h" |
#include "webrtc/modules/bitrate_controller/include/bitrate_controller.h" |
#include "webrtc/modules/congestion_controller/include/congestion_controller.h" |
#include "webrtc/modules/pacing/packet_router.h" |
@@ -31,6 +32,7 @@ |
#include "webrtc/modules/video_coding/utility/ivf_file_writer.h" |
#include "webrtc/system_wrappers/include/field_trial.h" |
#include "webrtc/video/call_stats.h" |
+#include "webrtc/video/payload_router.h" |
#include "webrtc/video/vie_remb.h" |
#include "webrtc/video_send_stream.h" |
@@ -46,10 +48,8 @@ std::vector<RtpRtcp*> CreateRtpRtcpModules( |
Transport* outgoing_transport, |
RtcpIntraFrameObserver* intra_frame_callback, |
RtcpBandwidthObserver* bandwidth_callback, |
- TransportFeedbackObserver* transport_feedback_callback, |
+ RtpTransportControllerSendInterface* transport, |
RtcpRttStats* rtt_stats, |
- RtpPacketSender* paced_sender, |
- TransportSequenceNumberAllocator* transport_sequence_number_allocator, |
FlexfecSender* flexfec_sender, |
SendStatisticsProxy* stats_proxy, |
SendDelayStats* send_delay_stats, |
@@ -67,12 +67,13 @@ std::vector<RtpRtcp*> CreateRtpRtcpModules( |
configuration.outgoing_transport = outgoing_transport; |
configuration.intra_frame_callback = intra_frame_callback; |
configuration.bandwidth_callback = bandwidth_callback; |
- configuration.transport_feedback_callback = transport_feedback_callback; |
+ configuration.transport_feedback_callback = |
+ transport->congestion_controller()->GetTransportFeedbackObserver(); |
configuration.rtt_stats = rtt_stats; |
configuration.rtcp_packet_type_counter_observer = stats_proxy; |
- configuration.paced_sender = paced_sender; |
+ configuration.paced_sender = transport->congestion_controller()->pacer(); |
configuration.transport_sequence_number_allocator = |
- transport_sequence_number_allocator; |
+ transport->packet_router(); |
configuration.send_bitrate_observer = stats_proxy; |
configuration.send_frame_count_observer = stats_proxy; |
configuration.send_side_delay_observer = stats_proxy; |
@@ -324,11 +325,9 @@ class VideoSendStreamImpl : public webrtc::BitrateAllocatorObserver, |
VideoSendStreamImpl(SendStatisticsProxy* stats_proxy, |
rtc::TaskQueue* worker_queue, |
CallStats* call_stats, |
- CongestionController* congestion_controller, |
- PacketRouter* packet_router, |
+ RtpTransportControllerSendInterface* transport, |
BitrateAllocator* bitrate_allocator, |
SendDelayStats* send_delay_stats, |
- VieRemb* remb, |
ViEEncoder* vie_encoder, |
RtcEventLog* event_log, |
const VideoSendStream::Config* config, |
@@ -410,10 +409,8 @@ class VideoSendStreamImpl : public webrtc::BitrateAllocatorObserver, |
GUARDED_BY(encoder_activity_crit_sect_); |
CallStats* const call_stats_; |
- CongestionController* const congestion_controller_; |
- PacketRouter* const packet_router_; |
+ RtpTransportControllerSendInterface* const transport_; |
BitrateAllocator* const bitrate_allocator_; |
- VieRemb* const remb_; |
// TODO(brandtr): Consider moving this to a new FlexfecSendStream class. |
std::unique_ptr<FlexfecSender> flexfec_sender_; |
@@ -459,11 +456,9 @@ class VideoSendStream::ConstructionTask : public rtc::QueuedTask { |
ViEEncoder* vie_encoder, |
ProcessThread* module_process_thread, |
CallStats* call_stats, |
- CongestionController* congestion_controller, |
- PacketRouter* packet_router, |
+ RtpTransportControllerSendInterface* transport, |
BitrateAllocator* bitrate_allocator, |
SendDelayStats* send_delay_stats, |
- VieRemb* remb, |
RtcEventLog* event_log, |
const VideoSendStream::Config* config, |
int initial_encoder_max_bitrate, |
@@ -473,11 +468,9 @@ class VideoSendStream::ConstructionTask : public rtc::QueuedTask { |
stats_proxy_(stats_proxy), |
vie_encoder_(vie_encoder), |
call_stats_(call_stats), |
- congestion_controller_(congestion_controller), |
- packet_router_(packet_router), |
+ transport_(transport), |
bitrate_allocator_(bitrate_allocator), |
send_delay_stats_(send_delay_stats), |
- remb_(remb), |
event_log_(event_log), |
config_(config), |
initial_encoder_max_bitrate_(initial_encoder_max_bitrate), |
@@ -488,10 +481,9 @@ class VideoSendStream::ConstructionTask : public rtc::QueuedTask { |
private: |
bool Run() override { |
send_stream_->reset(new VideoSendStreamImpl( |
- stats_proxy_, rtc::TaskQueue::Current(), call_stats_, |
- congestion_controller_, packet_router_, bitrate_allocator_, |
- send_delay_stats_, remb_, vie_encoder_, event_log_, config_, |
- initial_encoder_max_bitrate_, std::move(suspended_ssrcs_))); |
+ stats_proxy_, rtc::TaskQueue::Current(), call_stats_, transport_, |
+ bitrate_allocator_, send_delay_stats_, vie_encoder_, event_log_, |
+ config_, initial_encoder_max_bitrate_, std::move(suspended_ssrcs_))); |
return true; |
} |
@@ -500,11 +492,9 @@ class VideoSendStream::ConstructionTask : public rtc::QueuedTask { |
SendStatisticsProxy* const stats_proxy_; |
ViEEncoder* const vie_encoder_; |
CallStats* const call_stats_; |
- CongestionController* const congestion_controller_; |
- PacketRouter* const packet_router_; |
+ RtpTransportControllerSendInterface* const transport_; |
BitrateAllocator* const bitrate_allocator_; |
SendDelayStats* const send_delay_stats_; |
- VieRemb* const remb_; |
RtcEventLog* const event_log_; |
const VideoSendStream::Config* config_; |
int initial_encoder_max_bitrate_; |
@@ -615,11 +605,9 @@ VideoSendStream::VideoSendStream( |
ProcessThread* module_process_thread, |
rtc::TaskQueue* worker_queue, |
CallStats* call_stats, |
- CongestionController* congestion_controller, |
- PacketRouter* packet_router, |
+ RtpTransportControllerSendInterface* transport, |
BitrateAllocator* bitrate_allocator, |
SendDelayStats* send_delay_stats, |
- VieRemb* remb, |
RtcEventLog* event_log, |
VideoSendStream::Config config, |
VideoEncoderConfig encoder_config, |
@@ -635,9 +623,9 @@ VideoSendStream::VideoSendStream( |
config_.pre_encode_callback, config_.post_encode_callback)); |
worker_queue_->PostTask(std::unique_ptr<rtc::QueuedTask>(new ConstructionTask( |
&send_stream_, &thread_sync_event_, &stats_proxy_, vie_encoder_.get(), |
- module_process_thread, call_stats, congestion_controller, packet_router, |
- bitrate_allocator, send_delay_stats, remb, event_log, &config_, |
- encoder_config.max_bitrate_bps, suspended_ssrcs))); |
+ module_process_thread, call_stats, transport, bitrate_allocator, |
+ send_delay_stats, event_log, &config_, encoder_config.max_bitrate_bps, |
+ suspended_ssrcs))); |
// Wait for ConstructionTask to complete so that |send_stream_| can be used. |
// |module_process_thread| must be registered and deregistered on the thread |
@@ -747,18 +735,17 @@ VideoSendStreamImpl::VideoSendStreamImpl( |
SendStatisticsProxy* stats_proxy, |
rtc::TaskQueue* worker_queue, |
CallStats* call_stats, |
- CongestionController* congestion_controller, |
- PacketRouter* packet_router, |
+ RtpTransportControllerSendInterface* transport, |
BitrateAllocator* bitrate_allocator, |
SendDelayStats* send_delay_stats, |
- VieRemb* remb, |
ViEEncoder* vie_encoder, |
RtcEventLog* event_log, |
const VideoSendStream::Config* config, |
int initial_encoder_max_bitrate, |
std::map<uint32_t, RtpState> suspended_ssrcs) |
: send_side_bwe_with_overhead_(webrtc::field_trial::FindFullName( |
- "WebRTC-SendSideBwe-WithOverhead") == "Enabled"), |
+ "WebRTC-SendSideBwe-WithOverhead") == |
+ "Enabled"), |
stats_proxy_(stats_proxy), |
config_(config), |
suspended_ssrcs_(std::move(suspended_ssrcs)), |
@@ -766,10 +753,8 @@ VideoSendStreamImpl::VideoSendStreamImpl( |
worker_queue_(worker_queue), |
check_encoder_activity_task_(nullptr), |
call_stats_(call_stats), |
- congestion_controller_(congestion_controller), |
- packet_router_(packet_router), |
+ transport_(transport), |
bitrate_allocator_(bitrate_allocator), |
- remb_(remb), |
flexfec_sender_(MaybeCreateFlexfecSender(*config_)), |
max_padding_bitrate_(0), |
encoder_min_bitrate_bps_(0), |
@@ -780,21 +765,20 @@ VideoSendStreamImpl::VideoSendStreamImpl( |
config_->rtp.ssrcs, |
vie_encoder), |
protection_bitrate_calculator_(Clock::GetRealTimeClock(), this), |
- bandwidth_observer_(congestion_controller_->GetBitrateController() |
+ bandwidth_observer_(transport->congestion_controller() |
+ ->GetBitrateController() |
->CreateRtcpBandwidthObserver()), |
rtp_rtcp_modules_(CreateRtpRtcpModules( |
config_->send_transport, |
&encoder_feedback_, |
bandwidth_observer_.get(), |
- congestion_controller_->GetTransportFeedbackObserver(), |
+ transport, |
call_stats_->rtcp_rtt_stats(), |
- congestion_controller_->pacer(), |
- packet_router_, |
flexfec_sender_.get(), |
stats_proxy_, |
send_delay_stats, |
event_log, |
- congestion_controller_->GetRetransmissionRateLimiter(), |
+ transport->congestion_controller()->GetRetransmissionRateLimiter(), |
this, |
config_->rtp.ssrcs.size())), |
payload_router_(rtp_rtcp_modules_, |
@@ -809,10 +793,11 @@ VideoSendStreamImpl::VideoSendStreamImpl( |
RTC_DCHECK(!config_->rtp.ssrcs.empty()); |
RTC_DCHECK(call_stats_); |
- RTC_DCHECK(congestion_controller_); |
- RTC_DCHECK(remb_); |
+ RTC_DCHECK(transport_); |
+ RTC_DCHECK(transport_->congestion_controller()); |
+ RTC_DCHECK(transport_->remb()); |
- congestion_controller_->EnablePeriodicAlrProbing( |
+ transport->congestion_controller()->EnablePeriodicAlrProbing( |
config_->periodic_alr_bandwidth_probing); |
// RTP/RTCP initialization. |
@@ -821,7 +806,7 @@ VideoSendStreamImpl::VideoSendStreamImpl( |
// when sending padding, with the hope that the packet rate will be smaller, |
// and that it's more important to protect than the lower layers. |
for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) |
- packet_router_->AddRtpModule(rtp_rtcp); |
+ transport->packet_router()->AddRtpModule(rtp_rtcp); |
for (size_t i = 0; i < config_->rtp.extensions.size(); ++i) { |
const std::string& extension = config_->rtp.extensions[i].uri; |
@@ -836,7 +821,7 @@ VideoSendStreamImpl::VideoSendStreamImpl( |
} |
} |
- remb_->AddRembSender(rtp_rtcp_modules_[0]); |
+ transport->remb()->AddRembSender(rtp_rtcp_modules_[0]); |
rtp_rtcp_modules_[0]->SetREMBStatus(true); |
ConfigureProtection(); |
@@ -897,10 +882,10 @@ VideoSendStreamImpl::~VideoSendStreamImpl() { |
LOG(LS_INFO) << "~VideoSendStreamInternal: " << config_->ToString(); |
rtp_rtcp_modules_[0]->SetREMBStatus(false); |
- remb_->RemoveRembSender(rtp_rtcp_modules_[0]); |
+ transport_->remb()->RemoveRembSender(rtp_rtcp_modules_[0]); |
for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) { |
- packet_router_->RemoveRtpModule(rtp_rtcp); |
+ transport_->packet_router()->RemoveRtpModule(rtp_rtcp); |
delete rtp_rtcp; |
} |
} |
@@ -1328,7 +1313,7 @@ void VideoSendStreamImpl::SetTransportOverhead( |
transport_overhead_bytes_per_packet_ = transport_overhead_bytes_per_packet; |
- congestion_controller_->SetTransportOverhead( |
+ transport_->congestion_controller()->SetTransportOverhead( |
transport_overhead_bytes_per_packet_); |
size_t rtp_packet_size = |