OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "media/video/capture/win/video_capture_device_factory_win.h" | 5 #include "media/video/capture/win/video_capture_device_factory_win.h" |
6 | 6 |
7 #include <mfapi.h> | 7 #include <mfapi.h> |
8 #include <mferror.h> | 8 #include <mferror.h> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
268 << logging::SystemErrorCodeToString(hr); | 268 << logging::SystemErrorCodeToString(hr); |
269 return; | 269 return; |
270 } | 270 } |
271 | 271 |
272 scoped_ptr<BYTE[]> caps(new BYTE[size]); | 272 scoped_ptr<BYTE[]> caps(new BYTE[size]); |
273 for (int i = 0; i < count; ++i) { | 273 for (int i = 0; i < count; ++i) { |
274 VideoCaptureDeviceWin::ScopedMediaType media_type; | 274 VideoCaptureDeviceWin::ScopedMediaType media_type; |
275 hr = stream_config->GetStreamCaps(i, media_type.Receive(), caps.get()); | 275 hr = stream_config->GetStreamCaps(i, media_type.Receive(), caps.get()); |
276 // GetStreamCaps() may return S_FALSE, so don't use FAILED() or SUCCEED() | 276 // GetStreamCaps() may return S_FALSE, so don't use FAILED() or SUCCEED() |
277 // macros here since they'll trigger incorrectly. | 277 // macros here since they'll trigger incorrectly. |
278 if (hr != S_OK) { | 278 if (hr != S_OK || !media_type.get()) { |
tommi (sloooow) - chröme
2014/10/15 17:23:30
FYI - I checked the bug and just to confirm - this
| |
279 DLOG(ERROR) << "GetStreamCaps failed: " | 279 DLOG(ERROR) << "GetStreamCaps failed: " |
280 << logging::SystemErrorCodeToString(hr); | 280 << logging::SystemErrorCodeToString(hr); |
281 return; | 281 return; |
282 } | 282 } |
283 | 283 |
284 if (media_type->majortype == MEDIATYPE_Video && | 284 if (media_type->majortype == MEDIATYPE_Video && |
285 media_type->formattype == FORMAT_VideoInfo) { | 285 media_type->formattype == FORMAT_VideoInfo) { |
286 VideoCaptureFormat format; | 286 VideoCaptureFormat format; |
287 format.pixel_format = | 287 format.pixel_format = |
288 VideoCaptureDeviceWin::TranslateMediaSubtypeToPixelFormat( | 288 VideoCaptureDeviceWin::TranslateMediaSubtypeToPixelFormat( |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
453 const Name& device, | 453 const Name& device, |
454 VideoCaptureFormats* formats) { | 454 VideoCaptureFormats* formats) { |
455 DCHECK(thread_checker_.CalledOnValidThread()); | 455 DCHECK(thread_checker_.CalledOnValidThread()); |
456 if (use_media_foundation_) | 456 if (use_media_foundation_) |
457 GetDeviceSupportedFormatsMediaFoundation(device, formats); | 457 GetDeviceSupportedFormatsMediaFoundation(device, formats); |
458 else | 458 else |
459 GetDeviceSupportedFormatsDirectShow(device, formats); | 459 GetDeviceSupportedFormatsDirectShow(device, formats); |
460 } | 460 } |
461 | 461 |
462 } // namespace media | 462 } // namespace media |
OLD | NEW |