From: Sangchul Lee Date: Mon, 7 Feb 2022 09:15:28 +0000 (+0900) Subject: Fix codes along with GStreamer 1.19.3 update X-Git-Tag: submit/tizen/20220216.051033^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5cfb3090db9ca9c49eb51c89d49cf16b79783966;p=platform%2Fcore%2Fapi%2Fwebrtc.git Fix codes along with GStreamer 1.19.3 update [Version] 0.3.55 [Issue Type] Update Change-Id: Icc8b596b7261e7e1a632edb9457e2be599bd01c9 Signed-off-by: Sangchul Lee --- diff --git a/include/webrtc_private.h b/include/webrtc_private.h index e5ea597d..e193d252 100644 --- a/include/webrtc_private.h +++ b/include/webrtc_private.h @@ -24,6 +24,7 @@ #define GST_USE_UNSTABLE_API #include #endif +#include #include #include #ifndef TIZEN_TV diff --git a/packaging/capi-media-webrtc.spec b/packaging/capi-media-webrtc.spec index e3b8da97..aa70443e 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.3.54 +Version: 0.3.55 Release: 0 Group: Multimedia/API License: Apache-2.0 diff --git a/src/webrtc_private.c b/src/webrtc_private.c index 9c711978..91c4a732 100644 --- a/src/webrtc_private.c +++ b/src/webrtc_private.c @@ -1393,23 +1393,36 @@ static void __webrtcbin_on_new_transceiver_cb(GstElement *webrtcbin, GstWebRTCRT gpointer key, value; webrtc_gst_slot_s *source; int i; + guint mlineindex; + gchar *mid; + GstWebRTCRTPTransceiverDirection direction; + GstWebRTCKind kind; + GstCaps *caps; RET_IF(webrtcbin == NULL, "webrtcbin is NULL"); RET_IF(transceiver == NULL, "transceiver is NULL"); RET_IF(webrtc == NULL, "webrtc is NULL"); - LOG_INFO("webrtc[%p] new transceiver[%p, mline:%u, mid:%s, direction:%d, kind:%d] user_data[%p]", - webrtc, transceiver, transceiver->mline, transceiver->mid, transceiver->direction, transceiver->kind, user_data); - PRINT_CAPS(transceiver->codec_preferences, "codec preferences"); + g_object_get(G_OBJECT(transceiver), + "mlineindex", &mlineindex, + "mid", &mid, + "direction", &direction, + "kind", &kind, + "codec-preferences", &caps, + NULL); + + LOG_INFO("webrtc[%p] new transceiver[%p, mlineindex:%u, mid:%s, direction:%d, kind:%d] user_data[%p]", + webrtc, transceiver, mlineindex, mid, direction, kind, user_data); + PRINT_CAPS(caps, "codec preferences"); if (g_hash_table_size(webrtc->gst.source_slots) == 0) { - if (transceiver->mline >= MAX_MLINE_NUM) { - LOG_ERROR("mline[%u] exceeds the max value", transceiver->mline); + if (mlineindex >= MAX_MLINE_NUM) { + LOG_ERROR("mlineindex[%u] exceeds the max value", mlineindex); return; } /* In this case, it might be an answerer without setting any media source. */ - if (webrtc->data_recovery_types[transceiver->mline].red && - webrtc->data_recovery_types[transceiver->mline].ulpfec) + if (webrtc->data_recovery_types[mlineindex].red && + webrtc->data_recovery_types[mlineindex].ulpfec) __webrtcbin_transceiver_set_ulpfec_red(webrtc, transceiver); return; } @@ -1439,6 +1452,8 @@ void _update_transceivers_fec(webrtc_s *webrtc, bool is_offer) gpointer key, value; webrtc_gst_slot_s *source; int i; + guint mlineindex; + GstWebRTCRTPTransceiverDirection direction; RET_IF(webrtc == NULL, "webrtc is NULL"); @@ -1451,6 +1466,11 @@ void _update_transceivers_fec(webrtc_s *webrtc, bool is_offer) if (!(transceiver = source->av[i].transceiver)) continue; + g_object_get(G_OBJECT(transceiver), + "mlineindex", &mlineindex, + "direction", &direction, + NULL); + ini_source = _ini_get_source_by_type(&webrtc->ini, source->type); if (ini_source == NULL) ini_source = &(webrtc->ini.media_source); @@ -1462,18 +1482,18 @@ void _update_transceivers_fec(webrtc_s *webrtc, bool is_offer) } else { /* NOTE that this maximum value exists only for data_recovery_types due to the scenario an answerer * without any added media sources. It would be moved to the source slot without this scenario. */ - if (transceiver->mline >= MAX_MLINE_NUM) { - LOG_ERROR("mline[%u] exceeds the max value", transceiver->mline); + if (mlineindex >= MAX_MLINE_NUM) { + LOG_ERROR("mline[%u] exceeds the max value", mlineindex); continue; } - if (!webrtc->data_recovery_types[transceiver->mline].red || - !webrtc->data_recovery_types[transceiver->mline].ulpfec) + if (!webrtc->data_recovery_types[mlineindex].red || + !webrtc->data_recovery_types[mlineindex].ulpfec) continue; __webrtcbin_transceiver_set_ulpfec_red(webrtc, transceiver); } - if (transceiver->direction == GST_WEBRTC_RTP_TRANSCEIVER_DIRECTION_SENDONLY || - transceiver->direction == GST_WEBRTC_RTP_TRANSCEIVER_DIRECTION_SENDRECV) + if (direction == GST_WEBRTC_RTP_TRANSCEIVER_DIRECTION_SENDONLY || + direction == GST_WEBRTC_RTP_TRANSCEIVER_DIRECTION_SENDRECV) __webrtcbin_transceiver_set_fec_percentage(webrtc, transceiver, ini_source->fec_percentage); } } @@ -2177,4 +2197,4 @@ int _get_packet_drop_probability(webrtc_s *webrtc, bool sender, float *probabili LOG_INFO("webrtc[%p] [%s] is [%f]", webrtc, prop_name, *probability); return WEBRTC_ERROR_NONE; -} \ No newline at end of file +} diff --git a/src/webrtc_sink.c b/src/webrtc_sink.c index 48b9b864..43e6b7c4 100644 --- a/src/webrtc_sink.c +++ b/src/webrtc_sink.c @@ -16,7 +16,6 @@ #include "webrtc.h" #include "webrtc_private.h" -#include #include //LCOV_EXCL_START @@ -1114,4 +1113,4 @@ int _get_display_visible_from_sink(webrtc_s *webrtc, unsigned int track_id, bool return WEBRTC_ERROR_NONE; } -//LCOV_EXCL_STOP \ No newline at end of file +//LCOV_EXCL_STOP diff --git a/src/webrtc_source.c b/src/webrtc_source.c index b5b028db..c8679783 100644 --- a/src/webrtc_source.c +++ b/src/webrtc_source.c @@ -2928,8 +2928,9 @@ int _set_transceiver_direction(webrtc_s *webrtc, unsigned int source_id, webrtc_ RET_VAL_IF(trans == NULL, WEBRTC_ERROR_INVALID_OPERATION, "transceiver of source[media_type:%d, id:%u] is NULL", media_type, source_id); - trans->direction = __direction_info[direction].gst; - LOG_DEBUG("Set direction to transceiver[%p, mline:%u, direction:%s]", trans, trans->mline, __direction_info[direction].str); + g_object_set(G_OBJECT(trans), "direction", __direction_info[direction].gst, NULL); + + LOG_DEBUG("Set direction to transceiver[%p, direction:%s]", trans, __direction_info[direction].str); return WEBRTC_ERROR_NONE; } @@ -2939,6 +2940,9 @@ int _get_transceiver_direction(webrtc_s *webrtc, unsigned int source_id, webrtc_ int ret; const webrtc_gst_slot_s *source; const GstWebRTCRTPTransceiver *trans; + guint mlineindex; + gchar *mid; + GstWebRTCRTPTransceiverDirection gst_direction; RET_VAL_IF(webrtc == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "webrtc is NULL"); RET_VAL_IF(direction == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "direction is NULL"); @@ -2959,9 +2963,15 @@ int _get_transceiver_direction(webrtc_s *webrtc, unsigned int source_id, webrtc_ RET_VAL_IF(trans == NULL, WEBRTC_ERROR_INVALID_OPERATION, "transceiver of source[media_type:%d, id:%u] is NULL", media_type, source_id); - ret = __convert_direction(trans->direction, direction); + g_object_get(G_OBJECT(trans), + "mlineindex", &mlineindex, + "mid", &mid, + "direction", &gst_direction, + NULL); + + ret = __convert_direction(gst_direction, direction); if (ret == WEBRTC_ERROR_NONE) - LOG_DEBUG("transceiver[%p, mline:%u, mid:%s, direction:%s]", trans, trans->mline, trans->mid, __direction_info[*direction].str); + LOG_DEBUG("transceiver[%p, mlineindex:%u, mid:%s, direction:%s]", trans, mlineindex, mid, __direction_info[*direction].str); return ret; }