From a8f11a7fabffb9c8292d5064270bbfb34964388c Mon Sep 17 00:00:00 2001 From: Sangchul Lee Date: Tue, 6 Oct 2020 16:37:02 +0900 Subject: [PATCH] Unlock mutex before invoking state callback Codes about the mutex to secure the state are also added in __webrtcbin_peer_connection_state_cb(). [Version] 0.1.35 [Issue Type] Improvement Change-Id: I1c811912b3d9432fbae74b0c2037e9a78247fe23 Signed-off-by: Sangchul Lee --- packaging/capi-media-webrtc.spec | 2 +- src/webrtc_private.c | 11 +++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/packaging/capi-media-webrtc.spec b/packaging/capi-media-webrtc.spec index 0ed53a9d..6cdf74ce 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.34 +Version: 0.1.35 Release: 0 Group: Multimedia/API License: Apache-2.0 diff --git a/src/webrtc_private.c b/src/webrtc_private.c index e66b2e0b..ef72e4a5 100644 --- a/src/webrtc_private.c +++ b/src/webrtc_private.c @@ -223,11 +223,12 @@ static gboolean __bus_watch_cb(GstBus *bus, GstMessage *message, gpointer user_d if (__meet_gst_state(webrtc->pend_state, gst_state_new)) { webrtc_state_e old_state = webrtc->state; webrtc->state = webrtc->pend_state; - + g_mutex_unlock(&webrtc->mutex); __invoke_state_changed_cb(webrtc, old_state, webrtc->state); + break; } - g_mutex_unlock(&webrtc->mutex); + g_mutex_unlock(&webrtc->mutex); break; case GST_MESSAGE_ASYNC_DONE: @@ -517,11 +518,17 @@ static void __webrtcbin_peer_connection_state_cb(GstElement *webrtcbin, GParamSp switch (peer_connection_state) { case GST_WEBRTC_PEER_CONNECTION_STATE_NEW: new_state = "NEW"; + + g_mutex_lock(&webrtc->mutex); if (webrtc->state == WEBRTC_STATE_NEGOTIATING) { webrtc_state_e old_state = webrtc->state; webrtc->state = webrtc->pend_state = WEBRTC_STATE_PLAYING; + g_mutex_unlock(&webrtc->mutex); __invoke_state_changed_cb(webrtc, old_state, webrtc->state); + break; } + + g_mutex_unlock(&webrtc->mutex); break; case GST_WEBRTC_PEER_CONNECTION_STATE_CONNECTING: -- 2.34.1