* Internal Interfaces
*/
+static bool __is_player_valid(player_s* player)
+{
+ if (NULL == player || NULL == g_playing_info) {
+ SLOG(LOG_ERROR, tts_tag(), "[ERROR] player is NULL");
+ return false;
+ }
+
+ if (g_playing_info != player || g_playing_info->uid != player->uid) {
+ SLOG(LOG_ERROR, tts_tag(), "[ERROR] player is not current player");
+ return false;
+ }
+
+ return true;
+}
+
player_s* __player_get_item(int uid)
{
GList *iter = NULL;
__set_policy_for_playing(40);
while (1) { // 1st while(1)
/* check g_playing_info one more time */
- if (NULL == g_playing_info) {
- SLOG(LOG_INFO, tts_tag(), "[Player INFO] No current player");
+ if (false == __is_player_valid(player)) {
+ SLOG(LOG_INFO, tts_tag(), "[Player INFO] Player is not valid");
g_audio_state = AUDIO_STATE_READY;
ret = audio_out_unprepare(g_audio_h);
if (AUDIO_IO_ERROR_NONE != ret) {
__unset_policy_for_playing();
return;
}
- SLOG(LOG_INFO, tts_tag(), "[Player] Sound info : id(%d) data(%p) size(%d) audiotype(%d) rate(%d) event(%d)",
+ SLOG(LOG_INFO, tts_tag(), "[Player] Sound info : id(%d) data(%p) size(%d) audiotype(%d) rate(%d) event(%d)",
sound_data->utt_id, sound_data->data, sound_data->data_size, sound_data->audio_type, sound_data->rate, sound_data->event);
} else { // NO player->is_paused_data
sound_data = NULL;
}
if (0 != ttsdc_send_utt_start_message(pid, player->uid, sound_data->utt_id)) {
- SLOG(LOG_ERROR, tts_tag(), "[Send ERROR] Fail to send Utterance Start Signal : pid(%d), uid(%d), uttid(%d)",
+ SLOG(LOG_ERROR, tts_tag(), "[Send ERROR] Fail to send Utterance Start Signal : pid(%d), uid(%d), uttid(%d)",
pid, player->uid, sound_data->utt_id);
}
SLOG(LOG_INFO, tts_tag(), "[Player] Start utterance : uid(%d), uttid(%d)", player->uid, sound_data->utt_id);
__unset_policy_for_playing();
if (0 != ttsdc_send_utt_finish_message(pid, player->uid, sound_data->utt_id)) {
- SLOG(LOG_ERROR, tts_tag(), "[Send ERROR] Fail to send Utterance Completed Signal : pid(%d), uid(%d), uttid(%d)",
+ SLOG(LOG_ERROR, tts_tag(), "[Send ERROR] Fail to send Utterance Completed Signal : pid(%d), uid(%d), uttid(%d)",
pid, player->uid, sound_data->utt_id);
} else {
SLOG(LOG_INFO, tts_tag(), "[Player] Finish utterance : uid(%d), uttid(%d)", player->uid, sound_data->utt_id);
}
if (0 != ttsdc_send_utt_finish_message(pid, player->uid, sound_data->utt_id)) {
- SLOG(LOG_ERROR, tts_tag(), "[Send ERROR] Fail to send Utterance Completed Signal : pid(%d), uid(%d), uttid(%d)",
+ SLOG(LOG_ERROR, tts_tag(), "[Send ERROR] Fail to send Utterance Completed Signal : pid(%d), uid(%d), uttid(%d)",
pid, player->uid, sound_data->utt_id);
/* unset volume policy, volume will be 100% */
__unset_policy_for_playing();
player_s* current;
current = __player_get_item(uid);
if (NULL == current) {
- SECURE_SLOG(LOG_ERROR, tts_tag(), "[Player ERROR] uid(%d) is not valid", uid);
+ SECURE_SLOG(LOG_ERROR, tts_tag(), "[Player ERROR] uid(%d) is not valid", uid);
return -1;
}