Fix condition for checking return value of play_sound() 41/295741/1
authorSuyeon Hwang <stom.hwang@samsung.com>
Thu, 13 Jul 2023 06:11:11 +0000 (15:11 +0900)
committerSuyeon Hwang <stom.hwang@samsung.com>
Thu, 13 Jul 2023 06:15:47 +0000 (15:15 +0900)
- Issue:
sttd_server_start() did not progress even though all behavior is
properly worked.

- Solution:
play_start_sound_for_uid() return true if start sound is playing.
However, previous code uses this return value reversely. So, the
sttd_server_start() worked inproperly.
To solve this issue, this patch fixes the condition properly. Through
this patch, sttd_server_start() will work properly.

Change-Id: Iba90d239b917182fbffea54cb526ebe5629262a7
Signed-off-by: Suyeon Hwang <stom.hwang@samsung.com>
server/sttd_server.c

index b8a4adc..7f6f282 100644 (file)
@@ -1198,7 +1198,7 @@ int sttd_server_start(unsigned int uid, const char* lang, const char* recognitio
        }
 
        /* 2. Request wav play */
-       bool is_sound_done = play_start_sound_for_uid(uid);
+       bool is_playing = play_start_sound_for_uid(uid);
 
        /* 3. Create recorder & engine initialize */
        ret = sttd_engine_agent_recognize_start_engine(uid, lang, recognition_type, silence, appid, credential, NULL);
@@ -1219,10 +1219,7 @@ int sttd_server_start(unsigned int uid, const char* lang, const char* recognitio
        sttd_client_set_state(uid, APP_STATE_RECORDING);
 
        g_recording_log_count = 0;
-
-       app_state_e temp_app_state;
-
-       if (true == is_sound_done) {
+       if (false == is_playing) {
                SLOG(LOG_INFO, TAG_STTD, "[Server] No sound play");
 
                ret = sttd_engine_agent_recognize_start_recorder(uid, appid);
@@ -1241,6 +1238,7 @@ int sttd_server_start(unsigned int uid, const char* lang, const char* recognitio
                        return ret;
                }
 
+               app_state_e temp_app_state;
                if (0 != sttd_client_get_state(uid, &temp_app_state)) {
                        SLOG(LOG_ERROR, TAG_STTD, "[Server ERROR] uid is NOT valid");
                        return STTD_ERROR_INVALID_PARAMETER;