Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(61)

Unified Diff: content/browser/renderer_host/media/in_process_video_capture_device_launcher.cc

Issue 2885653002: [Mojo Video Capture] Do not instantiate in-process VideoCaptureSystem when using service (Closed)
Patch Set: Remove |optional_| prefix Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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();
+ 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);

Powered by Google App Engine
This is Rietveld 408576698