From 8caeef63169161121216477d76438dad30dc3006 Mon Sep 17 00:00:00 2001 From: "aravind.gara" Date: Tue, 22 Nov 2016 21:59:07 +0900 Subject: [PATCH] sound-manager API changed Change-Id: I79c39cb073eb8741f24638408a5a2a6fbea4b667 Signed-off-by: aravind.gara (cherry picked from commit e39fe363502ddd9e6093c999bbb11390683639a3) --- server/ttsd_player.c | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/server/ttsd_player.c b/server/ttsd_player.c index 86fb8b4..11b5158 100644 --- a/server/ttsd_player.c +++ b/server/ttsd_player.c @@ -94,7 +94,8 @@ player_s* __player_get_item(int uid) return NULL; } -void __player_focus_state_cb(sound_stream_info_h stream_info, sound_stream_focus_change_reason_e reason_for_change, const char *extra_info, void *user_data) +void __player_focus_state_cb(sound_stream_info_h stream_info, sound_stream_focus_mask_e focus_mask, sound_stream_focus_state_e focus_state, + sound_stream_focus_change_reason_e reason_for_change, int sound_behavior, const char *extra_info, void *user_data) { SLOG(LOG_DEBUG, tts_tag(), "===== Focus state changed cb"); @@ -102,18 +103,9 @@ void __player_focus_state_cb(sound_stream_info_h stream_info, sound_stream_focus SLOG(LOG_ERROR, tts_tag(), "[Player ERROR] Invalid stream info handle"); return; } + SLOG(LOG_WARN, tts_tag(), "[Player] focus state changed to (%d) with reason(%d)", (int)focus_state, (int)reason_for_change); - int ret; - sound_stream_focus_state_e state_for_playback ; - ret = sound_manager_get_focus_state(g_stream_info_h, &state_for_playback, NULL); - if (SOUND_MANAGER_ERROR_NONE != ret) { - SLOG(LOG_ERROR, tts_tag(), "[Player ERROR] Fail to get focus state"); - return; - } - - SLOG(LOG_WARN, tts_tag(), "[Player] focus state changed to (%d) with reason(%d)", (int)state_for_playback, (int)reason_for_change); - - if (AUDIO_STATE_PLAY == g_audio_state && SOUND_STREAM_FOCUS_STATE_RELEASED == state_for_playback) { + if (AUDIO_STATE_PLAY == g_audio_state && focus_mask == SOUND_STREAM_FOCUS_FOR_PLAYBACK && SOUND_STREAM_FOCUS_STATE_RELEASED == focus_state) { if (TTSD_MODE_DEFAULT == ttsd_get_mode()) { g_audio_state = AUDIO_STATE_READY; @@ -207,7 +199,7 @@ static void __set_policy_for_playing(int volume) /* Set stream info */ int ret; if (TTSD_MODE_DEFAULT == ttsd_get_mode()) { - ret = sound_manager_acquire_focus(g_stream_info_h, SOUND_STREAM_FOCUS_FOR_PLAYBACK, NULL); + ret = sound_manager_acquire_focus(g_stream_info_h, SOUND_STREAM_FOCUS_FOR_PLAYBACK, SOUND_BEHAVIOR_NONE, NULL); if (SOUND_MANAGER_ERROR_NONE != ret) { SLOG(LOG_WARN, tts_tag(), "[Player WARNING] Fail to acquire focus"); } @@ -225,7 +217,7 @@ static void __unset_policy_for_playing() int ret; /* Unset stream info */ if (TTSD_MODE_DEFAULT == ttsd_get_mode()) { - ret = sound_manager_release_focus(g_stream_info_h, SOUND_STREAM_FOCUS_FOR_PLAYBACK, NULL); + ret = sound_manager_release_focus(g_stream_info_h, SOUND_STREAM_FOCUS_FOR_PLAYBACK, SOUND_BEHAVIOR_NONE, NULL); if (SOUND_MANAGER_ERROR_NONE != ret) { SLOG(LOG_WARN, tts_tag(), "[Player WARNING] Fail to release focus"); } -- 2.7.4