From: Sangchul Lee Date: Wed, 9 Dec 2020 08:37:07 +0000 (+0900) Subject: webrtc_display: Improve codes regarding applying display in default context X-Git-Tag: submit/tizen/20210729.023123~172 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1376794e613c0a903df5e275cb3d803ef289f34b;p=platform%2Fcore%2Fapi%2Fwebrtc.git webrtc_display: Improve codes regarding applying display in default context Use g_main_context_invoke() instead of g_idle_add() to call the callback function directly if the context is owned by caller. Use g_idle_remove_by_data() to remove the idle function that might remain. [Version] 0.1.70 [Issue Type] Improvement Change-Id: I089c3cc876f55330050f532719d391a0181d07dc Signed-off-by: Sangchul Lee --- diff --git a/packaging/capi-media-webrtc.spec b/packaging/capi-media-webrtc.spec index 88da9519..0bbc79a5 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.69 +Version: 0.1.70 Release: 0 Group: Multimedia/API License: Apache-2.0 diff --git a/src/webrtc_display.c b/src/webrtc_display.c index a47c46f9..b500ac30 100644 --- a/src/webrtc_display.c +++ b/src/webrtc_display.c @@ -621,7 +621,7 @@ void _video_stream_decoded_cb(GstElement *object, GstBuffer *buffer, GstPad *pad webrtc_display_s *display = (webrtc_display_s*)data; media_packet_h packet; - RET_IF(display == NULL, "sink is NULL"); + RET_IF(display == NULL, "display is NULL"); LOG_DEBUG("object[%p] buffer[%p] pad[%p] display[%p]", object, buffer, pad, display); @@ -703,7 +703,7 @@ int _apply_display(webrtc_display_s *display) case WEBRTC_DISPLAY_TYPE_OVERLAY: LOG_DEBUG("it's OVERLAY type"); - g_idle_add(__set_overlay_display_idle_cb, display); + g_main_context_invoke(NULL, __set_overlay_display_idle_cb, display); break; case WEBRTC_DISPLAY_TYPE_EVAS: @@ -712,13 +712,13 @@ int _apply_display(webrtc_display_s *display) if (display->tbm == NULL) display->tbm = _alloc_tbm(); - g_idle_add(__set_evas_display_idle_cb, display); + g_main_context_invoke(NULL, __set_evas_display_idle_cb, display); break; case WEBRTC_DISPLAY_TYPE_ECORE_WL: LOG_DEBUG("it's ECORE_WL type"); - g_idle_add(__set_overlay_display_idle_cb, display); + g_main_context_invoke(NULL, __set_overlay_display_idle_cb, display); break; default: @@ -747,10 +747,12 @@ webrtc_display_s *_alloc_display(void) void _release_display(webrtc_display_s *display) { - RET_IF(display == NULL, "webrtc is NULL"); + RET_IF(display == NULL, "display is NULL"); g_mutex_lock(&display->mutex); + g_idle_remove_by_data(display); + if (display->mm_display) { LOG_DEBUG("deinit display->mm_display[%p]", display->mm_display); mm_display_interface_deinit(display->mm_display);