From 37aeb91d54baddd7dbad7cb4832cb17584bf09e9 Mon Sep 17 00:00:00 2001 From: Seungha Yang Date: Tue, 21 Jul 2020 01:05:47 +0900 Subject: [PATCH] mfvideosrc: Don't error out when if we've found supported format While retrieving supported formats by device, the last return might not be S_OK in case that it's not supported one by us (e.g., H264, JPEG or so). But if we've found at least one supported raw video format, we can keep going on. Part-of: --- sys/mediafoundation/mediacapturewrapper.cpp | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/sys/mediafoundation/mediacapturewrapper.cpp b/sys/mediafoundation/mediacapturewrapper.cpp index 971821ce31..ba045936e2 100644 --- a/sys/mediafoundation/mediacapturewrapper.cpp +++ b/sys/mediafoundation/mediacapturewrapper.cpp @@ -260,38 +260,38 @@ GstWinRTMediaFrameSourceGroup::Fill hr = source_group->get_Id(hstr_id.GetAddressOf()); if (!gst_mf_result(hr)) - goto done; + goto error; id_ = convert_hstring_to_string (&hstr_id); if (id_.empty()) { GST_WARNING ("Emptry source group id"); hr = E_FAIL; - goto done; + goto error; } hr = source_group->get_DisplayName (hstr_display_name.GetAddressOf()); if (!gst_mf_result (hr)) - goto done; + goto error; display_name_ = convert_hstring_to_string (&hstr_display_name); if (display_name_.empty()) { GST_WARNING ("Empty display name"); hr = E_FAIL; - goto done; + goto error; } hr = source_group->get_SourceInfos (&info_list); if (!gst_mf_result (hr)) - goto done; + goto error; hr = info_list->get_Size (&count); if (!gst_mf_result (hr)) - goto done; + goto error; if (count == 0) { GST_WARNING ("No available source info"); hr = E_FAIL; - goto done; + goto error; } source_group_ = source_group; @@ -370,15 +370,16 @@ GstWinRTMediaFrameSourceGroup::Fill } } -done: if (source_list_.empty()) { GST_WARNING ("No usable source infos"); hr = E_FAIL; + goto error; } - if (!gst_mf_result(hr)) - Release(); + return S_OK; +error: + Release (); return hr; }