From: Sangchul Lee Date: Thu, 7 Mar 2024 07:46:20 +0000 (+0900) Subject: webrtc_transceiver: Revise the postfix number of mid X-Git-Tag: accepted/tizen/8.0/unified/20240308.173324^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=fdca0f93759f51cd204f3ac73aaf49b1d18a7776;p=platform%2Fcore%2Fapi%2Fwebrtc.git webrtc_transceiver: Revise the postfix number of mid Considering the postfix value of gstreamer element name accumulates even if the handle is destroyed and re-created in the same process, it has been revised. [Version] 0.4.51 [Issue Type] Bug fix Change-Id: Ia513a40637230fcf158f7f8a8e584af104c9bd6e Signed-off-by: Sangchul Lee --- diff --git a/include/webrtc_private.h b/include/webrtc_private.h index 213c2133..f8f0a077 100644 --- a/include/webrtc_private.h +++ b/include/webrtc_private.h @@ -574,6 +574,7 @@ typedef struct _webrtc_s { webrtc_rotate_info_s rotate_info; #endif #endif + unsigned int transceiver_count; } webrtc_s; /* FIXME: divide into two slot types or use union */ diff --git a/packaging/capi-media-webrtc.spec b/packaging/capi-media-webrtc.spec index 4d1d9343..798b3f23 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.4.50 +Version: 0.4.51 Release: 0 Group: Multimedia/API License: Apache-2.0 diff --git a/src/webrtc_transceiver.c b/src/webrtc_transceiver.c index a8d75e52..94366001 100644 --- a/src/webrtc_transceiver.c +++ b/src/webrtc_transceiver.c @@ -75,14 +75,9 @@ static void __webrtcbin_transceiver_set_fec_percentage(webrtc_s *webrtc, GstWebR LOG_INFO("set fec-percentage[%u] to transceiver[%p]", fec_percentage, transceiver); } -static gchar *__get_gst_mid_from_transceiver(bool is_audio, const char *transceiver_name) +static gchar *__get_mid_from_transceiver_count(bool is_audio, unsigned int count) { - g_auto(GStrv) str_arr = NULL; - - RET_VAL_IF(transceiver_name == NULL, NULL, "transceiver_name is NULL"); - - str_arr = g_strsplit(transceiver_name, "webrtctransceiver", 2); - return g_strdup_printf("%s%s", is_audio ? "audio" : "video", str_arr[1]); + return g_strdup_printf("%s%u", is_audio ? "audio" : "video", count); } void _webrtcbin_on_new_transceiver_cb(GstElement *webrtcbin, GstWebRTCRTPTransceiver *transceiver, gpointer user_data) @@ -133,7 +128,7 @@ void _webrtcbin_on_new_transceiver_cb(GstElement *webrtcbin, GstWebRTCRTPTransce source->av[j].transceiver = gst_object_ref(transceiver); g_object_set(G_OBJECT(transceiver), "direction", __convert_transceiver_direction(source->av[j].direction)->gst, NULL); - source->av[j].mid = __get_gst_mid_from_transceiver(j == AV_IDX_AUDIO, GST_OBJECT_NAME(transceiver)); + source->av[j].mid = __get_mid_from_transceiver_count(j == AV_IDX_AUDIO, webrtc->transceiver_count++); LOG_INFO("source->id[%u] source->av[%s][transceiver:%p, direction:%s, mid:%s]", source->id, j == AV_IDX_AUDIO ? "AUDIO" : "VIDEO", source->av[j].transceiver,