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

Side by Side Diff: webrtc/pc/videocapturertracksource.cc

Issue 2717023002: Fix occasional race in VideoCapturerTrackSource seen by memcheck bot. (Closed)
Patch Set: Rebase onto master Created 3 years, 10 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 | « webrtc/pc/videocapturertracksource.h ('k') | 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 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright 2012 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 364 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 worker_thread_->Invoke<void>( 375 worker_thread_->Invoke<void>(
376 RTC_FROM_HERE, 376 RTC_FROM_HERE,
377 rtc::Bind(&cricket::VideoCapturer::Stop, video_capturer_.get())); 377 rtc::Bind(&cricket::VideoCapturer::Stop, video_capturer_.get()));
378 } 378 }
379 379
380 // OnStateChange listens to the cricket::VideoCapturer::SignalStateChange. 380 // OnStateChange listens to the cricket::VideoCapturer::SignalStateChange.
381 void VideoCapturerTrackSource::OnStateChange( 381 void VideoCapturerTrackSource::OnStateChange(
382 cricket::VideoCapturer* capturer, 382 cricket::VideoCapturer* capturer,
383 cricket::CaptureState capture_state) { 383 cricket::CaptureState capture_state) {
384 if (rtc::Thread::Current() != signaling_thread_) { 384 if (rtc::Thread::Current() != signaling_thread_) {
385 // Use rtc::Unretained, because we don't want this to capture a reference
386 // to ourselves. If our destructor is called while this task is executing,
387 // that's fine; our AsyncInvoker destructor will wait for it to finish if
388 // it isn't simply canceled.
385 invoker_.AsyncInvoke<void>( 389 invoker_.AsyncInvoke<void>(
386 RTC_FROM_HERE, signaling_thread_, 390 RTC_FROM_HERE, signaling_thread_,
387 rtc::Bind(&VideoCapturerTrackSource::OnStateChange, this, capturer, 391 rtc::Bind(&VideoCapturerTrackSource::OnStateChange,
388 capture_state)); 392 rtc::Unretained(this), capturer, capture_state));
389 return; 393 return;
390 } 394 }
391 395
392 if (capturer == video_capturer_.get()) { 396 if (capturer == video_capturer_.get()) {
393 SetState(GetReadyState(capture_state)); 397 SetState(GetReadyState(capture_state));
394 } 398 }
395 } 399 }
396 400
397 } // namespace webrtc 401 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/pc/videocapturertracksource.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698