From: Sangchul Lee Date: Tue, 12 Oct 2021 11:06:12 +0000 (+0900) Subject: webrtc_private/sink: Print handle pointer address X-Git-Tag: submit/tizen/20211020.012736~8 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=70a8ab8535652b4542e8cf5181e3018628289e0f;p=platform%2Fcore%2Fapi%2Fwebrtc.git webrtc_private/sink: Print handle pointer address Some logs for webrtc handle and decodebin are added. [Version] 0.2.122 [Issue Type] Log Change-Id: Ib07f9216c482d3e73a38cf51069e8cabc0669c94 Signed-off-by: Sangchul Lee --- diff --git a/packaging/capi-media-webrtc.spec b/packaging/capi-media-webrtc.spec index 4e25790b..0d139a20 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.121 +Version: 0.2.122 Release: 0 Group: Multimedia/API License: Apache-2.0 diff --git a/src/webrtc_private.c b/src/webrtc_private.c index bd06ae86..2fd65ce2 100644 --- a/src/webrtc_private.c +++ b/src/webrtc_private.c @@ -221,10 +221,10 @@ void _invoke_state_changed_cb(webrtc_s *webrtc, webrtc_state_e old, webrtc_state if (old == new) return; - LOG_INFO("state is changed [%s] -> [%s]", __state_str[old], __state_str[new]); + LOG_INFO("webrtc[%p] state is changed [%s] -> [%s]", webrtc, __state_str[old], __state_str[new]); if (webrtc->state_changed_cb.callback) { - LOG_DEBUG(">>> callback[%p], user_data[%p]", webrtc->state_changed_cb.callback, webrtc->state_changed_cb.user_data); + LOG_DEBUG(">>> callback[%p] user_data[%p]", webrtc->state_changed_cb.callback, webrtc->state_changed_cb.user_data); ((webrtc_state_changed_cb)(webrtc->state_changed_cb.callback))((webrtc_h)webrtc, old, new, webrtc->state_changed_cb.user_data); LOG_DEBUG("<<< end of the callback"); } @@ -239,10 +239,10 @@ static void __invoke_error_cb(webrtc_s *webrtc, webrtc_error_e error) { RET_IF(webrtc == NULL, "webrtc is NULL"); - LOG_ERROR("error[0x%x, %s]", error, __get_error_string(error)); + LOG_ERROR("webrtc[%p] error[0x%x, %s]", webrtc, error, __get_error_string(error)); if (webrtc->error_cb.callback) { - LOG_DEBUG(">>> callback[%p], user_data[%p]", webrtc->error_cb.callback, webrtc->error_cb.user_data); + LOG_DEBUG(">>> callback[%p] user_data[%p]", webrtc->error_cb.callback, webrtc->error_cb.user_data); ((webrtc_error_cb)(webrtc->error_cb.callback))((webrtc_h)webrtc, error, webrtc->state, webrtc->error_cb.user_data); LOG_DEBUG("<<< end of the callback"); } @@ -256,8 +256,10 @@ static void __invoke_peer_connection_state_change_cb(webrtc_s *webrtc, GstWebRTC cb = &webrtc->peer_connection_state_change_cb; + LOG_INFO("webrtc[%p] peer connection state is changed to [%s]", webrtc, __peer_connection_state_info[state].str); + if (cb->callback) { - LOG_DEBUG(">>> callback[%p], user_data[%p]", cb->callback, cb->user_data); + LOG_DEBUG(">>> callback[%p] user_data[%p]", cb->callback, cb->user_data); ((webrtc_peer_connection_state_change_cb)(cb->callback))((webrtc_h)webrtc, __peer_connection_state_info[state].state, cb->user_data); LOG_DEBUG("<<< end of the callback"); } @@ -271,8 +273,10 @@ static void __invoke_signaling_state_change_cb(webrtc_s *webrtc, GstWebRTCPeerCo cb = &webrtc->signaling_state_change_cb; + LOG_INFO("webrtc[%p] signaling state is changed to [%s]", webrtc, __signaling_state_info[state].str); + if (cb->callback) { - LOG_DEBUG(">>> callback[%p], user_data[%p]", cb->callback, cb->user_data); + LOG_DEBUG(">>> callback[%p] user_data[%p]", cb->callback, cb->user_data); ((webrtc_signaling_state_change_cb)(cb->callback))((webrtc_h)webrtc, __signaling_state_info[state].state, cb->user_data); LOG_DEBUG("<<< end of the callback"); } @@ -286,8 +290,10 @@ static void __invoke_ice_gathering_state_change_cb(webrtc_s *webrtc, GstWebRTCIC cb = &webrtc->ice_gathering_state_change_cb; + LOG_INFO("webrtc[%p] ICE gathering state is changed to [%s]", webrtc, __ice_gathering_state_info[state].str); + if (cb->callback) { - LOG_DEBUG(">>> callback[%p], user_data[%p]", cb->callback, cb->user_data); + LOG_DEBUG(">>> callback[%p] user_data[%p]", cb->callback, cb->user_data); ((webrtc_ice_gathering_state_change_cb)(cb->callback))((webrtc_h)webrtc, __ice_gathering_state_info[state].state, cb->user_data); LOG_DEBUG("<<< end of the callback"); } @@ -301,8 +307,10 @@ static void __invoke_ice_connection_state_change_cb(webrtc_s *webrtc, GstWebRTCI cb = &webrtc->ice_connection_state_change_cb; + LOG_INFO("webrtc[%p] ICE connection state is changed to [%s]", webrtc, __ice_connection_state_info[state].str); + if (cb->callback) { - LOG_DEBUG(">>> callback[%p], user_data[%p]", cb->callback, cb->user_data); + LOG_DEBUG(">>> callback[%p] user_data[%p]", cb->callback, cb->user_data); ((webrtc_ice_connection_state_change_cb)(cb->callback))((webrtc_h)webrtc, __ice_connection_state_info[state].state, cb->user_data); LOG_DEBUG("<<< end of the callback"); } @@ -577,7 +585,7 @@ GstElement *_create_element(const char *factory_name, const char *name) element = gst_element_factory_make(factory_name, name); RET_VAL_IF(!element, NULL, "element is NULL [%s]", factory_name); - LOG_INFO("created element [%s, %s]", factory_name, SAFE_STR(name)); + LOG_INFO("created element[%p, %s, %s]", element, factory_name, SAFE_STR(name)); return element; } @@ -804,8 +812,8 @@ static void __webrtcbin_on_negotiation_needed_cb(GstElement *webrtcbin, gpointer return; } - LOG_DEBUG(">>> invoke negotiation_needed_cb[%p], user_data[%p]", - webrtc->negotiation_needed_cb.callback, webrtc->negotiation_needed_cb.user_data); + LOG_DEBUG(">>> webrtc[%p] invoke negotiation_needed_cb[%p] user_data[%p]", + webrtc, webrtc->negotiation_needed_cb.callback, webrtc->negotiation_needed_cb.user_data); ((webrtc_negotiation_needed_cb)(webrtc->negotiation_needed_cb.callback))((webrtc_h)webrtc, webrtc->negotiation_needed_cb.user_data); LOG_DEBUG("<<< end of the callback"); } @@ -820,7 +828,7 @@ static void __webrtcbin_on_ice_candidate_cb(GstElement *webrtcbin, guint mlinein RET_IF(webrtc == NULL, "webrtc is NULL"); RET_IF(webrtc->ice_candidate_cb.callback == NULL, "ice_candidate_cb is NULL"); - LOG_DEBUG("mlineindex[%u], candidate[%s]", mlineindex, candidate); + LOG_DEBUG("webrtc[%p] mlineindex[%u] candidate[%s]", webrtc, mlineindex, candidate); _candidate = __make_ice_candidate_message(mlineindex, candidate); if (!_candidate) @@ -829,8 +837,8 @@ static void __webrtcbin_on_ice_candidate_cb(GstElement *webrtcbin, guint mlinein _param_candidate = strdup(_candidate); g_free(_candidate); - LOG_DEBUG(">>> invoke ice_candidate_cb[%p], user_data[%p]", - webrtc->ice_candidate_cb.callback, webrtc->ice_candidate_cb.user_data); + LOG_DEBUG(">>> webrtc[%p] invoke ice_candidate_cb[%p] user_data[%p]", + webrtc, webrtc->ice_candidate_cb.callback, webrtc->ice_candidate_cb.user_data); ((webrtc_ice_candidate_cb)(webrtc->ice_candidate_cb.callback))((webrtc_h)webrtc, (const char *)_param_candidate, webrtc->ice_candidate_cb.user_data); LOG_DEBUG("<<< end of the callback"); @@ -847,7 +855,7 @@ static void __webrtcbin_peer_connection_state_cb(GstElement *webrtcbin, GParamSp g_object_get(webrtcbin, "connection-state", &state, NULL); - LOG_DEBUG("[PeerConnectionState] is changed to [%s]", __peer_connection_state_info[state].str); + LOG_DEBUG("webrtc[%p] [PeerConnectionState] is changed to [%s]", webrtc, __peer_connection_state_info[state].str); webrtc->negotiation_states.peer_connection_state = __peer_connection_state_info[state].state; __post_peer_connection_state_change_cb_in_idle(webrtc, state); @@ -879,7 +887,7 @@ static void __webrtcbin_signaling_state_cb(GstElement *webrtcbin, GParamSpec * p g_object_get(webrtcbin, "signaling-state", &state, NULL); - LOG_DEBUG("[SignalingState] is changed to [%s]", __signaling_state_info[state].str); + LOG_DEBUG("webrtc[%p] [SignalingState] is changed to [%s]", webrtc, __signaling_state_info[state].str); webrtc->negotiation_states.signaling_state = __signaling_state_info[state].state; __post_signaling_state_change_cb_in_idle(webrtc, state); @@ -895,7 +903,7 @@ static void __webrtcbin_ice_gathering_state_cb(GstElement *webrtcbin, GParamSpec g_object_get(webrtcbin, "ice-gathering-state", &state, NULL); - LOG_DEBUG("[IceGatheringState] is changed to [%s]", __ice_gathering_state_info[state].str); + LOG_DEBUG("webrtc[%p] [IceGatheringState] is changed to [%s]", webrtc, __ice_gathering_state_info[state].str); webrtc->negotiation_states.ice_gathering_state = __ice_gathering_state_info[state].state; __post_ice_gathering_state_change_cb_in_idle(webrtc, state); @@ -911,7 +919,7 @@ static void __webrtcbin_ice_connection_state_cb(GstElement *webrtcbin, GParamSpe g_object_get(webrtcbin, "ice-connection-state", &state, NULL); - LOG_DEBUG("[IceConnectionState] is changed to [%s]", __ice_connection_state_info[state].str); + LOG_DEBUG("webrtc[%p] [IceConnectionState] is changed to [%s]", webrtc, __ice_connection_state_info[state].str); webrtc->negotiation_states.ice_connection_state = __ice_connection_state_info[state].state; __post_ice_connection_state_change_cb_in_idle(webrtc, state); @@ -1135,8 +1143,8 @@ static void __webrtcbin_on_new_transceiver_cb(GstElement *webrtcbin, GstWebRTCRT RET_IF(transceiver == NULL, "transceiver is NULL"); RET_IF(webrtc == NULL, "webrtc is NULL"); - LOG_INFO("new transceiver[%p, mline:%u, mid:%s, direction:%d], user_data[%p]", - transceiver, transceiver->mline, transceiver->mid, transceiver->direction, user_data); + LOG_INFO("webrtc[%p] new transceiver[%p, mline:%u, mid:%s, direction:%d] user_data[%p]", + webrtc, transceiver, transceiver->mline, transceiver->mid, transceiver->direction, user_data); if (g_hash_table_size(webrtc->gst.source_slots) == 0) { /* In this case, it might be an answerer without setting any media source. @@ -1371,6 +1379,8 @@ static void __update_session_description(GstPromise *promise, bool is_offer, gpo g_free(webrtc->desc_answer); webrtc->desc_answer = sdp_msg; } + LOG_INFO("webrtc[%p, %s] %s", webrtc, is_offer ? "offer" : "answer", + is_offer ? webrtc->desc_offer : webrtc->desc_answer); } static void __offer_created_cb(GstPromise *promise, gpointer user_data) @@ -1389,8 +1399,9 @@ static void __offer_created_cb(GstPromise *promise, gpointer user_data) LOG_DEBUG_ENTER(); __update_session_description(promise, true, webrtc); + if (data->callback) { - LOG_DEBUG(">>> callback[%p], user_data[%p]", data->callback, data->user_data); + LOG_DEBUG(">>> callback[%p] user_data[%p]", data->callback, data->user_data); ((webrtc_session_description_created_cb)(data->callback))((webrtc_h)webrtc, webrtc->desc_offer, data->user_data); LOG_DEBUG("<<< end of the callback"); g_mutex_unlock(&webrtc->desc_mutex); @@ -1422,7 +1433,7 @@ static void __answer_created_cb(GstPromise *promise, gpointer user_data) __update_session_description(promise, false, webrtc); if (data->callback) { - LOG_DEBUG(">>> callback[%p], user_data[%p]", data->callback, data->user_data); + LOG_DEBUG(">>> callback[%p] user_data[%p]", data->callback, data->user_data); ((webrtc_session_description_created_cb)(data->callback))((webrtc_h)webrtc, webrtc->desc_answer, data->user_data); LOG_DEBUG("<<< end of the callback"); g_mutex_unlock(&webrtc->desc_mutex); @@ -1465,8 +1476,6 @@ int _webrtcbin_create_session_description(webrtc_s *webrtc, bool is_offer, char g_mutex_unlock(&webrtc->desc_mutex); - LOG_INFO("%s", *desc); - return WEBRTC_ERROR_NONE; } diff --git a/src/webrtc_sink.c b/src/webrtc_sink.c index afe121fd..ac7db7aa 100644 --- a/src/webrtc_sink.c +++ b/src/webrtc_sink.c @@ -317,7 +317,7 @@ static void __invoke_track_added_cb(webrtc_s *webrtc, const gchar *name, bool is RET_IF(webrtc == NULL, "webrtc is NULL"); RET_IF(name == NULL, "name is NULL"); - LOG_INFO("[%s] track[%s] is added", is_video ? "video" : "audio", name); + LOG_INFO("webrtc[%p] [%s] track[%s] is added", webrtc, is_video ? "video" : "audio", name); if (webrtc->track_added_cb.callback) { unsigned int id = __get_id_from_name(name); @@ -369,7 +369,7 @@ static void __decodebin_pad_added_cb(GstElement *decodebin, GstPad *new_pad, gpo return; media_type = gst_structure_get_name(gst_caps_get_structure(gst_pad_get_current_caps(new_pad), 0)); - LOG_INFO("[%s], new_pad[%s], media_type[%s]", GST_ELEMENT_NAME(decodebin), GST_PAD_NAME(new_pad), media_type); + LOG_INFO("decodebin[%p, name:%s] new_pad[%s] media_type[%s]", decodebin, GST_ELEMENT_NAME(decodebin), GST_PAD_NAME(new_pad), media_type); sink = __find_sink_slot(webrtc, GST_ELEMENT_NAME(decodebin)); RET_IF(sink == NULL, "could not find an item by [%s] in sink slots", GST_ELEMENT_NAME(decodebin)); @@ -423,7 +423,7 @@ int _decodebin_autoplug_select_cb(GstElement *decodebin, GstPad *pad, GstCaps *c factory_name = GST_OBJECT_NAME(factory); klass = gst_element_factory_get_metadata(factory, GST_ELEMENT_METADATA_KLASS); - LOG_INFO("factory [name:%s, klass:%s]", factory_name, klass); + LOG_INFO("decodebin[%p] factory[name:%s, klass:%s]", decodebin, factory_name, klass); str_arr = webrtc->ini.general.gst_excluded_elements; while (str_arr && *str_arr) { @@ -914,7 +914,7 @@ int _add_forwarding_sink_bin(webrtc_s *webrtc, GstPad *src_pad, bool is_video) return WEBRTC_ERROR_INVALID_OPERATION; } - LOG_INFO("added a sink slot[%p, id:%u]", sink, sink->id); + LOG_INFO("added a sink slot[%p, id:%u] to webrtc[%p]", sink, sink->id, webrtc); return WEBRTC_ERROR_NONE; @@ -968,7 +968,7 @@ int _set_stream_info_to_sink(webrtc_s *webrtc, unsigned int track_id, sound_stre sink->sound_stream_info.type = strdup(stream_type); sink->sound_stream_info.index = stream_index; - LOG_INFO("track_id[%u] stream_info[%p, type:%s, index:%d]", track_id, stream_info, stream_type, stream_index); + LOG_INFO("webrtc[%p] track_id[%u] stream_info[%p, type:%s, index:%d]", webrtc, track_id, stream_info, stream_type, stream_index); return WEBRTC_ERROR_NONE; } @@ -992,7 +992,7 @@ int _set_display_to_sink(webrtc_s *webrtc, unsigned int track_id, unsigned int t RET_VAL_IF(sink->display == NULL, WEBRTC_ERROR_INVALID_OPERATION, "sink->display is NULL"); } - LOG_INFO("track_id[%u]", track_id); + LOG_INFO("webrtc[%p] track_id[%u]", webrtc, track_id); _set_display_type_and_surface(sink->display, type, display);