From: Suyeon Hwang Date: Tue, 28 Sep 2021 04:07:50 +0000 (+0900) Subject: Remove unvaluable deadcode by changing function prototype X-Git-Tag: submit/tizen/20211012.065801~4 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=20b281c245602bdbd444da4dd87528999f971c07;p=platform%2Fcore%2Fuifw%2Ftts.git Remove unvaluable deadcode by changing function prototype Change-Id: I26fbd60f320ab8d0bb5452cb7246d9e37bc80361 Signed-off-by: Suyeon Hwang --- diff --git a/server/ttsd_player.c b/server/ttsd_player.c index 6895d0cb..06e1a1c8 100644 --- a/server/ttsd_player.c +++ b/server/ttsd_player.c @@ -572,19 +572,19 @@ static bool __does_interrupt_have_focus(sound_stream_focus_change_reason_e reaso return true; } -int ttsd_player_check_current_playback_focus(bool *is_current_interrupt) +bool ttsd_player_does_interrupt_have_playback_focus() { - *is_current_interrupt = false; - sound_stream_focus_change_reason_e reason; int sound_behavior = 0; char *extra_info = NULL; - if (SOUND_MANAGER_ERROR_NONE == sound_manager_get_current_playback_focus(&reason, &sound_behavior, &extra_info)) { - *is_current_interrupt = __does_interrupt_have_focus(reason, sound_behavior, extra_info); + if (SOUND_MANAGER_ERROR_NONE != sound_manager_get_current_playback_focus(&reason, &sound_behavior, &extra_info)) { + SLOG(LOG_ERROR, tts_tag(), "[Player ERROR] Fail to get focus information"); + return false; } + bool result = __does_interrupt_have_focus(reason, sound_behavior, extra_info); free(extra_info); - return TTSD_ERROR_NONE; + return result; } static void __play_thread(void *data, Ecore_Thread *thread) diff --git a/server/ttsd_player.h b/server/ttsd_player.h index de80ad9d..cd78eb47 100644 --- a/server/ttsd_player.h +++ b/server/ttsd_player.h @@ -1,5 +1,5 @@ /* -* Copyright (c) 2011-2016 Samsung Electronics Co., Ltd All Rights Reserved +* Copyright (c) 2011-2016 Samsung Electronics Co., Ltd All Rights Reserved * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -32,7 +32,7 @@ typedef enum { } ttsd_player_state_e; /* -* TTSD Player Interfaces +* TTSD Player Interfaces */ int ttsd_player_init(); @@ -57,7 +57,7 @@ int ttsd_player_all_stop(); int ttsd_player_play_pcm(int uid); -int ttsd_player_check_current_playback_focus(bool *is_current_interrupt); +bool ttsd_player_does_interrupt_have_playback_focus(); int ttsd_player_set_background_volume_ratio(double ratio); diff --git a/server/ttsd_server.c b/server/ttsd_server.c index 0701e858..ed98b311 100644 --- a/server/ttsd_server.c +++ b/server/ttsd_server.c @@ -980,17 +980,10 @@ int ttsd_server_play(int uid, const char* credential) } /* check the current playback focus */ - if (TTSD_MODE_INTERRUPT != ttsd_get_mode()) { - bool is_current_interrupt = false; - if (0 != ttsd_player_check_current_playback_focus(&is_current_interrupt)) { - SLOG(LOG_ERROR, tts_tag(), "[Server ERROR] Fail to check the current playback focus"); - } else { - if (true == is_current_interrupt) { - SLOG(LOG_WARN, tts_tag(), "[Server WARNING] Current playback focus is set on Interrupt mode. Cannot play default, screen reader, and noti modes."); - ttsd_data_clear_data(uid); - return TTSD_ERROR_AUDIO_POLICY_BLOCKED; - } - } + if (TTSD_MODE_INTERRUPT != ttsd_get_mode() && ttsd_player_does_interrupt_have_playback_focus()) { + SLOG(LOG_WARN, tts_tag(), "[Server WARNING] Current playback focus is set on Interrupt mode. Cannot play default, screen reader, and noti modes."); + ttsd_data_clear_data(uid); + return TTSD_ERROR_AUDIO_POLICY_BLOCKED; } int current_uid = ttsd_data_get_current_playing();