From 408003be70af11ae109685f760f15e87b6455a12 Mon Sep 17 00:00:00 2001 From: "sooyeon.kim" Date: Wed, 28 Feb 2018 18:39:44 +0900 Subject: [PATCH] Fix wav-player API Change-Id: I7e57ffdf3c30797118186b749d8d4bec38d4df3e Signed-off-by: sooyeon.kim --- server/sttd_server.c | 34 ++++++++++++++++++++++++++-------- 1 file changed, 26 insertions(+), 8 deletions(-) diff --git a/server/sttd_server.c b/server/sttd_server.c index 38735c7..90f67ad 100644 --- a/server/sttd_server.c +++ b/server/sttd_server.c @@ -1184,10 +1184,20 @@ int sttd_server_start(int uid, const char* lang, const char* recognition_type, i if (NULL != sound) { int id = 0; intptr_t puid = (intptr_t)uid; - ret = wav_player_start(sound, SOUND_TYPE_MEDIA, __sttd_start_sound_completed_cb, (void*)puid, &id); - if (WAV_PLAYER_ERROR_NONE != ret) { - SLOG(LOG_ERROR, TAG_STTD, "[Server ERROR] Fail to play wav"); + sound_stream_info_h wav_stream_info_h; + if (0 != sound_manager_create_stream_information(SOUND_STREAM_TYPE_MEDIA, NULL, NULL, &wav_stream_info_h)) { + SLOG(LOG_ERROR, TAG_STTD, "[Server ERROR] Fail to create stream info for playing wav"); is_sound_done = true; + } else { + ret = wav_player_start_new(sound, wav_stream_info_h, __sttd_start_sound_completed_cb, (void*)puid, &id); + if (WAV_PLAYER_ERROR_NONE != ret) { + SLOG(LOG_ERROR, TAG_STTD, "[Server ERROR] Fail to play wav"); + is_sound_done = true; + } + + if (0 != sound_manager_destroy_stream_information(wav_stream_info_h)) { + SLOG(LOG_ERROR, TAG_STTD, "[Server ERROR] Fail to destroy stream info for playing wav"); + } } free(sound); sound = NULL; @@ -1361,13 +1371,21 @@ int sttd_server_stop(int uid) if (NULL != sound) { int id = 0; intptr_t puid = (intptr_t)uid; - ret = wav_player_start(sound, SOUND_TYPE_MEDIA, __sttd_stop_sound_completed_cb, (void*)puid, &id); - if (WAV_PLAYER_ERROR_NONE != ret) { - SLOG(LOG_ERROR, TAG_STTD, "[Server ERROR] Fail to play wav"); + sound_stream_info_h wav_stream_info_h; + if (0 != sound_manager_create_stream_information(SOUND_STREAM_TYPE_MEDIA, NULL, NULL, &wav_stream_info_h)) { + SLOG(LOG_ERROR, TAG_STTD, "[Server ERROR] Fail to create stream info for playing wav"); } else { - SLOG(LOG_DEBUG, TAG_STTD, "[Server] Play wav : %s", sound); - } + ret = wav_player_start_new(sound, wav_stream_info_h, __sttd_stop_sound_completed_cb, (void*)puid, &id); + if (WAV_PLAYER_ERROR_NONE != ret) { + SLOG(LOG_ERROR, TAG_STTD, "[Server ERROR] Fail to play wav"); + } else { + SLOG(LOG_DEBUG, TAG_STTD, "[Server] Play wav : %s", sound); + } + if (0 != sound_manager_destroy_stream_information(wav_stream_info_h)) { + SLOG(LOG_ERROR, TAG_STTD, "[Server ERROR] Fail to destroy stream info for playing wav"); + } + } free(sound); g_processing_timer = ecore_timer_add(g_processing_timeout, __time_out_for_processing, NULL); -- 2.7.4