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

Unified Diff: media/video/capture/win/video_capture_device_win.cc

Issue 482413002: Fix some error states in VideoCaptureDeviceWin::AllocateAndStart. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/video/capture/win/video_capture_device_win.cc
diff --git a/media/video/capture/win/video_capture_device_win.cc b/media/video/capture/win/video_capture_device_win.cc
index 29ccf5afcdb8e753d1aa24757387f9ea8d42e6a2..0a3a2f5fe5281de6a813516b3be9f47eddf6f505 100644
--- a/media/video/capture/win/video_capture_device_win.cc
+++ b/media/video/capture/win/video_capture_device_win.cc
@@ -314,7 +314,9 @@ void VideoCaptureDeviceWin::AllocateAndStart(
// Get the windows capability from the capture device.
hr = stream_config->GetStreamCaps(
found_capability.stream_index, media_type.Receive(), caps.get());
- if (SUCCEEDED(hr)) {
+ if (FAILED(hr)) {
mcasas 2014/08/19 08:23:36 Hmm, I might be overzealous but there's this ratio
Henrik Grunell 2014/08/19 08:50:53 Done.
+ SetErrorState("Failed to get capture device capabilities");
Henrik Grunell 2014/08/19 08:50:53 Note my previous question (repeating here): Shoul
mcasas 2014/08/19 11:20:32 IMHO we should add a return here for coherence rea
Henrik Grunell 2014/08/19 11:39:47 Added in both places. I would though say it shoul
+ } else {
if (media_type->formattype == FORMAT_VideoInfo) {
VIDEOINFOHEADER* h =
reinterpret_cast<VIDEOINFOHEADER*>(media_type->pbFormat);
@@ -325,11 +327,10 @@ void VideoCaptureDeviceWin::AllocateAndStart(
sink_filter_->SetRequestedMediaFormat(format);
// Order the capture device to use this format.
hr = stream_config->SetFormat(media_type.get());
+ if (FAILED(hr))
+ SetErrorState("Failed to set capture device output format");
mcasas 2014/08/19 08:23:36 Suggestion: Use SystemErrorCodeToString() [0] to p
Henrik Grunell 2014/08/19 08:50:53 Are you sure that works for this case? I'd prefer
mcasas 2014/08/19 11:20:32 The method FormatMessageA() underlying SystemErro
Henrik Grunell 2014/08/19 11:39:47 OK.
}
- if (FAILED(hr))
- SetErrorState("Failed to set capture device output format");
-
if (format.pixel_format == PIXEL_FORMAT_MJPEG && !mjpg_filter_.get()) {
// Create MJPG filter if we need it.
hr = mjpg_filter_.CreateInstance(CLSID_MjpegDec, NULL, CLSCTX_INPROC);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698