From: Sangchul Lee Date: Tue, 12 Jan 2021 04:27:28 +0000 (+0900) Subject: webrtc_sink: Add more conditions to skip hw plugin X-Git-Tag: submit/tizen/20210729.023123~160 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ff909b8fff6b479b129be20e2811325a1e5a1f06;p=platform%2Fcore%2Fapi%2Fwebrtc.git webrtc_sink: Add more conditions to skip hw plugin Ideally, klass metadata of hw element has the suffix of 'Hardware'. But many cases are found without the suffix. This patch responds to that case. [Version] 0.1.81 [Issue Type] Improvement Change-Id: Ib1d6a2863f1afac0fff7af7ff803c22b98f213d3 Signed-off-by: Sangchul Lee --- diff --git a/packaging/capi-media-webrtc.spec b/packaging/capi-media-webrtc.spec index 14ce3d42..25716f06 100644 --- a/packaging/capi-media-webrtc.spec +++ b/packaging/capi-media-webrtc.spec @@ -1,6 +1,6 @@ Name: capi-media-webrtc Summary: A WebRTC library in Tizen Native API -Version: 0.1.80 +Version: 0.1.81 Release: 0 Group: Multimedia/API License: Apache-2.0 diff --git a/src/webrtc_sink.c b/src/webrtc_sink.c index 05223627..26486136 100644 --- a/src/webrtc_sink.c +++ b/src/webrtc_sink.c @@ -316,6 +316,20 @@ static void __decodebin_pad_added_cb(GstElement *decodebin, GstPad *new_pad, gpo GENERATE_DOT(webrtc, "%s", GST_ELEMENT_NAME(decodebin)); } +static bool __is_factory_name_for_hw(gchar *factory_name) +{ + RET_VAL_IF(factory_name == NULL, FALSE, "factory_name is NULL"); + + /* more can be added later on */ + if (g_str_has_prefix(factory_name, "sprd") || + g_str_has_prefix(factory_name, "omx")) { + LOG_DEBUG("factory_name[%s]", factory_name); + return true; + } + + return false; +} + static int __decodebin_autoplug_select_cb(GstElement *decodebin, GstPad *pad, GstCaps *caps, GstElementFactory *factory, gpointer user_data) { /* NOTE : Similar enum is defined with GstAutoplugSelectResult in gstplay-enum.h but not exposed */ @@ -336,13 +350,15 @@ static int __decodebin_autoplug_select_cb(GstElement *decodebin, GstPad *pad, Gs LOG_INFO("factory [name:%s, klass:%s]", factory_name, klass); - if (g_strrstr(klass, "Decoder/Audio/Hardware")) { + if (g_strrstr(klass, "Decoder/Audio/Hardware") || + (g_strrstr(klass, "Decoder/Audio") && __is_factory_name_for_hw(factory_name))) { str_arr = webrtc->ini.rendering_sink.a_hw_decoder_elements; if (str_arr == NULL || !g_strv_contains((const gchar * const *)str_arr, factory_name)) { LOG_DEBUG("this audio hw decoder element[%s] is not specified in ini file, skip it", factory_name); return GST_AUTOPLUG_SELECT_SKIP; } - } else if (g_strrstr(klass, "Decoder/Video/Hardware")) { + } else if (g_strrstr(klass, "Decoder/Video/Hardware") || + (g_strrstr(klass, "Decoder/Video") && __is_factory_name_for_hw(factory_name))) { str_arr = webrtc->ini.rendering_sink.v_hw_decoder_elements; if (str_arr == NULL || !g_strv_contains((const gchar * const *)str_arr, factory_name)) { LOG_DEBUG("this video hw decoder element[%s] is not specified in ini file, skip it", factory_name);