Chromium Code Reviews| 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..60d894c9d1a4b50b262cda7298fb84a0ad6c0bb0 100644 |
| --- a/media/video/capture/win/video_capture_device_win.cc |
| +++ b/media/video/capture/win/video_capture_device_win.cc |
| @@ -312,9 +312,14 @@ void VideoCaptureDeviceWin::AllocateAndStart( |
| ScopedMediaType media_type; |
| // Get the windows capability from the capture device. |
| + // GetStreamCaps can return S_FALSE which we consider an error. Therefore the |
| + // FAILED macro can't be used. |
| hr = stream_config->GetStreamCaps( |
| found_capability.stream_index, media_type.Receive(), caps.get()); |
| - if (SUCCEEDED(hr)) { |
| + if (hr != S_OK) { |
| + SetErrorState("Failed to get capture device capabilities"); |
| + return; |
| + } else { |
| if (media_type->formattype == FORMAT_VideoInfo) { |
| VIDEOINFOHEADER* h = |
| reinterpret_cast<VIDEOINFOHEADER*>(media_type->pbFormat); |
| @@ -325,11 +330,13 @@ 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)) { |
| + // TODO(mcasas): Log the error. http://crbug.com/405016. |
|
mcasas
2014/08/19 12:05:23
nit: s/mcasas/grunell/
Henrik Grunell
2014/08/19 12:15:07
Fair enough. Done.
|
| + SetErrorState("Failed to set capture device output format"); |
| + return; |
| + } |
| } |
| - 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); |