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

Side by Side Diff: webrtc/call/call.cc

Issue 2151433002: Avoid race in Call destructor (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Added comment Created 4 years, 5 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 module_process_thread_->RegisterModule(congestion_controller_.get()); 258 module_process_thread_->RegisterModule(congestion_controller_.get());
259 pacer_thread_->RegisterModule(congestion_controller_->pacer()); 259 pacer_thread_->RegisterModule(congestion_controller_->pacer());
260 pacer_thread_->RegisterModule( 260 pacer_thread_->RegisterModule(
261 congestion_controller_->GetRemoteBitrateEstimator(true)); 261 congestion_controller_->GetRemoteBitrateEstimator(true));
262 pacer_thread_->Start(); 262 pacer_thread_->Start();
263 } 263 }
264 264
265 Call::~Call() { 265 Call::~Call() {
266 RTC_DCHECK(!remb_.InUse()); 266 RTC_DCHECK(!remb_.InUse());
267 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread()); 267 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread());
268 UpdateSendHistograms();
269 UpdateReceiveHistograms();
270 RTC_CHECK(audio_send_ssrcs_.empty()); 268 RTC_CHECK(audio_send_ssrcs_.empty());
271 RTC_CHECK(video_send_ssrcs_.empty()); 269 RTC_CHECK(video_send_ssrcs_.empty());
272 RTC_CHECK(video_send_streams_.empty()); 270 RTC_CHECK(video_send_streams_.empty());
273 RTC_CHECK(audio_receive_ssrcs_.empty()); 271 RTC_CHECK(audio_receive_ssrcs_.empty());
274 RTC_CHECK(video_receive_ssrcs_.empty()); 272 RTC_CHECK(video_receive_ssrcs_.empty());
275 RTC_CHECK(video_receive_streams_.empty()); 273 RTC_CHECK(video_receive_streams_.empty());
276 274
277 pacer_thread_->Stop(); 275 pacer_thread_->Stop();
278 pacer_thread_->DeRegisterModule(congestion_controller_->pacer()); 276 pacer_thread_->DeRegisterModule(congestion_controller_->pacer());
279 pacer_thread_->DeRegisterModule( 277 pacer_thread_->DeRegisterModule(
280 congestion_controller_->GetRemoteBitrateEstimator(true)); 278 congestion_controller_->GetRemoteBitrateEstimator(true));
281 module_process_thread_->DeRegisterModule(congestion_controller_.get()); 279 module_process_thread_->DeRegisterModule(congestion_controller_.get());
282 module_process_thread_->DeRegisterModule(call_stats_.get()); 280 module_process_thread_->DeRegisterModule(call_stats_.get());
283 module_process_thread_->Stop(); 281 module_process_thread_->Stop();
284 call_stats_->DeregisterStatsObserver(congestion_controller_.get()); 282 call_stats_->DeregisterStatsObserver(congestion_controller_.get());
283
284 // Only update histograms after process threads have been shut down, so that
285 // they won't try to concurrently update stats.
286 UpdateSendHistograms();
287 UpdateReceiveHistograms();
288
285 Trace::ReturnTrace(); 289 Trace::ReturnTrace();
286 } 290 }
287 291
288 void Call::UpdateSendHistograms() { 292 void Call::UpdateSendHistograms() {
289 if (num_bitrate_updates_ == 0 || first_packet_sent_ms_ == -1) 293 if (num_bitrate_updates_ == 0 || first_packet_sent_ms_ == -1)
290 return; 294 return;
291 int64_t elapsed_sec = 295 int64_t elapsed_sec =
292 (clock_->TimeInMilliseconds() - first_packet_sent_ms_) / 1000; 296 (clock_->TimeInMilliseconds() - first_packet_sent_ms_) / 1000;
293 if (elapsed_sec < metrics::kMinRunTimeInSeconds) 297 if (elapsed_sec < metrics::kMinRunTimeInSeconds)
294 return; 298 return;
(...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after
873 // thread. Then this check can be enabled. 877 // thread. Then this check can be enabled.
874 // RTC_DCHECK(!configuration_thread_checker_.CalledOnValidThread()); 878 // RTC_DCHECK(!configuration_thread_checker_.CalledOnValidThread());
875 if (RtpHeaderParser::IsRtcp(packet, length)) 879 if (RtpHeaderParser::IsRtcp(packet, length))
876 return DeliverRtcp(media_type, packet, length); 880 return DeliverRtcp(media_type, packet, length);
877 881
878 return DeliverRtp(media_type, packet, length, packet_time); 882 return DeliverRtp(media_type, packet, length, packet_time);
879 } 883 }
880 884
881 } // namespace internal 885 } // namespace internal
882 } // namespace webrtc 886 } // namespace webrtc
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698