Remove unvaluable deadcode by changing function prototype 30/264930/2
authorSuyeon Hwang <stom.hwang@samsung.com>
Tue, 28 Sep 2021 04:07:50 +0000 (13:07 +0900)
committerSuyeon Hwang <stom.hwang@samsung.com>
Tue, 12 Oct 2021 05:36:19 +0000 (14:36 +0900)
Change-Id: I26fbd60f320ab8d0bb5452cb7246d9e37bc80361
Signed-off-by: Suyeon Hwang <stom.hwang@samsung.com>
server/ttsd_player.c
server/ttsd_player.h
server/ttsd_server.c

index 6895d0cb015dde6bfec823abfc409352cf86ad8a..06e1a1c87d96164d8b340c70121e435bb1ded14c 100644 (file)
@@ -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)
index de80ad9da4f99414d79c41442d987a1246367a33..cd78eb47a7780f74e9cdffc8ca0a3ce3be78c90e 100644 (file)
@@ -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);
 
index 0701e8589b68c9c5aa074d282a204fe3515c0f81..ed98b311482fdf8de46b6a2e927ffac3de5a88f5 100644 (file)
@@ -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();