From: Sangchul Lee Date: Thu, 3 Dec 2020 06:46:53 +0000 (+0900) Subject: [0.6.250] Improve to defend the spurious wakeup issue of g_cond_wait_until() X-Git-Tag: accepted/tizen/unified/20210113.121046~1 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fmultimedia%2Flibmm-player.git;a=commitdiff_plain;h=ed867ad4113fe0cd9a4af9062087edeaad0055eb [0.6.250] Improve to defend the spurious wakeup issue of g_cond_wait_until() It is expressed in : https://developer.gnome.org/glib/stable/glib-Threads.html#g-cond-wait-until Change-Id: Id5d35f6a403df01c7a976dff7a3b825217f9ba34 Signed-off-by: Sangchul Lee --- diff --git a/packaging/libmm-player.spec b/packaging/libmm-player.spec index a8ea8e7..86b01f3 100644 --- a/packaging/libmm-player.spec +++ b/packaging/libmm-player.spec @@ -1,6 +1,6 @@ Name: libmm-player Summary: Multimedia Framework Player Library -Version: 0.6.249 +Version: 0.6.250 Release: 0 Group: Multimedia/Libraries License: Apache-2.0 diff --git a/src/mm_player_priv.c b/src/mm_player_priv.c index c25a6fc..f6f6305 100644 --- a/src/mm_player_priv.c +++ b/src/mm_player_priv.c @@ -3273,6 +3273,7 @@ __mmplayer_video_stream_get_bo(mmplayer_t *player, int size) GList *l = NULL; MMPLAYER_RETURN_VAL_IF_FAIL(player, NULL); gboolean ret = TRUE; + gint64 end_time = 0; /* check DRC, if it is, destroy the prev bo list to create again */ if (player->video_bo_size != size) { @@ -3325,6 +3326,9 @@ __mmplayer_video_stream_get_bo(mmplayer_t *player, int size) } } + if (player->ini.video_bo_timeout > 0) + end_time = g_get_monotonic_time() + player->ini.video_bo_timeout * G_TIME_SPAN_SECOND; + while (TRUE) { /* get bo from list*/ for (l = g_list_first(player->video_bo_list); l; l = g_list_next(l)) { @@ -3336,20 +3340,20 @@ __mmplayer_video_stream_get_bo(mmplayer_t *player, int size) return tbm_bo_ref(tmp->bo); } } - if (!ret) { - LOGE("failed to get bo in %d timeout", player->ini.video_bo_timeout); - MMPLAYER_VIDEO_BO_UNLOCK(player); - return NULL; - } if (player->ini.video_bo_timeout <= 0) { MMPLAYER_VIDEO_BO_WAIT(player); } else { - gint64 timeout = g_get_monotonic_time() + player->ini.video_bo_timeout * G_TIME_SPAN_SECOND; - ret = MMPLAYER_VIDEO_BO_WAIT_UNTIL(player, timeout); + ret = MMPLAYER_VIDEO_BO_WAIT_UNTIL(player, end_time); + if (!ret) { + LOGE("failed to get bo in %d timeout", player->ini.video_bo_timeout); + break; + } } - continue; } + + MMPLAYER_VIDEO_BO_UNLOCK(player); + return NULL; } static void