Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1005)

Unified Diff: webrtc/call/call.cc

Issue 2918323002: Add functionality which limits the number of bytes on the network. (Closed)
Patch Set: Comment addressed. Created 3 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | webrtc/modules/congestion_controller/include/send_side_congestion_controller.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/call/call.cc
diff --git a/webrtc/call/call.cc b/webrtc/call/call.cc
index 25dcf32a620c48965c22077d8c6d35cc3b298267..110a7d6847955a517513b46e1bd6ee616c86a607 100644
--- a/webrtc/call/call.cc
+++ b/webrtc/call/call.cc
@@ -436,17 +436,20 @@ Call::Call(const Call::Config& config,
call_stats_->RegisterStatsObserver(&receive_side_cc_);
call_stats_->RegisterStatsObserver(transport_send_->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);
+ // We have to attach the pacer to the pacer thread before starting the
+ // module process thread to avoid a race accessing the process thread
+ // both from the process thread and the pacer thread.
pacer_thread_->RegisterModule(transport_send_->send_side_cc()->pacer(),
RTC_FROM_HERE);
pacer_thread_->RegisterModule(
receive_side_cc_.GetRemoteBitrateEstimator(true), RTC_FROM_HERE);
-
pacer_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);
+ module_process_thread_->Start();
}
Call::~Call() {
@@ -458,11 +461,15 @@ Call::~Call() {
RTC_CHECK(audio_receive_streams_.empty());
RTC_CHECK(video_receive_streams_.empty());
+ // The send-side congestion controller must be de-registered prior to
+ // the pacer thread being stopped to avoid a race when accessing the
+ // pacer thread object on the module process thread at the same time as
+ // the pacer thread is stopped.
+ module_process_thread_->DeRegisterModule(transport_send_->send_side_cc());
pacer_thread_->Stop();
pacer_thread_->DeRegisterModule(transport_send_->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(&receive_side_cc_);
module_process_thread_->DeRegisterModule(call_stats_.get());
module_process_thread_->Stop();
« no previous file with comments | « no previous file | webrtc/modules/congestion_controller/include/send_side_congestion_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698