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

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: Use SEQUENCE_CHECKER macros and Rebase to May 19th 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
« no previous file with comments | « no previous file | content/browser/renderer_host/media/in_process_video_capture_provider.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..d1675476653e8eb774e711f4d28f14227a0cb2b0 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,13 @@ void InProcessVideoCaptureDeviceLauncher::LaunchDeviceAsync(
switch (stream_type) {
case MEDIA_DEVICE_VIDEO_CAPTURE: {
+ if (!video_capture_system_) {
+ // Clients who create an instance of |this| without providing a
+ // VideoCaptureSystem instance are expected to know that
+ // MEDIA_DEVICE_VIDEO_CAPTURE is not supported in this case.
+ NOTREACHED();
+ return;
+ }
start_capture_closure =
base::Bind(&InProcessVideoCaptureDeviceLauncher::
DoStartDeviceCaptureOnDeviceThread,
@@ -165,9 +172,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 +190,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 +210,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);
« no previous file with comments | « no previous file | content/browser/renderer_host/media/in_process_video_capture_provider.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698