Add logic to skip h/w decoder element in __decodebin_autoplug_select_cb() 56/240456/5
authorSangchul Lee <sc11.lee@samsung.com>
Thu, 6 Aug 2020 10:00:49 +0000 (19:00 +0900)
committerSangchul Lee <sc11.lee@samsung.com>
Fri, 7 Aug 2020 06:30:47 +0000 (15:30 +0900)
It checks the conditions to allow the h/w video decoder element
only when
 1. If zerocopy is used and
 2. 'video_decoder' is specified in zerocopy node names

[Version] 0.1.106
[Issue Type] Improvement

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

index 97bf11220cce9f83f99c83e2f575475e6c14341c..568720c380dc62e87064ca38463cd2237590a7c9 100644 (file)
@@ -1,6 +1,6 @@
 Name:       capi-media-streamer
 Summary:    A Media Streamer API
-Version:    0.1.105
+Version:    0.1.106
 Release:    0
 Group:      Multimedia/API
 License:    Apache-2.0
index 971c6b1901f20a9a007041acb7e7c4c5fc5d09f1..aa6588307cfcddba71ff401bbf66cacb398f437d 100644 (file)
@@ -650,26 +650,39 @@ static gint __decodebin_autoplug_select_cb(GstElement *bin, GstPad *pad, GstCaps
        factory_name = GST_OBJECT_NAME(factory);
        klass = gst_element_factory_get_metadata(factory, GST_ELEMENT_METADATA_KLASS);
 
-       ms_debug("Decodebin: found new element [%s] to link [%s]", factory_name, klass);
+       ms_debug("Found new element [%s] to link [%s]", factory_name, klass);
 
        if (ms_streamer->ini.exclude_elem_names) {
-               /* Search if such plugin must be excluded */
                for (index = 0; ms_streamer->ini.exclude_elem_names[index]; ++index) {
                        if (g_strrstr(factory_name, ms_streamer->ini.exclude_elem_names[index])) {
-                               ms_debug("Decodebin: skipping [%s] as excluded", factory_name);
-                               ms_debug_fleave();
-
+                               ms_debug("Skipping [%s] as excluded", factory_name);
                                return GST_AUTOPLUG_SELECT_SKIP;
                        }
                }
+       }
 
+       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 (ms_streamer->ini.resource_required_elem_names) {
                /* Try to acquire resources before adding element */
                for (index = 0; ms_streamer->ini.resource_required_elem_names[index]; ++index) {
                        if (g_strrstr(factory_name, ms_streamer->ini.resource_required_elem_names[index])) {
-                               ms_debug("Decodebin: trying to acquire resource for [%s] element", factory_name);
+                               ms_debug("Trying to acquire resource for [%s] element", factory_name);
 
                                if (MM_RESOURCE_MANAGER_ERROR_NONE !=
                                        mm_resource_manager_mark_for_acquire(ms_streamer->resource_manager,