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..16e96bc03849cb6e907dc8ef9e1163c55249ac8f 100644 |
| --- a/content/browser/renderer_host/media/video_capture_host.cc |
| +++ b/content/browser/renderer_host/media/video_capture_host.cc |
| @@ -118,6 +118,15 @@ void VideoCaptureHost::OnEnded(VideoCaptureControllerID controller_id) { |
| controller_id)); |
| } |
| +void VideoCaptureHost::OnStarted(VideoCaptureControllerID controller_id) { |
| + DVLOG(1) << __func__; |
| + DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| + BrowserThread::PostTask( |
| + BrowserThread::IO, FROM_HERE, |
|
chfremer
2017/02/09 23:34:52
Why is it necessary to schedule this to the end of
braveyao
2017/02/14 01:05:49
The EventHandler methods used to call "PostTask" b
chfremer
2017/02/14 19:21:22
Thanks for the reference to that CL. It looks like
braveyao
2017/02/15 21:47:15
Done.
Thanks so much for pushing on this!
In the
|
| + base::Bind(&VideoCaptureHost::DoStarted, weak_factory_.GetWeakPtr(), |
| + controller_id)); |
| +} |
| + |
| void VideoCaptureHost::Start(int32_t device_id, |
| int32_t session_id, |
| const media::VideoCaptureParams& params, |
| @@ -283,6 +292,18 @@ void VideoCaptureHost::DoEnded(VideoCaptureControllerID controller_id) { |
| DeleteVideoCaptureController(controller_id, false); |
| } |
| +void VideoCaptureHost::DoStarted(VideoCaptureControllerID controller_id) { |
| + 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::OnControllerAdded( |
| int device_id, |
| const base::WeakPtr<VideoCaptureController>& controller) { |
| @@ -306,11 +327,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; |
| } |