| Index: webrtc/call/call.cc
|
| diff --git a/webrtc/call/call.cc b/webrtc/call/call.cc
|
| index a1aa1de5f725c0b47f278df4cf4b2919d59a32c7..5f4c276a22923c61ae506837097a6c9ef4d643bd 100644
|
| --- a/webrtc/call/call.cc
|
| +++ b/webrtc/call/call.cc
|
| @@ -155,8 +155,7 @@ class Call : public webrtc::Call,
|
| public SendSideCongestionController::Observer,
|
| public BitrateAllocator::LimitObserver {
|
| public:
|
| - Call(const Call::Config& config,
|
| - std::unique_ptr<RtpTransportControllerSendInterface> transport_send);
|
| + explicit Call(const Call::Config& config);
|
| virtual ~Call();
|
|
|
| // Implements webrtc::Call.
|
| @@ -331,7 +330,6 @@ class Call : public webrtc::Call,
|
|
|
| std::map<std::string, rtc::NetworkRoute> network_routes_;
|
|
|
| - std::unique_ptr<RtpTransportControllerSendInterface> transport_send_;
|
| ReceiveSideCongestionController receive_side_cc_;
|
| const std::unique_ptr<SendDelayStats> video_send_delay_stats_;
|
| const int64_t start_ms_;
|
| @@ -358,21 +356,12 @@ std::string Call::Stats::ToString(int64_t time_ms) const {
|
| }
|
|
|
| Call* Call::Create(const Call::Config& config) {
|
| - return new internal::Call(config,
|
| - rtc::MakeUnique<RtpTransportControllerSend>(
|
| - Clock::GetRealTimeClock(), config.event_log));
|
| -}
|
| -
|
| -Call* Call::Create(
|
| - const Call::Config& config,
|
| - std::unique_ptr<RtpTransportControllerSendInterface> transport_send) {
|
| - return new internal::Call(config, std::move(transport_send));
|
| + return new internal::Call(config);
|
| }
|
|
|
| namespace internal {
|
|
|
| -Call::Call(const Call::Config& config,
|
| - std::unique_ptr<RtpTransportControllerSendInterface> transport_send)
|
| +Call::Call(const Call::Config& config)
|
| : clock_(Clock::GetRealTimeClock()),
|
| num_cpu_cores_(CpuInfo::DetectNumberOfCores()),
|
| module_process_thread_(ProcessThread::Create("ModuleProcessThread")),
|
| @@ -393,7 +382,11 @@ Call::Call(const Call::Config& config,
|
| configured_max_padding_bitrate_bps_(0),
|
| estimated_send_bitrate_kbps_counter_(clock_, nullptr, true),
|
| pacer_bitrate_kbps_counter_(clock_, nullptr, true),
|
| - receive_side_cc_(clock_, transport_send->packet_router()),
|
| + // TODO(nisse): Always uses the video transport for now.
|
| + // receive_side_cc_ ownership should be moved to the
|
| + // corresponding RtpTransportControllerReceiveInterface.
|
| + receive_side_cc_(clock_,
|
| + config.video_rtp_transport_send->packet_router()),
|
| video_send_delay_stats_(new SendDelayStats(clock_)),
|
| start_ms_(clock_->TimeInMilliseconds()),
|
| worker_queue_("call_worker_queue") {
|
| @@ -407,23 +400,21 @@ Call::Call(const Call::Config& config,
|
| config.bitrate_config.start_bitrate_bps);
|
| }
|
| Trace::CreateTrace();
|
| - transport_send->send_side_cc()->RegisterNetworkObserver(this);
|
| - transport_send_ = std::move(transport_send);
|
| - transport_send_->send_side_cc()->SignalNetworkState(kNetworkDown);
|
| - transport_send_->send_side_cc()->SetBweBitrates(
|
| - config_.bitrate_config.min_bitrate_bps,
|
| - config_.bitrate_config.start_bitrate_bps,
|
| - config_.bitrate_config.max_bitrate_bps);
|
| + config.send_side_cc->RegisterNetworkObserver(this);
|
| + config.send_side_cc->SignalNetworkState(kNetworkDown);
|
| + // TODO(nisse): Move this to caller.
|
| + config.send_side_cc->SetBweBitrates(
|
| + config.bitrate_config.min_bitrate_bps,
|
| + config.bitrate_config.start_bitrate_bps,
|
| + config.bitrate_config.max_bitrate_bps);
|
| call_stats_->RegisterStatsObserver(&receive_side_cc_);
|
| - call_stats_->RegisterStatsObserver(transport_send_->send_side_cc());
|
| + call_stats_->RegisterStatsObserver(config.send_side_cc);
|
|
|
| module_process_thread_->Start();
|
| module_process_thread_->RegisterModule(call_stats_.get(), RTC_FROM_HERE);
|
| module_process_thread_->RegisterModule(&receive_side_cc_, RTC_FROM_HERE);
|
| - module_process_thread_->RegisterModule(transport_send_->send_side_cc(),
|
| - RTC_FROM_HERE);
|
| - pacer_thread_->RegisterModule(transport_send_->send_side_cc()->pacer(),
|
| - RTC_FROM_HERE);
|
| + module_process_thread_->RegisterModule(config.send_side_cc, RTC_FROM_HERE);
|
| + pacer_thread_->RegisterModule(config.send_side_cc->pacer(), RTC_FROM_HERE);
|
| pacer_thread_->RegisterModule(
|
| receive_side_cc_.GetRemoteBitrateEstimator(true), RTC_FROM_HERE);
|
|
|
| @@ -440,18 +431,18 @@ Call::~Call() {
|
| RTC_CHECK(video_receive_streams_.empty());
|
|
|
| pacer_thread_->Stop();
|
| - pacer_thread_->DeRegisterModule(transport_send_->send_side_cc()->pacer());
|
| + pacer_thread_->DeRegisterModule(config_.send_side_cc->pacer());
|
| pacer_thread_->DeRegisterModule(
|
| receive_side_cc_.GetRemoteBitrateEstimator(true));
|
| - module_process_thread_->DeRegisterModule(transport_send_->send_side_cc());
|
| + module_process_thread_->DeRegisterModule(config_.send_side_cc);
|
| module_process_thread_->DeRegisterModule(&receive_side_cc_);
|
| module_process_thread_->DeRegisterModule(call_stats_.get());
|
| module_process_thread_->Stop();
|
| call_stats_->DeregisterStatsObserver(&receive_side_cc_);
|
| - call_stats_->DeregisterStatsObserver(transport_send_->send_side_cc());
|
| + call_stats_->DeregisterStatsObserver(config_.send_side_cc);
|
|
|
| int64_t first_sent_packet_ms =
|
| - transport_send_->send_side_cc()->GetFirstPacketTimeMs();
|
| + config_.send_side_cc->GetFirstPacketTimeMs();
|
| // Only update histograms after process threads have been shut down, so that
|
| // they won't try to concurrently update stats.
|
| {
|
| @@ -577,7 +568,8 @@ webrtc::AudioSendStream* Call::CreateAudioSendStream(
|
| }
|
|
|
| AudioSendStream* send_stream = new AudioSendStream(
|
| - config, config_.audio_state, &worker_queue_, transport_send_.get(),
|
| + config, config_.audio_state, &worker_queue_,
|
| + config_.audio_rtp_transport_send,
|
| bitrate_allocator_.get(), event_log_, call_stats_->rtcp_rtt_stats(),
|
| suspended_rtp_state);
|
| {
|
| @@ -633,7 +625,8 @@ webrtc::AudioReceiveStream* Call::CreateAudioReceiveStream(
|
| RTC_DCHECK_RUN_ON(&configuration_thread_checker_);
|
| event_log_->LogAudioReceiveStreamConfig(CreateRtcLogStreamConfig(config));
|
| AudioReceiveStream* receive_stream =
|
| - new AudioReceiveStream(transport_send_->packet_router(), config,
|
| + new AudioReceiveStream(config_.audio_rtp_transport_send->packet_router(),
|
| + config,
|
| config_.audio_state, event_log_);
|
| {
|
| WriteLockScoped write_lock(*receive_crit_);
|
| @@ -704,7 +697,8 @@ webrtc::VideoSendStream* Call::CreateVideoSendStream(
|
| std::vector<uint32_t> ssrcs = config.rtp.ssrcs;
|
| VideoSendStream* send_stream = new VideoSendStream(
|
| num_cpu_cores_, module_process_thread_.get(), &worker_queue_,
|
| - call_stats_.get(), transport_send_.get(), bitrate_allocator_.get(),
|
| + call_stats_.get(), config_.video_rtp_transport_send,
|
| + bitrate_allocator_.get(),
|
| video_send_delay_stats_.get(), event_log_, std::move(config),
|
| std::move(encoder_config), suspended_video_send_ssrcs_);
|
|
|
| @@ -763,7 +757,8 @@ webrtc::VideoReceiveStream* Call::CreateVideoReceiveStream(
|
| RTC_DCHECK_RUN_ON(&configuration_thread_checker_);
|
|
|
| VideoReceiveStream* receive_stream =
|
| - new VideoReceiveStream(num_cpu_cores_, transport_send_->packet_router(),
|
| + new VideoReceiveStream(num_cpu_cores_,
|
| + config_.video_rtp_transport_send->packet_router(),
|
| std::move(configuration),
|
| module_process_thread_.get(), call_stats_.get());
|
|
|
| @@ -882,7 +877,7 @@ Call::Stats Call::GetStats() const {
|
| Stats stats;
|
| // Fetch available send/receive bitrates.
|
| uint32_t send_bandwidth = 0;
|
| - transport_send_->send_side_cc()->GetBitrateController()->AvailableBandwidth(
|
| + config_.send_side_cc->GetBitrateController()->AvailableBandwidth(
|
| &send_bandwidth);
|
| std::vector<unsigned int> ssrcs;
|
| uint32_t recv_bandwidth = 0;
|
| @@ -891,7 +886,7 @@ Call::Stats Call::GetStats() const {
|
| stats.send_bandwidth_bps = send_bandwidth;
|
| stats.recv_bandwidth_bps = recv_bandwidth;
|
| stats.pacer_delay_ms =
|
| - transport_send_->send_side_cc()->GetPacerQueuingDelayMs();
|
| + config_.send_side_cc->GetPacerQueuingDelayMs();
|
| stats.rtt_ms = call_stats_->rtcp_rtt_stats()->LastProcessedRtt();
|
| {
|
| rtc::CritScope cs(&bitrate_crit_);
|
| @@ -924,7 +919,7 @@ void Call::SetBitrateConfig(
|
| config_.bitrate_config.start_bitrate_bps = bitrate_config.start_bitrate_bps;
|
| config_.bitrate_config.max_bitrate_bps = bitrate_config.max_bitrate_bps;
|
| RTC_DCHECK_NE(bitrate_config.start_bitrate_bps, 0);
|
| - transport_send_->send_side_cc()->SetBweBitrates(
|
| + config_.send_side_cc->SetBweBitrates(
|
| bitrate_config.min_bitrate_bps, bitrate_config.start_bitrate_bps,
|
| bitrate_config.max_bitrate_bps);
|
| }
|
| @@ -1021,7 +1016,7 @@ void Call::OnNetworkRouteChanged(const std::string& transport_name,
|
| << " bps, max: " << config_.bitrate_config.start_bitrate_bps
|
| << " bps.";
|
| RTC_DCHECK_GT(config_.bitrate_config.start_bitrate_bps, 0);
|
| - transport_send_->send_side_cc()->OnNetworkRouteChanged(
|
| + config_.send_side_cc->OnNetworkRouteChanged(
|
| network_route, config_.bitrate_config.start_bitrate_bps,
|
| config_.bitrate_config.min_bitrate_bps,
|
| config_.bitrate_config.max_bitrate_bps);
|
| @@ -1057,13 +1052,13 @@ void Call::UpdateAggregateNetworkState() {
|
| LOG(LS_INFO) << "UpdateAggregateNetworkState: aggregate_state="
|
| << (aggregate_state == kNetworkUp ? "up" : "down");
|
|
|
| - transport_send_->send_side_cc()->SignalNetworkState(aggregate_state);
|
| + config_.send_side_cc->SignalNetworkState(aggregate_state);
|
| }
|
|
|
| void Call::OnSentPacket(const rtc::SentPacket& sent_packet) {
|
| video_send_delay_stats_->OnSentPacket(sent_packet.packet_id,
|
| clock_->TimeInMilliseconds());
|
| - transport_send_->send_side_cc()->OnSentPacket(sent_packet);
|
| + config_.send_side_cc->OnSentPacket(sent_packet);
|
| }
|
|
|
| void Call::OnNetworkChanged(uint32_t target_bitrate_bps,
|
| @@ -1116,7 +1111,7 @@ void Call::OnNetworkChanged(uint32_t target_bitrate_bps,
|
|
|
| void Call::OnAllocationLimitsChanged(uint32_t min_send_bitrate_bps,
|
| uint32_t max_padding_bitrate_bps) {
|
| - transport_send_->send_side_cc()->SetAllocatedSendBitrateLimits(
|
| + config_.send_side_cc->SetAllocatedSendBitrateLimits(
|
| min_send_bitrate_bps, max_padding_bitrate_bps);
|
| rtc::CritScope lock(&bitrate_crit_);
|
| min_allocated_send_bitrate_bps_ = min_send_bitrate_bps;
|
|
|