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 <dminor@webrtc.org>
Reviewed-by: Per Kjellander <perkj@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#26539}
This commit is contained in:
Dan Minor 2019-02-04 12:47:48 -05:00 committed by Commit Bot
parent bfc9911661
commit e22498cc3e
2 changed files with 3 additions and 3 deletions

View File

@ -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<BYTE*>(&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<BYTE*>(&caps));
if (FAILED(hr)) {
if (hr != S_OK) {
RTC_LOG(LS_INFO) << "Failed to GetStreamCaps";
RELEASE_AND_CLEAR(videoControlConfig);
RELEASE_AND_CLEAR(streamConfig);

View File

@ -220,7 +220,7 @@ int32_t VideoCaptureDS::SetCameraOutput(
bool isDVCamera = false;
hr = streamConfig->GetStreamCaps(windowsCapability.directShowCapabilityIndex,
&pmt, reinterpret_cast<BYTE*>(&caps));
if (!FAILED(hr)) {
if (hr == S_OK) {
if (pmt->formattype == FORMAT_VideoInfo2) {
VIDEOINFOHEADER2* h = reinterpret_cast<VIDEOINFOHEADER2*>(pmt->pbFormat);
if (capability.maxFPS > 0 && windowsCapability.supportFrameRateControl) {