Fix wav-player API 98/171298/2
authorsooyeon.kim <sooyeon.kim@samsung.com>
Wed, 28 Feb 2018 09:39:44 +0000 (18:39 +0900)
committersooyeon.kim <sooyeon.kim@samsung.com>
Fri, 2 Mar 2018 01:22:41 +0000 (10:22 +0900)
Change-Id: I7e57ffdf3c30797118186b749d8d4bec38d4df3e
Signed-off-by: sooyeon.kim <sooyeon.kim@samsung.com>
server/sttd_server.c

index 38735c7..90f67ad 100644 (file)
@@ -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);