| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/renderer/media/media_stream_source_observer.h" | 5 #include "content/renderer/media/media_stream_source_observer.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "content/renderer/media/media_stream_source_extra_data.h" | 8 #include "content/renderer/media/media_stream_source_extra_data.h" |
| 9 | 9 |
| 10 namespace content { | 10 namespace content { |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 | 26 |
| 27 void MediaStreamSourceObserver::OnChanged() { | 27 void MediaStreamSourceObserver::OnChanged() { |
| 28 DCHECK(CalledOnValidThread()); | 28 DCHECK(CalledOnValidThread()); |
| 29 // There should be no more notification after kEnded. | 29 // There should be no more notification after kEnded. |
| 30 DCHECK(webrtc_source_.get() != NULL); | 30 DCHECK(webrtc_source_.get() != NULL); |
| 31 | 31 |
| 32 webrtc::MediaSourceInterface::SourceState state = webrtc_source_->state(); | 32 webrtc::MediaSourceInterface::SourceState state = webrtc_source_->state(); |
| 33 if (state == state_) | 33 if (state == state_) |
| 34 return; | 34 return; |
| 35 state_ = state; | 35 state_ = state; |
| 36 WebKit::WebMediaStreamSource webkit_source(extra_data_->owner()); | 36 blink::WebMediaStreamSource webkit_source(extra_data_->owner()); |
| 37 | 37 |
| 38 switch (state) { | 38 switch (state) { |
| 39 case webrtc::MediaSourceInterface::kInitializing: | 39 case webrtc::MediaSourceInterface::kInitializing: |
| 40 // Ignore the kInitializing state since there is no match in | 40 // Ignore the kInitializing state since there is no match in |
| 41 // WebMediaStreamSource::ReadyState. | 41 // WebMediaStreamSource::ReadyState. |
| 42 break; | 42 break; |
| 43 case webrtc::MediaSourceInterface::kLive: | 43 case webrtc::MediaSourceInterface::kLive: |
| 44 webkit_source.setReadyState( | 44 webkit_source.setReadyState( |
| 45 WebKit::WebMediaStreamSource::ReadyStateLive); | 45 blink::WebMediaStreamSource::ReadyStateLive); |
| 46 break; | 46 break; |
| 47 case webrtc::MediaSourceInterface::kMuted: | 47 case webrtc::MediaSourceInterface::kMuted: |
| 48 webkit_source.setReadyState( | 48 webkit_source.setReadyState( |
| 49 WebKit::WebMediaStreamSource::ReadyStateMuted); | 49 blink::WebMediaStreamSource::ReadyStateMuted); |
| 50 break; | 50 break; |
| 51 case webrtc::MediaSourceInterface::kEnded: | 51 case webrtc::MediaSourceInterface::kEnded: |
| 52 webkit_source.setReadyState( | 52 webkit_source.setReadyState( |
| 53 WebKit::WebMediaStreamSource::ReadyStateEnded); | 53 blink::WebMediaStreamSource::ReadyStateEnded); |
| 54 webrtc_source_->UnregisterObserver(this); | 54 webrtc_source_->UnregisterObserver(this); |
| 55 webrtc_source_ = NULL; | 55 webrtc_source_ = NULL; |
| 56 break; | 56 break; |
| 57 default: | 57 default: |
| 58 NOTREACHED(); | 58 NOTREACHED(); |
| 59 break; | 59 break; |
| 60 } | 60 } |
| 61 } | 61 } |
| 62 | 62 |
| 63 } // namespace content | 63 } // namespace content |
| OLD | NEW |