From e22498cc3e0618f83bbe0e169507ad51b1769b2b Mon Sep 17 00:00:00 2001 From: Dan Minor Date: Mon, 4 Feb 2019 12:47:48 -0500 Subject: [PATCH] Compare GetStreamCaps against S_OK GetStreamCaps can return S_FALSE, which is not caught by FAILED(). Instead it is necessary to compare for equality with S_OK. Bug: webrtc:10267 Change-Id: I4113ef5544f830f5cb5f09f143dff43129993d3d Reviewed-on: https://webrtc-review.googlesource.com/c/120644 Commit-Queue: Dan Minor Reviewed-by: Per Kjellander Cr-Commit-Position: refs/heads/master@{#26539} --- modules/video_capture/windows/device_info_ds.cc | 4 ++-- modules/video_capture/windows/video_capture_ds.cc | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/video_capture/windows/device_info_ds.cc b/modules/video_capture/windows/device_info_ds.cc index 935d12562d..3c25f76075 100644 --- a/modules/video_capture/windows/device_info_ds.cc +++ b/modules/video_capture/windows/device_info_ds.cc @@ -370,7 +370,7 @@ int32_t DeviceInfoDS::CreateCapabilityMap(const char* deviceUniqueIdUTF8) GUID preferedVideoFormat = FORMAT_VideoInfo; for (int32_t tmp = 0; tmp < count; ++tmp) { hr = streamConfig->GetStreamCaps(tmp, &pmt, reinterpret_cast(&caps)); - if (!FAILED(hr)) { + if (hr == S_OK) { if (pmt->majortype == MEDIATYPE_Video && pmt->formattype == FORMAT_VideoInfo2) { RTC_LOG(LS_INFO) << "Device support FORMAT_VideoInfo2"; @@ -399,7 +399,7 @@ int32_t DeviceInfoDS::CreateCapabilityMap(const char* deviceUniqueIdUTF8) for (int32_t tmp = 0; tmp < count; ++tmp) { hr = streamConfig->GetStreamCaps(tmp, &pmt, reinterpret_cast(&caps)); - if (FAILED(hr)) { + if (hr != S_OK) { RTC_LOG(LS_INFO) << "Failed to GetStreamCaps"; RELEASE_AND_CLEAR(videoControlConfig); RELEASE_AND_CLEAR(streamConfig); diff --git a/modules/video_capture/windows/video_capture_ds.cc b/modules/video_capture/windows/video_capture_ds.cc index ea377a3b05..e56dee81e5 100644 --- a/modules/video_capture/windows/video_capture_ds.cc +++ b/modules/video_capture/windows/video_capture_ds.cc @@ -220,7 +220,7 @@ int32_t VideoCaptureDS::SetCameraOutput( bool isDVCamera = false; hr = streamConfig->GetStreamCaps(windowsCapability.directShowCapabilityIndex, &pmt, reinterpret_cast(&caps)); - if (!FAILED(hr)) { + if (hr == S_OK) { if (pmt->formattype == FORMAT_VideoInfo2) { VIDEOINFOHEADER2* h = reinterpret_cast(pmt->pbFormat); if (capability.maxFPS > 0 && windowsCapability.supportFrameRateControl) {