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

Unified Diff: media/video/capture/file_video_capture_device_factory.cc

Issue 1017633004: FileVideoCaptureDevice: better error mgmt if !File.IsValid() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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 | « media/video/capture/file_video_capture_device.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/video/capture/file_video_capture_device_factory.cc
diff --git a/media/video/capture/file_video_capture_device_factory.cc b/media/video/capture/file_video_capture_device_factory.cc
index 4749c2f8a976b3d9bd9db7fdad57f8466a2e4863..b25a252239dd4cf234632257fd27d0e51dcf522a 100644
--- a/media/video/capture/file_video_capture_device_factory.cc
+++ b/media/video/capture/file_video_capture_device_factory.cc
@@ -40,7 +40,7 @@ void FileVideoCaptureDeviceFactory::GetDeviceNames(
VideoCaptureDevice::Names* const device_names) {
DCHECK(thread_checker_.CalledOnValidThread());
DCHECK(device_names->empty());
- base::FilePath command_line_file_path = GetFilePathFromCommandLine();
+ const base::FilePath command_line_file_path = GetFilePathFromCommandLine();
#if defined(OS_WIN)
device_names->push_back(VideoCaptureDevice::Name(
base::SysWideToUTF8(command_line_file_path.value()),
@@ -64,6 +64,8 @@ void FileVideoCaptureDeviceFactory::GetDeviceSupportedFormats(
DCHECK(thread_checker_.CalledOnValidThread());
base::File file =
FileVideoCaptureDevice::OpenFileForRead(GetFilePathFromCommandLine());
+ if (!file.IsValid())
+ return;
VideoCaptureFormat capture_format;
FileVideoCaptureDevice::ParseFileAndExtractVideoFormat(&file,
&capture_format);
« no previous file with comments | « media/video/capture/file_video_capture_device.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698