Index: webrtc/call/call.cc |
diff --git a/webrtc/call/call.cc b/webrtc/call/call.cc |
index 41f53feee7c57ed5e42753ad9e2a78075eb8a22c..a7c85a211dbb8137d6e5560d1ab1bd64c3e85afa 100644 |
--- a/webrtc/call/call.cc |
+++ b/webrtc/call/call.cc |
@@ -435,17 +435,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() { |