Chromium Code Reviews| Index: content/browser/renderer_host/media/video_capture_host.cc |
| diff --git a/content/browser/renderer_host/media/video_capture_host.cc b/content/browser/renderer_host/media/video_capture_host.cc |
| index 4c458f5d0da72417407e3eefd565bb9d37e7cc44..56351604a7ff86b5cd70763cfecc76ad53ea3c4a 100644 |
| --- a/content/browser/renderer_host/media/video_capture_host.cc |
| +++ b/content/browser/renderer_host/media/video_capture_host.cc |
| @@ -118,6 +118,21 @@ void VideoCaptureHost::OnEnded(VideoCaptureControllerID controller_id) { |
| controller_id)); |
| } |
| +// OnStarted can be forwarded directly, while OnError&OnEnded need to be |
| +// scheduled to the end of message queue to guarantee some other clearing jobs |
| +// are done before they are handled. |
| +void VideoCaptureHost::OnStarted(VideoCaptureControllerID controller_id) { |
|
chfremer
2017/02/16 01:00:50
Thanks. This piece of information is very useful t
braveyao
2017/02/17 20:37:21
Done.
|
| + DVLOG(1) << __func__; |
| + DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| + if (controllers_.find(controller_id) == controllers_.end()) |
| + return; |
| + |
| + if (base::ContainsKey(device_id_to_observer_map_, controller_id)) { |
| + device_id_to_observer_map_[controller_id]->OnStateChanged( |
| + mojom::VideoCaptureState::STARTED); |
| + } |
| +} |
| + |
| void VideoCaptureHost::Start(int32_t device_id, |
| int32_t session_id, |
| const media::VideoCaptureParams& params, |
| @@ -306,11 +321,6 @@ void VideoCaptureHost::OnControllerAdded( |
| return; |
| } |
| - if (base::ContainsKey(device_id_to_observer_map_, controller_id)) { |
| - device_id_to_observer_map_[device_id]->OnStateChanged( |
| - mojom::VideoCaptureState::STARTED); |
| - } |
| - |
| DCHECK(!it->second); |
| it->second = controller; |
| } |