aboutsummaryrefslogtreecommitdiff
path: root/call
diff options
context:
space:
mode:
authorSebastian Jansson <srte@webrtc.org>2018-05-07 16:33:50 +0200
committerCommit Bot <commit-bot@chromium.org>2018-05-07 15:54:38 +0000
commitbd9fe092cef15d35813988f490806f0da0582e68 (patch)
treefe736f75a321e541faf2d5c791825b949fe07aad /call
parent0c4f7beb25ad062e17b1cd26d5e0e3c40ab00f5c (diff)
downloadwebrtc-bd9fe092cef15d35813988f490806f0da0582e68.tar.gz
Using shared task queue for congestion controller.
This simplifies the code and removes the need for a lot of bookkeeping variables. Bug: webrtc:9232 Change-Id: I0c9a4b0741ed5353caa22ba5acdcb166357441f2 Reviewed-on: https://webrtc-review.googlesource.com/74240 Commit-Queue: Sebastian Jansson <srte@webrtc.org> Reviewed-by: Niels Moller <nisse@webrtc.org> Cr-Commit-Position: refs/heads/master@{#23149}
Diffstat (limited to 'call')
-rw-r--r--call/rtp_transport_controller_send.cc16
-rw-r--r--call/rtp_transport_controller_send.h12
2 files changed, 9 insertions, 19 deletions
diff --git a/call/rtp_transport_controller_send.cc b/call/rtp_transport_controller_send.cc
index 78ede7ea22..2a4a549596 100644
--- a/call/rtp_transport_controller_send.cc
+++ b/call/rtp_transport_controller_send.cc
@@ -29,6 +29,7 @@ bool TaskQueueExperimentEnabled() {
std::unique_ptr<SendSideCongestionControllerInterface> CreateController(
Clock* clock,
+ rtc::TaskQueue* task_queue,
webrtc::RtcEventLog* event_log,
PacedSender* pacer,
const BitrateConstraints& bitrate_config,
@@ -36,7 +37,7 @@ std::unique_ptr<SendSideCongestionControllerInterface> CreateController(
if (task_queue_controller) {
RTC_LOG(LS_INFO) << "Using TaskQueue based SSCC";
return rtc::MakeUnique<webrtc::webrtc_cc::SendSideCongestionController>(
- clock, event_log, pacer, bitrate_config.start_bitrate_bps,
+ clock, task_queue, event_log, pacer, bitrate_config.start_bitrate_bps,
bitrate_config.min_bitrate_bps, bitrate_config.max_bitrate_bps);
}
RTC_LOG(LS_INFO) << "Using Legacy SSCC";
@@ -59,13 +60,12 @@ RtpTransportControllerSend::RtpTransportControllerSend(
bitrate_configurator_(bitrate_config),
process_thread_(ProcessThread::Create("SendControllerThread")),
observer_(nullptr),
- send_side_cc_(CreateController(clock,
- event_log,
- &pacer_,
- bitrate_config,
- TaskQueueExperimentEnabled())),
task_queue_("rtp_send_controller") {
- send_side_cc_ptr_ = send_side_cc_.get();
+ // Created after task_queue to be able to post to the task queue internally.
+ send_side_cc_ =
+ CreateController(clock, &task_queue_, event_log, &pacer_, bitrate_config,
+ TaskQueueExperimentEnabled());
+
process_thread_->RegisterModule(&pacer_, RTC_FROM_HERE);
process_thread_->RegisterModule(send_side_cc_.get(), RTC_FROM_HERE);
process_thread_->Start();
@@ -89,7 +89,7 @@ void RtpTransportControllerSend::OnNetworkChanged(uint32_t bitrate_bps,
msg.network_estimate.at_time = msg.at_time;
msg.network_estimate.bwe_period = TimeDelta::ms(probing_interval_ms);
uint32_t bandwidth_bps;
- if (send_side_cc_ptr_->AvailableBandwidth(&bandwidth_bps))
+ if (send_side_cc_->AvailableBandwidth(&bandwidth_bps))
msg.network_estimate.bandwidth = DataRate::bps(bandwidth_bps);
msg.network_estimate.loss_rate_ratio = fraction_loss / 255.0;
msg.network_estimate.round_trip_time = TimeDelta::ms(rtt_ms);
diff --git a/call/rtp_transport_controller_send.h b/call/rtp_transport_controller_send.h
index d5bc25ed45..67248b22c6 100644
--- a/call/rtp_transport_controller_send.h
+++ b/call/rtp_transport_controller_send.h
@@ -93,17 +93,7 @@ class RtpTransportControllerSend final
const std::unique_ptr<ProcessThread> process_thread_;
rtc::CriticalSection observer_crit_;
TargetTransferRateObserver* observer_ RTC_GUARDED_BY(observer_crit_);
- // Caches send_side_cc_.get(), to avoid racing with destructor.
- // Note that this is declared before send_side_cc_ to ensure that it is not
- // invalidated until no more tasks can be running on the send_side_cc_ task
- // queue.
- // TODO(srte): Remove this when only the task queue based send side congestion
- // controller is used and it is no longer accessed synchronously in the
- // OnNetworkChanged callback.
- SendSideCongestionControllerInterface* send_side_cc_ptr_;
- // Declared last since it will issue callbacks from a task queue. Declaring it
- // last ensures that it is destroyed first.
- const std::unique_ptr<SendSideCongestionControllerInterface> send_side_cc_;
+ std::unique_ptr<SendSideCongestionControllerInterface> send_side_cc_;
// TODO(perkj): |task_queue_| is supposed to replace |process_thread_|.
// |task_queue_| is defined last to ensure all pending tasks are cancelled
// and deleted before any other members.