Chromium Code Reviews| Index: content/browser/renderer_host/media/in_process_video_capture_device_launcher.cc |
| diff --git a/content/browser/renderer_host/media/in_process_video_capture_device_launcher.cc b/content/browser/renderer_host/media/in_process_video_capture_device_launcher.cc |
| index f34de98ff20cb09a577c667e02273e03c2356080..9445624f1e38edfeed14f141ba3c2a60310091f3 100644 |
| --- a/content/browser/renderer_host/media/in_process_video_capture_device_launcher.cc |
| +++ b/content/browser/renderer_host/media/in_process_video_capture_device_launcher.cc |
| @@ -92,6 +92,11 @@ void InProcessVideoCaptureDeviceLauncher::LaunchDeviceAsync( |
| switch (stream_type) { |
| case MEDIA_DEVICE_VIDEO_CAPTURE: { |
| + if (!video_capture_system_) { |
| + callbacks->OnDeviceLaunchFailed(); |
|
emircan
2017/05/18 18:40:16
This becomes the second caller of OnDeviceLaunchFa
chfremer
2017/05/18 19:03:21
Good point. I realized that this code path is actu
|
| + base::ResetAndReturn(&done_cb).Run(); |
| + return; |
| + } |
| start_capture_closure = |
| base::Bind(&InProcessVideoCaptureDeviceLauncher:: |
| DoStartDeviceCaptureOnDeviceThread, |
| @@ -165,9 +170,11 @@ void InProcessVideoCaptureDeviceLauncher::OnDeviceStarted( |
| switch (state_copy) { |
| case State::DEVICE_START_IN_PROGRESS: |
| callbacks->OnDeviceLaunchFailed(); |
| + base::ResetAndReturn(&done_cb).Run(); |
| return; |
| case State::DEVICE_START_ABORTING: |
| callbacks->OnDeviceLaunchAborted(); |
| + base::ResetAndReturn(&done_cb).Run(); |
| return; |
| case State::READY_TO_LAUNCH: |
| NOTREACHED(); |
| @@ -181,16 +188,17 @@ void InProcessVideoCaptureDeviceLauncher::OnDeviceStarted( |
| switch (state_copy) { |
| case State::DEVICE_START_IN_PROGRESS: |
| callbacks->OnDeviceLaunched(std::move(launched_device)); |
| + base::ResetAndReturn(&done_cb).Run(); |
| return; |
| case State::DEVICE_START_ABORTING: |
| launched_device.reset(); |
| callbacks->OnDeviceLaunchAborted(); |
| + base::ResetAndReturn(&done_cb).Run(); |
| return; |
| case State::READY_TO_LAUNCH: |
| NOTREACHED(); |
| return; |
| } |
| - base::ResetAndReturn(&done_cb).Run(); |
| } |
| void InProcessVideoCaptureDeviceLauncher::DoStartDeviceCaptureOnDeviceThread( |
| @@ -200,6 +208,7 @@ void InProcessVideoCaptureDeviceLauncher::DoStartDeviceCaptureOnDeviceThread( |
| ReceiveDeviceCallback result_callback) { |
| SCOPED_UMA_HISTOGRAM_TIMER("Media.VideoCaptureManager.StartDeviceTime"); |
| DCHECK(device_task_runner_->BelongsToCurrentThread()); |
| + DCHECK(video_capture_system_); |
| std::unique_ptr<media::VideoCaptureDevice> video_capture_device = |
| video_capture_system_->CreateDevice(device_id); |