From: backto.kim Date: Tue, 13 Jul 2021 08:35:37 +0000 (+0900) Subject: The file source can have more than one src pad for the same source id X-Git-Tag: submit/tizen/20210729.023123~18 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f599185f875bee6a324010b74836d038cd68571c;p=platform%2Fcore%2Fapi%2Fwebrtc.git The file source can have more than one src pad for the same source id [Version] 0.2.42 [Issue Type] Improvement Change-Id: I47f00b5500496ee3dffd8afb3265d351532bb293 --- diff --git a/packaging/capi-media-webrtc.spec b/packaging/capi-media-webrtc.spec index 044761ab..b577321a 100644 --- a/packaging/capi-media-webrtc.spec +++ b/packaging/capi-media-webrtc.spec @@ -1,6 +1,6 @@ Name: capi-media-webrtc Summary: A WebRTC library in Tizen Native API -Version: 0.2.41 +Version: 0.2.42 Release: 0 Group: Multimedia/API License: Apache-2.0 diff --git a/src/webrtc_private.c b/src/webrtc_private.c index e16fab52..446e1f41 100644 --- a/src/webrtc_private.c +++ b/src/webrtc_private.c @@ -880,7 +880,11 @@ int _add_no_target_ghostpad_to_slot(webrtc_gst_slot_s *slot, bool is_src, GstPad RET_VAL_IF(slot->bin == NULL, WEBRTC_ERROR_INVALID_OPERATION, "bin is NULL"); RET_VAL_IF(new_pad == NULL, WEBRTC_ERROR_INVALID_OPERATION, "new_pad is NULL"); - pad_name = g_strdup_printf("%s_%u", is_src ? "src" : "sink", slot->id); + if (slot->type == WEBRTC_MEDIA_SOURCE_TYPE_FILE) + pad_name = g_strdup_printf("%s_%s_%u", slot->media_types & MEDIA_TYPE_AUDIO ? "audio" : "video", is_src ? "src" : "sink", slot->id); + else + pad_name = g_strdup_printf("%s_%u", is_src ? "src" : "sink", slot->id); + if (!(*new_pad = __add_no_target_ghostpad(slot->bin, pad_name, is_src))) { LOG_ERROR("failed to add new ghost pad[%s] for bin[%s]", pad_name, GST_ELEMENT_NAME(slot->bin)); g_free(pad_name); diff --git a/src/webrtc_source.c b/src/webrtc_source.c index 1a016d6d..dca3ff72 100644 --- a/src/webrtc_source.c +++ b/src/webrtc_source.c @@ -1915,7 +1915,12 @@ static int __link_source_with_webrtcbin(webrtc_gst_slot_s *source, GstElement *w ret = WEBRTC_ERROR_INVALID_OPERATION; goto exit; } - srcpad_name = g_strdup_printf("src_%u", source->id); + + if (source->type == WEBRTC_MEDIA_SOURCE_TYPE_FILE) + srcpad_name = g_strdup_printf("%s_src_%u", source->media_types & MEDIA_TYPE_AUDIO ? "audio" : "video", source->id); + else + srcpad_name = g_strdup_printf("src_%u", source->id); + if (!gst_element_link_pads(GST_ELEMENT(source->bin), srcpad_name, webrtcbin, sinkpad_name)) { LOG_ERROR("failed to link pads, [%s:%s] - [%s:%s]", GST_ELEMENT_NAME(source->bin), srcpad_name, GST_ELEMENT_NAME(webrtcbin), sinkpad_name);