Add logic to skip h/w video decoder element in __ms_feature_node_filter() 67/240467/4
authorSangchul Lee <sc11.lee@samsung.com>
Thu, 6 Aug 2020 11:26:59 +0000 (20:26 +0900)
committerSangchul Lee <sc11.lee@samsung.com>
Fri, 7 Aug 2020 06:35:05 +0000 (15:35 +0900)
It relates to the element in video_decoder node.
__need_to_skip_hw_video_decoder_klass() is also added.

[Version] 0.1.107
[Issue Type] Improvement

Change-Id: I37b8746153081b0361308a9697b0bf487e109350
Signed-off-by: Sangchul Lee <sc11.lee@samsung.com>
packaging/capi-media-streamer.spec
src/media_streamer_gst.c

index 568720c..8beba1a 100644 (file)
@@ -1,6 +1,6 @@
 Name:       capi-media-streamer
 Summary:    A Media Streamer API
-Version:    0.1.106
+Version:    0.1.107
 Release:    0
 Group:      Multimedia/API
 License:    Apache-2.0
index aa65883..3513db9 100644 (file)
@@ -627,6 +627,29 @@ GstElement *ms_combine_next_element(GstElement *previous_element, GstPad *prev_e
        return found_element;
 }
 
+static gboolean __need_to_skip_hw_video_decoder_klass(const gchar *klass)
+{
+       gchar **zerocopy_node_names = NULL;
+       gboolean found = false;
+
+       if (g_strcmp0(klass, "Codec/Decoder/Video/Hardware") == 0) {
+               if (!ms_ini_get_boolean("general:use zerocopy", DEFAULT_USE_ZEROCOPY)) {
+                       ms_debug("Skipping [%s] because use zerocopy is false", MEDIASTREAMER_DECODEBIN_TYPE_DECODER);
+                       return TRUE;
+               }
+               ms_ini_read_list("general:zerocopy node names", &zerocopy_node_names);
+               found = (zerocopy_node_names && g_strv_contains((const gchar * const *)zerocopy_node_names, MEDIASTREAMER_DECODEBIN_TYPE_DECODER));
+               g_strfreev(zerocopy_node_names);
+               if (!found) {
+                       ms_debug("Skipping [%s] which is not specified in zerocopy node names", MEDIASTREAMER_DECODEBIN_TYPE_DECODER);
+                       return TRUE;
+               }
+               ms_debug("[%s] can be used", MEDIASTREAMER_DECODEBIN_TYPE_DECODER);
+       }
+
+       return FALSE;
+}
+
 static gint __decodebin_autoplug_select_cb(GstElement *bin, GstPad *pad, GstCaps *caps, GstElementFactory *factory, gpointer data)
 {
        /* NOTE : GstAutoplugSelectResult is defined in gstplay-enum.h but not exposed */
@@ -661,21 +684,9 @@ static gint __decodebin_autoplug_select_cb(GstElement *bin, GstPad *pad, GstCaps
                }
        }
 
-       if (g_strcmp0(klass, "Codec/Decoder/Video/Hardware") == 0) {
-               gchar **zerocopy_node_names = NULL;
-               gboolean found = false;
-               if (!ms_ini_get_boolean("general:use zerocopy", DEFAULT_USE_ZEROCOPY)) {
-                       ms_debug("Skipping [%s] because use zerocopy is false", factory_name);
-                       return GST_AUTOPLUG_SELECT_SKIP;
-               }
-               ms_ini_read_list("general:zerocopy node names", &zerocopy_node_names);
-               found = (zerocopy_node_names && g_strv_contains((const gchar * const *)zerocopy_node_names, MEDIASTREAMER_DECODEBIN_TYPE_DECODER));
-               g_strfreev(zerocopy_node_names);
-               if (!found) {
-                       ms_debug("Skipping [%s] which is not specified in zerocopy node names", factory_name);
-                       return GST_AUTOPLUG_SELECT_SKIP;
-               }
-               ms_debug("[%s] can be used", factory_name);
+       if (__need_to_skip_hw_video_decoder_klass(klass)) {
+               ms_debug("Skipping [%s]", factory_name);
+               return GST_AUTOPLUG_SELECT_SKIP;
        }
 
        if (ms_streamer->ini.resource_required_elem_names) {
@@ -1249,6 +1260,11 @@ static gboolean __ms_feature_node_filter(GstPluginFeature *feature, gpointer dat
                                }
                        }
 
+                       if (__need_to_skip_hw_video_decoder_klass(factory_klass)) {
+                               ms_debug("Skipping [%s]", GST_OBJECT_NAME(factory));
+                               return FALSE;
+                       }
+
                        ms_info("[INFO] Found compatible factory [%s] for klass [%s]",
                                GST_OBJECT_NAME(factory), factory_klass);
                        return TRUE;