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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 }; | 48 }; |
49 | 49 |
50 MediaSourceInterface::SourceState | 50 MediaSourceInterface::SourceState |
51 GetReadyState(cricket::CaptureState state) { | 51 GetReadyState(cricket::CaptureState state) { |
52 switch (state) { | 52 switch (state) { |
53 case cricket::CS_STARTING: | 53 case cricket::CS_STARTING: |
54 return MediaSourceInterface::kInitializing; | 54 return MediaSourceInterface::kInitializing; |
55 case cricket::CS_RUNNING: | 55 case cricket::CS_RUNNING: |
56 return MediaSourceInterface::kLive; | 56 return MediaSourceInterface::kLive; |
57 case cricket::CS_FAILED: | 57 case cricket::CS_FAILED: |
58 case cricket::CS_NO_DEVICE: | |
59 case cricket::CS_STOPPED: | 58 case cricket::CS_STOPPED: |
60 return MediaSourceInterface::kEnded; | 59 return MediaSourceInterface::kEnded; |
61 case cricket::CS_PAUSED: | 60 case cricket::CS_PAUSED: |
62 return MediaSourceInterface::kMuted; | 61 return MediaSourceInterface::kMuted; |
63 default: | 62 default: |
64 ASSERT(false && "GetReadyState unknown state"); | 63 ASSERT(false && "GetReadyState unknown state"); |
65 } | 64 } |
66 return MediaSourceInterface::kEnded; | 65 return MediaSourceInterface::kEnded; |
67 } | 66 } |
68 | 67 |
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
396 void VideoSource::RemoveSink( | 395 void VideoSource::RemoveSink( |
397 rtc::VideoSinkInterface<cricket::VideoFrame>* output) { | 396 rtc::VideoSinkInterface<cricket::VideoFrame>* output) { |
398 sinks_.remove(output); | 397 sinks_.remove(output); |
399 channel_manager_->RemoveVideoSink(video_capturer_.get(), output); | 398 channel_manager_->RemoveVideoSink(video_capturer_.get(), output); |
400 } | 399 } |
401 | 400 |
402 // OnStateChange listens to the ChannelManager::SignalVideoCaptureStateChange. | 401 // OnStateChange listens to the ChannelManager::SignalVideoCaptureStateChange. |
403 // This signal is triggered for all video capturers. Not only the one we are | 402 // This signal is triggered for all video capturers. Not only the one we are |
404 // interested in. | 403 // interested in. |
405 void VideoSource::OnStateChange(cricket::VideoCapturer* capturer, | 404 void VideoSource::OnStateChange(cricket::VideoCapturer* capturer, |
406 cricket::CaptureState capture_state) { | 405 cricket::CaptureState capture_state) { |
407 if (capturer == video_capturer_.get()) { | 406 if (capturer == video_capturer_.get()) { |
408 SetState(GetReadyState(capture_state)); | 407 SetState(GetReadyState(capture_state)); |
409 } | 408 } |
410 } | 409 } |
411 | 410 |
412 void VideoSource::SetState(SourceState new_state) { | 411 void VideoSource::SetState(SourceState new_state) { |
413 // TODO(hbos): Temporarily disabled VERIFY due to webrtc:4776. | 412 // TODO(hbos): Temporarily disabled VERIFY due to webrtc:4776. |
414 // if (VERIFY(state_ != new_state)) { | 413 // if (VERIFY(state_ != new_state)) { |
415 if (state_ != new_state) { | 414 if (state_ != new_state) { |
416 state_ = new_state; | 415 state_ = new_state; |
417 FireOnChanged(); | 416 FireOnChanged(); |
418 } | 417 } |
419 } | 418 } |
420 | 419 |
421 } // namespace webrtc | 420 } // namespace webrtc |
OLD | NEW |