webrtc: Print logs within critical section 27/244927/3
authorSangchul Lee <sc11.lee@samsung.com>
Mon, 28 Sep 2020 03:58:19 +0000 (12:58 +0900)
committerSangchul Lee <sc11.lee@samsung.com>
Thu, 8 Oct 2020 07:04:03 +0000 (16:04 +0900)
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 <sc11.lee@samsung.com>
packaging/capi-media-webrtc.spec
src/webrtc.c

index 0cd4d59aa5cc4a411128398d70a915f9c6178e59..c0be7d28a2fc546129ae5ccae686aa3bfd2bac3c 100644 (file)
@@ -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
index a8109bf642322029c3cd1f17caf264961331a70c..9a92840814a058600c4f040a3730fcf34b2434f4 100644 (file)
@@ -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);