Bug 1523412: compare GetStreamCaps return values against S_OK. r=dminor

Differential Revision: https://phabricator.services.mozilla.com/D17872

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Nils Ohlmeier [:drno] 2019-01-29 21:21:33 +00:00
parent 107bda7f6a
commit 0d97afcc8d
2 changed files with 3 additions and 4 deletions

View File

@ -435,8 +435,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));
// Bug 1181265 - perhaps a helper dll returns success with nullptr
if (!FAILED(hr) && pmt) {
if (hr == S_OK) {
if (pmt->majortype == MEDIATYPE_Video &&
pmt->formattype == FORMAT_VideoInfo2) {
RTC_LOG(LS_INFO) << "Device support FORMAT_VideoInfo2";
@ -465,7 +464,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

@ -234,7 +234,7 @@ int32_t VideoCaptureDS::SetCameraOutput(const VideoCaptureCapability& capability
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) {