int ttsd_player_release(void)
{
+ pthread_mutex_lock(&g_player_control_mutex);
if (false == g_player_init) {
SLOG(LOG_ERROR, tts_tag(), "[Player ERROR] Not Initialized");
+ pthread_mutex_unlock(&g_player_control_mutex);
return TTSD_ERROR_OPERATION_FAILED;
}
SLOG(LOG_DEBUG, tts_tag(), "[Player DEBUG] Thread is released");
ret = __destroy_audio_out();
- if (0 != ret)
+ if (0 != ret) {
+ pthread_mutex_unlock(&g_player_control_mutex);
return -1;
+ }
ret = sound_manager_destroy_stream_information(g_stream_info_h);
if (SOUND_MANAGER_ERROR_NONE != ret) {
g_stream_info_h = NULL;
g_focus_watch_id = -1;
+ pthread_mutex_unlock(&g_player_control_mutex);
+
return 0;
}
int ttsd_player_destroy_instance(int uid)
{
+ pthread_mutex_lock(&g_player_control_mutex);
if (false == g_player_init) {
SLOG(LOG_ERROR, tts_tag(), "[Player ERROR] Not Initialized");
+ pthread_mutex_unlock(&g_player_control_mutex);
return -1;
}
current = __player_get_item(uid);
if (NULL == current) {
SLOG(LOG_ERROR, tts_tag(), "[Player ERROR] uid(%d) is not valid", uid);
+ pthread_mutex_unlock(&g_player_control_mutex);
return -1;
}
iter = g_list_next(iter);
}
}
+ pthread_mutex_unlock(&g_player_control_mutex);
SLOG(LOG_DEBUG, tts_tag(), "[PLAYER Success] Destroy instance");
app_tts_state_e state;
if (0 > ttsd_data_get_client_state(data->uid, &state)) {
SLOG(LOG_ERROR, tts_tag(), "[player ERROR] uid(%d) is not valid", data->uid);
+ pthread_mutex_unlock(&g_player_control_mutex);
ttsd_player_destroy_instance(data->uid);
+ pthread_mutex_lock(&g_player_control_mutex);
iter = g_list_next(iter);
continue;
}
}
ttsd_mode_e mode = TTSD_MODE_DEFAULT;
- if (!strncmp("noti", last, strlen(last))) {
- mode = TTSD_MODE_NOTIFICATION;
- } else if (!strncmp("sr", last, strlen(last))) {
- mode = TTSD_MODE_SCREEN_READER;
- } else if (!strncmp("interrupt", last, strlen(last))) {
- mode = TTSD_MODE_INTERRUPT;
- } else {
- SLOG(LOG_INFO, tts_tag(), "[INFO] mode (%s)", last);
+ if (NULL != last) {
+ if (!strncmp("noti", last, strlen(last))) {
+ mode = TTSD_MODE_NOTIFICATION;
+ } else if (!strncmp("sr", last, strlen(last))) {
+ mode = TTSD_MODE_SCREEN_READER;
+ } else if (!strncmp("interrupt", last, strlen(last))) {
+ mode = TTSD_MODE_INTERRUPT;
+ } else {
+ SLOG(LOG_INFO, tts_tag(), "[INFO] mode (%s)", last);
+ }
}
free(appid);