webrtc_private: Add excluded element list to CREATE_ELEMENT_FROM_REGISTRY() 28/267028/1 accepted/tizen/6.5/unified/20211125.060603 submit/tizen_6.5/20211124.101818
authorSangchul Lee <sc11.lee@samsung.com>
Tue, 16 Nov 2021 03:38:00 +0000 (12:38 +0900)
committerSangchul Lee <sc11.lee@samsung.com>
Wed, 24 Nov 2021 08:33:55 +0000 (17:33 +0900)
The excluded element list from ini file is now referenced by two locations.
1. sink side (previous one) - _decodebin_autoplug_select_cb()
2. source side - CREATE_ELEMENT_FROM_REGISTRY() in __create_rest_of_elements()

[Version] 0.2.152
[Issue Type] Improvement

Change-Id: I277dfd574d8abbb9cd25e961a46efbaff7855ffc
Signed-off-by: Sangchul Lee <sc11.lee@samsung.com>
include/webrtc_private.h
packaging/capi-media-webrtc.spec
src/webrtc_private.c
src/webrtc_sink.c
src/webrtc_source.c

index 37da9ce4140c7d32ed5126e8ac78ee8e0cd48905..17dce4c692e2783da657da14972a35e3e46b4dea 100644 (file)
@@ -178,11 +178,12 @@ do { \
        g_free(caps_str); \
 } while (0)
 
-#define CREATE_ELEMENT_FROM_REGISTRY(x_elem_info, x_klass_name, x_sink_caps, x_src_caps, x_element) \
+#define CREATE_ELEMENT_FROM_REGISTRY(x_elem_info, x_klass_name, x_sink_caps, x_src_caps, x_excluded_elements, x_element) \
 do { \
        x_elem_info.klass_name = x_klass_name; \
        x_elem_info.sink_caps = x_sink_caps; \
        x_elem_info.src_caps = x_src_caps; \
+       x_elem_info.excluded_elements = x_excluded_elements; \
        x_element = _create_element_from_registry(&x_elem_info); \
        if (!x_element) \
                LOG_ERROR("failed to create element of [%s]", x_klass_name); \
@@ -517,6 +518,7 @@ typedef struct _element_info_s {
        const gchar *klass_name;
        GstCaps *src_caps;
        GstCaps *sink_caps;
+       gchar **excluded_elements;
 } element_info_s;
 
 typedef struct _webrtc_signal_s {
index 5536271b33169b1b5009b61de41b5c59ad673e73..1e4eecb9c3310de76ee99036d2093634559d091f 100644 (file)
@@ -1,6 +1,6 @@
 Name:       capi-media-webrtc
 Summary:    A WebRTC library in Tizen Native API
-Version:    0.2.151
+Version:    0.2.152
 Release:    0
 Group:      Multimedia/API
 License:    Apache-2.0
index 213750f4b81bd74a7c548166928e889f72067578..99fad14f207d3951ad971edfab34bddda47db113 100644 (file)
@@ -645,18 +645,29 @@ static gboolean __element_filter(GstPluginFeature *feature, gpointer data)
        element_info_s *elem_info = (element_info_s *)data;
        gboolean src_can_accept = FALSE;
        gboolean sink_can_accept = FALSE;
+       gchar *factory_name;
        GstElementFactory *factory = NULL;
        const gchar *factory_klass = NULL;
+       gchar **str_arr;
 
        if (!GST_IS_ELEMENT_FACTORY(feature))
                return FALSE;
 
        factory = GST_ELEMENT_FACTORY(feature);
+       factory_name = GST_OBJECT_NAME(factory);
        factory_klass = gst_element_factory_get_klass(factory);
 
        if (!elem_info || !g_strrstr(factory_klass, elem_info->klass_name))
                return FALSE;
 
+       str_arr = elem_info->excluded_elements;
+       while (str_arr && *str_arr) {
+               if (g_strrstr(factory_name, *str_arr++)) {
+                       LOG_WARNING("this element[%s] is an item of excluded element list in ini file, skip it", factory_name);
+                       return FALSE;
+               }
+       }
+
        if (g_strrstr(factory_klass, GST_KLASS_NAME_PAYLOADER_RTP) && !__is_acceptable_element(factory, GST_PAD_SRC))
                return FALSE;
        else if (g_strrstr(factory_klass, GST_KLASS_NAME_DEPAYLOADER_RTP) && !__is_acceptable_element(factory, GST_PAD_SINK))
@@ -670,14 +681,14 @@ static gboolean __element_filter(GstPluginFeature *feature, gpointer data)
 
        if (GST_IS_CAPS(elem_info->src_caps) && GST_IS_CAPS(elem_info->sink_caps)) {
                if (src_can_accept && sink_can_accept) {
-                       LOG_DEBUG("found compatible factory [%s] for klass [%s]", GST_OBJECT_NAME(factory), factory_klass);
+                       LOG_DEBUG("found compatible factory [%s] for klass [%s]", factory_name, factory_klass);
                        return TRUE;
                }
                return FALSE;
        }
 
        if (src_can_accept || sink_can_accept) {
-               LOG_DEBUG("found compatible factory [%s] for klass [%s]", GST_OBJECT_NAME(factory), factory_klass);
+               LOG_DEBUG("found compatible factory [%s] for klass [%s]", factory_name, factory_klass);
                return TRUE;
        }
 
index 5b9fdc38772dff2fd5ba540cbc6910ea1c26b137..71348767f472f87f483546d7de52e53e1f16488f 100644 (file)
@@ -863,7 +863,7 @@ int _add_forwarding_sink_bin(webrtc_s *webrtc, GstPad *src_pad, bool is_video)
 
        g_free(bin_name);
 
-       CREATE_ELEMENT_FROM_REGISTRY(elem_info, GST_KLASS_NAME_DEPAYLOADER_RTP, gst_pad_get_current_caps(src_pad), NULL, depayloader);
+       CREATE_ELEMENT_FROM_REGISTRY(elem_info, GST_KLASS_NAME_DEPAYLOADER_RTP, gst_pad_get_current_caps(src_pad), NULL, NULL, depayloader);
        if (!depayloader)
                goto error_before_insert;
 
index cfd9f75bd8064f367c691a88efb22895bd651efb..85e80206e8a1d727ce3964af5cd3032ba4bd5f4b 100644 (file)
@@ -910,6 +910,7 @@ static int __create_rest_of_elements(webrtc_s *webrtc, webrtc_gst_slot_s *source
                CREATE_ELEMENT_FROM_REGISTRY(elem_info, encoder_klass_name,
                                                        __make_default_raw_caps(source, &webrtc->ini),
                                                        __make_default_encoded_caps(source, &webrtc->ini, NULL),
+                                                       webrtc->ini.general.gst_excluded_elements,
                                                        encoder);
        if (encoder == NULL) {
                __remove_probe_from_pad_for_render(source, idx);
@@ -938,6 +939,7 @@ skip_encoder:
        CREATE_ELEMENT_FROM_REGISTRY(elem_info, GST_KLASS_NAME_PAYLOADER_RTP,
                                                __make_default_encoded_caps(source, &webrtc->ini, &media_type),
                                                NULL,
+                                               NULL,
                                                payloader);
        if (payloader == NULL)
                goto error;
@@ -992,6 +994,7 @@ static int __create_rest_of_elements_for_encoded_format(webrtc_s *webrtc, webrtc
        CREATE_ELEMENT_FROM_REGISTRY(elem_info, GST_KLASS_NAME_PAYLOADER_RTP,
                                                __make_encoded_caps_from_media_format(source, &media_type),
                                                NULL,
+                                               NULL,
                                                payloader);
        if (payloader == NULL) {
                g_free(media_type);
@@ -1855,6 +1858,7 @@ static GstElement * __create_payloader_for_filesrc_pipeline(GstPad *pad, bool is
        CREATE_ELEMENT_FROM_REGISTRY(elem_info, GST_KLASS_NAME_PAYLOADER_RTP,
                                                                gst_pad_get_current_caps(pad),
                                                                NULL,
+                                                               NULL,
                                                                payloader);
 
        RET_VAL_IF(payloader == NULL, NULL, "payloader is NULL");