From: Sangchul Lee Date: Mon, 28 Sep 2020 03:58:19 +0000 (+0900) Subject: webrtc: Print logs within critical section X-Git-Tag: submit/tizen/20210729.023123~209 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8064ba5d78cb3ef74c699d107af533955ce0b33c;p=platform%2Fcore%2Fapi%2Fwebrtc.git webrtc: Print logs within critical section Some logs are also revised not to be confusing with its contents. [Version] 0.1.33 [Issue Type] Log Change-Id: Ie490f3a0d346018e393e505bce012799436cb8cb Signed-off-by: Sangchul Lee --- diff --git a/packaging/capi-media-webrtc.spec b/packaging/capi-media-webrtc.spec index 0cd4d59a..c0be7d28 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.1.32 +Version: 0.1.33 Release: 0 Group: Multimedia/API License: Apache-2.0 diff --git a/src/webrtc.c b/src/webrtc.c index a8109bf6..9a928408 100644 --- a/src/webrtc.c +++ b/src/webrtc.c @@ -125,10 +125,10 @@ int webrtc_create(webrtc_h *webrtc) *webrtc = _webrtc; - g_mutex_unlock(&_webrtc->mutex); - LOG_INFO("webrtc[%p] is created", *webrtc); + g_mutex_unlock(&_webrtc->mutex); + return ret; } @@ -150,13 +150,13 @@ int webrtc_destroy(webrtc_h webrtc) g_mutex_clear(&_webrtc->desc_mutex); g_cond_clear(&_webrtc->desc_cond); + LOG_INFO("webrtc[%p] is destroyed", webrtc); + g_mutex_unlock(&_webrtc->mutex); g_mutex_clear(&_webrtc->mutex); g_free(_webrtc); - LOG_INFO("webrtc[%p] is destroyed", webrtc); - return WEBRTC_ERROR_NONE; } @@ -175,10 +175,10 @@ int webrtc_start(webrtc_h webrtc) _gst_pipeline_set_state(webrtc, GST_STATE_PLAYING); _webrtc->pend_state = WEBRTC_STATE_NEGOTIATING; - g_mutex_unlock(&_webrtc->mutex); - LOG_INFO("webrtc[%p] is started", webrtc); + g_mutex_unlock(&_webrtc->mutex); + return WEBRTC_ERROR_NONE; } @@ -195,10 +195,10 @@ int webrtc_stop(webrtc_h webrtc) _gst_pipeline_set_state(webrtc, GST_STATE_READY); _webrtc->pend_state = WEBRTC_STATE_IDLE; - g_mutex_unlock(&_webrtc->mutex); - LOG_INFO("webrtc[%p] is stopped", webrtc); + g_mutex_unlock(&_webrtc->mutex); + return WEBRTC_ERROR_NONE; } @@ -212,10 +212,10 @@ int webrtc_get_state(webrtc_h webrtc, webrtc_state_e *state) *state = _webrtc->state; - g_mutex_unlock(&_webrtc->mutex); - LOG_INFO("state[%d]", *state); + g_mutex_unlock(&_webrtc->mutex); + return WEBRTC_ERROR_NONE; } @@ -232,12 +232,11 @@ int webrtc_add_media_source(webrtc_h webrtc, webrtc_media_source_type_e type, un RET_VAL_WITH_UNLOCK_IF(_webrtc->state != WEBRTC_STATE_IDLE, WEBRTC_ERROR_INVALID_STATE, &_webrtc->mutex, "the state should be IDLE"); ret = _add_media_source(webrtc, type, source_id); - - g_mutex_unlock(&_webrtc->mutex); - if (ret == WEBRTC_ERROR_NONE) LOG_INFO("source_id[%u]", *source_id); + g_mutex_unlock(&_webrtc->mutex); + return ret; } @@ -252,9 +251,9 @@ int webrtc_remove_media_source(webrtc_h webrtc, unsigned int source_id) RET_VAL_WITH_UNLOCK_IF(_webrtc->state != WEBRTC_STATE_IDLE, WEBRTC_ERROR_INVALID_STATE, &_webrtc->mutex, "the state should be IDLE"); - LOG_INFO("source_id[%u]", source_id); - ret = _remove_media_source(webrtc, source_id); + if (ret == WEBRTC_ERROR_NONE) + LOG_INFO("source_id[%u]", source_id); g_mutex_unlock(&_webrtc->mutex); @@ -272,12 +271,11 @@ int webrtc_get_transceiver_direction(webrtc_h webrtc, unsigned int source_id, we g_mutex_lock(&_webrtc->mutex); ret = _get_transceiver_direction(webrtc, source_id, media_type, direction); + if (ret == WEBRTC_ERROR_NONE) + LOG_INFO("source_id[%u] media_type[%d] direction[%d]", source_id, media_type, *direction); g_mutex_unlock(&_webrtc->mutex); - if (ret == WEBRTC_ERROR_NONE) - LOG_INFO("source_id[%u], media_type[%d], direction[%d]", source_id, media_type, *direction); - return ret; } @@ -293,11 +291,11 @@ int webrtc_set_transceiver_direction(webrtc_h webrtc, unsigned int source_id, we RET_VAL_WITH_UNLOCK_IF(_webrtc->state != WEBRTC_STATE_IDLE, WEBRTC_ERROR_INVALID_STATE, &_webrtc->mutex, "the state should be IDLE"); ret = _set_transceiver_direction(webrtc, source_id, media_type, direction); + if (ret == WEBRTC_ERROR_NONE) + LOG_INFO("source_id[%u] media_type[%d] direction[%d]", source_id, media_type, direction); g_mutex_unlock(&_webrtc->mutex); - LOG_INFO("source_id[%u], media_type[%d], direction[%d]", source_id, media_type, direction); - return ret; } @@ -318,10 +316,10 @@ int webrtc_set_stun_server(webrtc_h webrtc, const char *stun_server) _webrtc->stun_server_url = g_strdup(stun_server); g_object_set(G_OBJECT(_webrtc->gst.webrtcbin), "stun-server", _webrtc->stun_server_url, NULL); - g_mutex_unlock(&_webrtc->mutex); - LOG_INFO("stun_server[%s]", stun_server); + g_mutex_unlock(&_webrtc->mutex); + return WEBRTC_ERROR_NONE; } @@ -466,7 +464,7 @@ int webrtc_set_local_description(webrtc_h webrtc, const char *description) RET_VAL_WITH_UNLOCK_IF(_webrtc->state != WEBRTC_STATE_NEGOTIATING, WEBRTC_ERROR_INVALID_STATE, &_webrtc->mutex, "the state should be NEGOTIATING"); - LOG_INFO("description[ %s ]", description); + LOG_INFO("description: %s", description); ret = _webrtcbin_set_session_description(webrtc, description, FALSE); @@ -487,7 +485,7 @@ int webrtc_set_remote_description(webrtc_h webrtc, const char *description) RET_VAL_WITH_UNLOCK_IF(_webrtc->state != WEBRTC_STATE_NEGOTIATING, WEBRTC_ERROR_INVALID_STATE, &_webrtc->mutex, "the state should be NEGOTIATING"); - LOG_INFO("description[ %s ]", description); + LOG_INFO("description: %s", description); ret = _webrtcbin_set_session_description(webrtc, description, TRUE); @@ -508,7 +506,7 @@ int webrtc_add_ice_candidate(webrtc_h webrtc, const char *candidate) RET_VAL_WITH_UNLOCK_IF(_webrtc->state != WEBRTC_STATE_NEGOTIATING, WEBRTC_ERROR_INVALID_STATE, &_webrtc->mutex, "the state should be NEGOTIATING"); - LOG_INFO("candidate[ %s ]", candidate); + LOG_INFO("candidate: %s", candidate); ret = _webrtcbin_add_ice_candidate(webrtc, candidate);