Add sound manager destroy when setting sound manager watch cb is failed 48/167948/1
authorsooyeon.kim <sooyeon.kim@samsung.com>
Tue, 19 Dec 2017 11:16:18 +0000 (20:16 +0900)
committerSuyeon Hwang <stom.hwang@samsung.com>
Tue, 23 Jan 2018 05:35:05 +0000 (05:35 +0000)
Change-Id: I03ad2dd718ebbe8a893390fe8856842a9c8f3a92
Signed-off-by: sooyeon.kim <sooyeon.kim@samsung.com>
(cherry picked from commit e780e3e850703ff9d9efdc2aa45e4f13f60ea155)

server/ttsd_player.c

index 54d1ef6..be47d32 100644 (file)
@@ -767,6 +767,7 @@ int ttsd_player_init()
        ret = sound_manager_add_focus_state_watch_cb(SOUND_STREAM_FOCUS_FOR_PLAYBACK, __player_focus_state_watch_cb, NULL, &g_focus_watch_id);
        if (SOUND_MANAGER_ERROR_NONE != ret) {
                SLOG(LOG_ERROR, tts_tag(), "[Player ERROR] Fail to add sound focus watch callback");
+               sound_manager_destroy_stream_information(g_stream_info_h);
                return -1;
        } else {
                SLOG(LOG_DEBUG, tts_tag(), "[Player SUCCESS] Add sound focus watch callback");
@@ -775,8 +776,11 @@ int ttsd_player_init()
        ecore_thread_max_set(1);
 
        ret = __create_audio_out(TTSE_AUDIO_TYPE_RAW_S16, 16000);
-       if (0 != ret)
+       if (0 != ret) {
+               sound_manager_destroy_stream_information(g_stream_info_h);
+               sound_manager_remove_focus_state_watch_cb(g_focus_watch_id);
                return -1;
+       }
 
        g_player_init = true;