OLD | NEW |
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 Loading... |
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 |
OLD | NEW |