webrtc_sink: Add more conditions to skip hw plugin 58/251258/2
authorSangchul Lee <sc11.lee@samsung.com>
Tue, 12 Jan 2021 04:27:28 +0000 (13:27 +0900)
committerSangchul Lee <sc11.lee@samsung.com>
Mon, 18 Jan 2021 03:34:37 +0000 (12:34 +0900)
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 <sc11.lee@samsung.com>
packaging/capi-media-webrtc.spec
src/webrtc_sink.c

index 14ce3d42551c7df3cc52193268b48e92dbf972f6..25716f06cfdccb49e62ce40a5836c0a67014a3b2 100644 (file)
@@ -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
index 0522362740e6d1626794082371d75578836eede3..26486136889b02c838e0e260eb96690d118a0706 100644 (file)
@@ -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);