From 107f499410e46d3b342a2196ca8e2d0cdfcf23a5 Mon Sep 17 00:00:00 2001 From: Sangchul Lee Date: Thu, 6 Aug 2020 20:26:59 +0900 Subject: [PATCH] Add logic to skip h/w video decoder element in __ms_feature_node_filter() 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 --- packaging/capi-media-streamer.spec | 2 +- src/media_streamer_gst.c | 46 +++++++++++++++++++++++++------------- 2 files changed, 32 insertions(+), 16 deletions(-) diff --git a/packaging/capi-media-streamer.spec b/packaging/capi-media-streamer.spec index 568720c..8beba1a 100644 --- a/packaging/capi-media-streamer.spec +++ b/packaging/capi-media-streamer.spec @@ -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 diff --git a/src/media_streamer_gst.c b/src/media_streamer_gst.c index aa65883..3513db9 100644 --- a/src/media_streamer_gst.c +++ b/src/media_streamer_gst.c @@ -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; -- 2.7.4