*/
int ttsd_player_init()
{
+ pthread_mutex_lock(&g_player_control_mutex);
g_playing_info = NULL;
g_audio_state = AUDIO_STATE_NONE;
g_audio_h = NULL;
ret = sound_manager_create_stream_information(SOUND_STREAM_TYPE_VOICE_INFORMATION, __player_focus_state_cb, NULL, &g_stream_info_h);
if (SOUND_MANAGER_ERROR_NONE != ret) {
SLOG(LOG_ERROR, tts_tag(), "[Player ERROR] Fail to create stream info");
+ pthread_mutex_unlock(&g_player_control_mutex);
return -1;
} else {
SLOG(LOG_DEBUG, tts_tag(), "[Player SUCCESS] Create stream info");
SLOG(LOG_ERROR, tts_tag(), "[Player ERROR] Fail to add sound focus watch callback");
sound_manager_destroy_stream_information(g_stream_info_h);
g_stream_info_h = NULL;
+ pthread_mutex_unlock(&g_player_control_mutex);
return -1;
} else {
SLOG(LOG_DEBUG, tts_tag(), "[Player SUCCESS] Add sound focus watch callback");
sound_manager_remove_focus_state_watch_cb(g_focus_watch_id);
g_stream_info_h = NULL;
g_focus_watch_id = -1;
+ pthread_mutex_unlock(&g_player_control_mutex);
return -1;
}
g_player_init = true;
+ pthread_mutex_unlock(&g_player_control_mutex);
+
return 0;
}
EXPECT_EQ(ret, TTS_ERROR_NONE);
ret = strncmp(text_repeat, "repeat success", strlen(text_repeat));
+ free(text_repeat);
EXPECT_EQ(ret, 0);
EXPECT_EQ(true, __is_state_changed(TTS_STATE_PLAYING, 5));