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

Unified Diff: media/video/capture/file_video_capture_device.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 | « no previous file | media/video/capture/file_video_capture_device_factory.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/video/capture/file_video_capture_device.cc
diff --git a/media/video/capture/file_video_capture_device.cc b/media/video/capture/file_video_capture_device.cc
index 4e240469acf93b1b58e7f8943635849a9c430fe3..bdcc66f03f76a1802662a766bb60212f4f852970 100644
--- a/media/video/capture/file_video_capture_device.cc
+++ b/media/video/capture/file_video_capture_device.cc
@@ -124,9 +124,9 @@ int64 FileVideoCaptureDevice::ParseFileAndExtractVideoFormat(
base::File FileVideoCaptureDevice::OpenFileForRead(
const base::FilePath& file_path) {
base::File file(file_path, base::File::FLAG_OPEN | base::File::FLAG_READ);
- DVLOG_IF(1, file.IsValid()) << file_path.value() << ", error: "
- << base::File::ErrorToString(file.error_details());
- CHECK(file.IsValid());
+ DLOG_IF(ERROR, file.IsValid())
+ << file_path.value()
+ << ", error: " << base::File::ErrorToString(file.error_details());
return file.Pass();
}
@@ -186,6 +186,10 @@ void FileVideoCaptureDevice::OnAllocateAndStart(
// Open the file and parse the header. Get frame size and format.
DCHECK(!file_.IsValid());
file_ = OpenFileForRead(file_path_);
+ if (!file_.IsValid()) {
+ client_->OnError("Could not open Video file");
+ return;
+ }
first_frame_byte_index_ =
ParseFileAndExtractVideoFormat(&file_, &capture_format_);
current_byte_index_ = first_frame_byte_index_;
« no previous file with comments | « no previous file | media/video/capture/file_video_capture_device_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698