From: Eunhae Choi Date: Mon, 5 Feb 2018 07:56:00 +0000 (+0900) Subject: [0.6.91] add sound focus lock to avoid duplicated unregister X-Git-Tag: submit/tizen_4.0/20180205.083324^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=63602ba2c05e66142b9173cfc50ef8f256530b46;p=platform%2Fcore%2Fmultimedia%2Flibmm-player.git [0.6.91] add sound focus lock to avoid duplicated unregister - by duplicated unregister operation, the gdbus shared connection can be closed Change-Id: I9d1cb487bd95c7b7c80dbb922a1f4f981c7e572a --- diff --git a/packaging/libmm-player.spec b/packaging/libmm-player.spec index 4c43d26..74ebd18 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.90 +Version: 0.6.91 Release: 0 Group: Multimedia/Libraries License: Apache-2.0 diff --git a/src/include/mm_player_sound_focus.h b/src/include/mm_player_sound_focus.h index a9bb690..4538dce 100644 --- a/src/include/mm_player_sound_focus.h +++ b/src/include/mm_player_sound_focus.h @@ -52,6 +52,7 @@ typedef struct { int session_type; int session_flags; int focus_changed_msg; // MMPlayerFocusChangedMsg + GMutex focus_lock; } MMPlayerSoundFocus; diff --git a/src/include/mm_player_utils.h b/src/include/mm_player_utils.h index 281250d..9cca3ce 100644 --- a/src/include/mm_player_utils.h +++ b/src/include/mm_player_utils.h @@ -118,6 +118,10 @@ do { \ #define MMPLAYER_SUBTITLE_INFO_WAIT_UNTIL(x_player, end_time) g_cond_wait_until(&((mm_player_t *)x_player)->subtitle_info_cond, &((mm_player_t *)x_player)->subtitle_info_mutex, end_time) #define MMPLAYER_SUBTITLE_INFO_SIGNAL(x_player) g_cond_signal(&((mm_player_t *)x_player)->subtitle_info_cond); +/* sound focus lock */ +#define MMPLAYER_SOUND_FOCUS_LOCK(x_player_sound_focus) g_mutex_lock(&((MMPlayerSoundFocus *)x_player_sound_focus)->focus_lock) +#define MMPLAYER_SOUND_FOCUS_UNLOCK(x_player_sound_focus) g_mutex_unlock(&((MMPlayerSoundFocus *)x_player_sound_focus)->focus_lock) + #if 0 #define MMPLAYER_FENTER(); LOGD(""); #define MMPLAYER_FLEAVE(); LOGD(""); diff --git a/src/mm_player_priv.c b/src/mm_player_priv.c index 1fe7e0a..f9fdcef 100644 --- a/src/mm_player_priv.c +++ b/src/mm_player_priv.c @@ -8691,6 +8691,9 @@ _mmplayer_create_player(MMHandleType handle) g_mutex_init(&player->subtitle_info_mutex); g_cond_init(&player->subtitle_info_cond); + /* create sound focus lock */ + g_mutex_init(&player->sound_focus.focus_lock); + player->streaming_type = STREAMING_SERVICE_NONE; /* give default value of audio effect setting */ @@ -9052,6 +9055,9 @@ _mmplayer_destroy(MMHandleType handle) /* release media stream callback lock */ g_mutex_clear(&player->media_stream_cb_lock); + /* release sound focus lock */ + g_mutex_clear(&player->sound_focus.focus_lock); + MMPLAYER_FLEAVE(); return MM_ERROR_NONE; diff --git a/src/mm_player_sound_focus.c b/src/mm_player_sound_focus.c index 0911dcf..dcb74fa 100644 --- a/src/mm_player_sound_focus.c +++ b/src/mm_player_sound_focus.c @@ -357,6 +357,7 @@ _mmplayer_sound_unregister(MMPlayerSoundFocus* sound_focus) MMPLAYER_FENTER(); MMPLAYER_CHECK_SOUND_FOCUS_INSTANCE(sound_focus); + MMPLAYER_SOUND_FOCUS_LOCK(sound_focus); LOGD("unregister sound focus callback\n"); @@ -385,6 +386,7 @@ _mmplayer_sound_unregister(MMPlayerSoundFocus* sound_focus) sound_focus->connected_id = 0; } + MMPLAYER_SOUND_FOCUS_UNLOCK(sound_focus); MMPLAYER_FLEAVE(); return MM_ERROR_NONE;