Reorder mutex to prevent deadlock 93/264793/1 submit/tizen/20210930.015514
authorSuyeon Hwang <stom.hwang@samsung.com>
Thu, 30 Sep 2021 01:44:37 +0000 (10:44 +0900)
committerSuyeon Hwang <stom.hwang@samsung.com>
Thu, 30 Sep 2021 01:44:37 +0000 (10:44 +0900)
Change-Id: Iecb2765a2362d7f3407a26c4e3399fff0fe10f57
Signed-off-by: Suyeon Hwang <stom.hwang@samsung.com>
server/ttsd_player.c

index 485668a2d43bccb63bb77af343d0da279599328d..df2c090c6922686ca4eb968c0f06e5e17ab886b4 100644 (file)
@@ -865,16 +865,15 @@ static void __play_thread(void *data, Ecore_Thread *thread)
                                ret = audio_out_prepare(g_audio_h);
                                if (AUDIO_IO_ERROR_NONE != ret) {
                                        SLOG(LOG_ERROR, tts_tag(), "[Player ERROR] Fail to prepare audio : %d", ret);
-                                       pthread_mutex_lock(&g_player_control_mutex);
-                                       g_playing_info = NULL;
-                                       pthread_mutex_unlock(&g_player_control_mutex);
-
                                        /* unset volume policy, volume will be 100% */
                                        __unset_policy_for_playing();
 
                                        ttsd_data_clear_sound_data(&sound_data);
 
                                        pthread_mutex_unlock(&g_play_thread_mutex);
+                                       pthread_mutex_lock(&g_player_control_mutex);
+                                       g_playing_info = NULL;
+                                       pthread_mutex_unlock(&g_player_control_mutex);
                                        return;
                                }
                                SLOG(LOG_DEBUG, tts_tag(), "[Player SUCCESS] Prepare audio");