Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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.h" | 5 #include "content/renderer/media/media_stream_source.h" |
| 6 | 6 |
| 7 #include "base/callback_helpers.h" | 7 #include "base/callback_helpers.h" |
| 8 | 8 |
| 9 namespace content { | 9 namespace content { |
| 10 | 10 |
| 11 const char MediaStreamSource::kSourceId[] = "sourceId"; | 11 const char MediaStreamSource::kSourceId[] = "sourceId"; |
| 12 | 12 |
| 13 MediaStreamSource::MediaStreamSource() { | 13 MediaStreamSource::MediaStreamSource() { |
| 14 } | 14 } |
| 15 | 15 |
| 16 MediaStreamSource::~MediaStreamSource() { | 16 MediaStreamSource::~MediaStreamSource() { |
| 17 DCHECK(thread_checker_.CalledOnValidThread()); | 17 DCHECK(thread_checker_.CalledOnValidThread()); |
| 18 DCHECK(stop_callback_.is_null()); | 18 DCHECK(stop_callback_.is_null()); |
| 19 } | 19 } |
| 20 | 20 |
| 21 void MediaStreamSource::StopSource() { | 21 void MediaStreamSource::StopSource() { |
| 22 DCHECK(thread_checker_.CalledOnValidThread()); | 22 DCHECK(thread_checker_.CalledOnValidThread()); |
| 23 DoStopSource(); | 23 DoStopSource(); |
| 24 if (!stop_callback_.is_null()) | 24 if (!stop_callback_.is_null()) |
| 25 base::ResetAndReturn(&stop_callback_).Run(Owner()); | 25 base::ResetAndReturn(&stop_callback_).Run(Owner()); |
| 26 Owner().SetReadyState(blink::WebMediaStreamSource::kReadyStateEnded); | 26 Owner().SetReadyState(blink::WebMediaStreamSource::kReadyStateEnded); |
| 27 } | 27 } |
| 28 | 28 |
| 29 void MediaStreamSource::SetSourceMuted(bool is_muted) { | |
| 30 DCHECK(thread_checker_.CalledOnValidThread()); | |
| 31 // TODO(ossu): Check that we only go between Muted and Live, not from Ended. | |
|
ossu-chromium
2017/06/01 15:56:59
This looks like it's already be taken care of down
Max Morin
2017/06/02 09:56:04
Yes. Could you point out where this is taken care
ossu-chromium
2017/06/02 10:47:59
MediaStreamTrack::SourceChangedState() checks if t
Max Morin
2017/06/05 07:01:38
Right, feels better without a DCHECK.
| |
| 32 Owner().SetReadyState(is_muted | |
| 33 ? blink::WebMediaStreamSource::kReadyStateMuted | |
| 34 : blink::WebMediaStreamSource::kReadyStateLive); | |
| 35 } | |
| 36 | |
| 29 void MediaStreamSource::SetDeviceInfo(const StreamDeviceInfo& device_info) { | 37 void MediaStreamSource::SetDeviceInfo(const StreamDeviceInfo& device_info) { |
| 30 DCHECK(thread_checker_.CalledOnValidThread()); | 38 DCHECK(thread_checker_.CalledOnValidThread()); |
| 31 device_info_ = device_info; | 39 device_info_ = device_info; |
| 32 } | 40 } |
| 33 | 41 |
| 34 void MediaStreamSource::SetStopCallback( | 42 void MediaStreamSource::SetStopCallback( |
| 35 const SourceStoppedCallback& stop_callback) { | 43 const SourceStoppedCallback& stop_callback) { |
| 36 DCHECK(thread_checker_.CalledOnValidThread()); | 44 DCHECK(thread_checker_.CalledOnValidThread()); |
| 37 DCHECK(stop_callback_.is_null()); | 45 DCHECK(stop_callback_.is_null()); |
| 38 stop_callback_ = stop_callback; | 46 stop_callback_ = stop_callback; |
| 39 } | 47 } |
| 40 | 48 |
| 41 void MediaStreamSource::ResetSourceStoppedCallback() { | 49 void MediaStreamSource::ResetSourceStoppedCallback() { |
| 42 DCHECK(thread_checker_.CalledOnValidThread()); | 50 DCHECK(thread_checker_.CalledOnValidThread()); |
| 43 DCHECK(!stop_callback_.is_null()); | 51 DCHECK(!stop_callback_.is_null()); |
| 44 stop_callback_.Reset(); | 52 stop_callback_.Reset(); |
| 45 } | 53 } |
| 46 | 54 |
| 47 } // namespace content | 55 } // namespace content |
| OLD | NEW |