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

Side by Side Diff: media/video/capture/win/video_capture_device_factory_win.cc

Issue 655293002: Win Video Capture: Check returned AM_MEDIA_TYPE pointer before comparing it. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« 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