| 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 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 369 void VideoCapturerTrackSource::Stop() { | 369 void VideoCapturerTrackSource::Stop() { |
| 370 if (!started_) { | 370 if (!started_) { |
| 371 return; | 371 return; |
| 372 } | 372 } |
| 373 started_ = false; | 373 started_ = false; |
| 374 worker_thread_->Invoke<void>( | 374 worker_thread_->Invoke<void>( |
| 375 RTC_FROM_HERE, | 375 RTC_FROM_HERE, |
| 376 rtc::Bind(&cricket::VideoCapturer::Stop, video_capturer_.get())); | 376 rtc::Bind(&cricket::VideoCapturer::Stop, video_capturer_.get())); |
| 377 } | 377 } |
| 378 | 378 |
| 379 void VideoCapturerTrackSource::Restart() { | |
| 380 if (started_) { | |
| 381 return; | |
| 382 } | |
| 383 if (!worker_thread_->Invoke<bool>( | |
| 384 RTC_FROM_HERE, rtc::Bind(&cricket::VideoCapturer::StartCapturing, | |
| 385 video_capturer_.get(), format_))) { | |
| 386 SetState(kEnded); | |
| 387 return; | |
| 388 } | |
| 389 started_ = true; | |
| 390 } | |
| 391 | |
| 392 // OnStateChange listens to the cricket::VideoCapturer::SignalStateChange. | 379 // OnStateChange listens to the cricket::VideoCapturer::SignalStateChange. |
| 393 void VideoCapturerTrackSource::OnStateChange( | 380 void VideoCapturerTrackSource::OnStateChange( |
| 394 cricket::VideoCapturer* capturer, | 381 cricket::VideoCapturer* capturer, |
| 395 cricket::CaptureState capture_state) { | 382 cricket::CaptureState capture_state) { |
| 396 if (rtc::Thread::Current() != signaling_thread_) { | 383 if (rtc::Thread::Current() != signaling_thread_) { |
| 397 invoker_.AsyncInvoke<void>( | 384 invoker_.AsyncInvoke<void>( |
| 398 RTC_FROM_HERE, signaling_thread_, | 385 RTC_FROM_HERE, signaling_thread_, |
| 399 rtc::Bind(&VideoCapturerTrackSource::OnStateChange, this, capturer, | 386 rtc::Bind(&VideoCapturerTrackSource::OnStateChange, this, capturer, |
| 400 capture_state)); | 387 capture_state)); |
| 401 return; | 388 return; |
| 402 } | 389 } |
| 403 | 390 |
| 404 if (capturer == video_capturer_.get()) { | 391 if (capturer == video_capturer_.get()) { |
| 405 SetState(GetReadyState(capture_state)); | 392 SetState(GetReadyState(capture_state)); |
| 406 } | 393 } |
| 407 } | 394 } |
| 408 | 395 |
| 409 } // namespace webrtc | 396 } // namespace webrtc |
| OLD | NEW |