Check the streaming mode properly 48/266848/1
authorSuyeon Hwang <stom.hwang@samsung.com>
Fri, 19 Nov 2021 09:32:02 +0000 (18:32 +0900)
committerSuyeon Hwang <stom.hwang@samsung.com>
Fri, 19 Nov 2021 09:32:04 +0000 (18:32 +0900)
There is two cases to get sound data. One is recording sound data from dependency audio manager.
And the other is getting from manager app using IPC. Streaming mode helps to identify this two
situation.

- Using dependency audio manager :
  VCD_AUDIO_STREAMING_MODE_VC_SERVICE, VCD_AUDIO_STREAMING_MODE_MULTI_ASSISTANT
- Using IPC from voice control manager :
  VCD_AUDIO_STREAMING_MODE_OUTSIDE

This patch fixes the check code to make each function works with proper streaming mode.

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

index fc06fec060c7be9002ef7bdc256f70acfdf6ac21..cadb81df1cf3ee6e70d89c5af9e75a3ed1a60c96 100644 (file)
@@ -431,7 +431,7 @@ int vcd_recorder_start_streaming()
 
        vcd_audio_streaming_mode_e streaming_mode;
        vcd_config_get_audio_streaming_mode(&streaming_mode);
-       if (VCD_AUDIO_STREAMING_MODE_VC_SERVICE == streaming_mode) {
+       if (VCD_AUDIO_STREAMING_MODE_OUTSIDE != streaming_mode) {
                SLOG(LOG_INFO, TAG_VCD, "[Recorder] Current audio streaming mode(%d)", streaming_mode);
                return VCD_ERROR_NONE;
        }
@@ -473,7 +473,7 @@ int vcd_recorder_send_streaming(const void* buffer, const unsigned int length)
 {
        vcd_audio_streaming_mode_e streaming_mode;
        vcd_config_get_audio_streaming_mode(&streaming_mode);
-       if (VCD_AUDIO_STREAMING_MODE_VC_SERVICE == streaming_mode) {
+       if (VCD_AUDIO_STREAMING_MODE_OUTSIDE != streaming_mode) {
                SLOG(LOG_INFO, TAG_VCD, "[Recorder] Current audio streaming mode(%d)", streaming_mode);
                return VCD_ERROR_NONE;
        }
@@ -502,7 +502,7 @@ int vcd_recorder_stop_streaming()
 
        vcd_audio_streaming_mode_e streaming_mode;
        vcd_config_get_audio_streaming_mode(&streaming_mode);
-       if (VCD_AUDIO_STREAMING_MODE_VC_SERVICE == streaming_mode) {
+       if (VCD_AUDIO_STREAMING_MODE_OUTSIDE != streaming_mode) {
                SLOG(LOG_INFO, TAG_VCD, "[Recorder] Current audio streaming mode(%d)", streaming_mode);
                return VCD_ERROR_NONE;
        }
@@ -576,11 +576,9 @@ int vcd_recorder_recover_system_volume()
 
 int vcd_recorder_start()
 {
-       int ret = -1;
-
        vcd_audio_streaming_mode_e streaming_mode;
        vcd_config_get_audio_streaming_mode(&streaming_mode);
-       if (VCD_AUDIO_STREAMING_MODE_MULTI_ASSISTANT == streaming_mode || VCD_AUDIO_STREAMING_MODE_OUTSIDE == streaming_mode) {
+       if (VCD_AUDIO_STREAMING_MODE_OUTSIDE == streaming_mode) {
                SLOG(LOG_INFO, TAG_VCD, "[Recorder] Current audio streaming mode(%d)", streaming_mode);
                return VCD_ERROR_NONE;
        }
@@ -596,7 +594,7 @@ int vcd_recorder_start()
                // For testing
                ecore_main_loop_thread_safe_call_async(__timer_read_test_func, NULL);
        } else {
-               ret = dependency_audio_manager_start_recording();
+               int ret = dependency_audio_manager_start_recording();
                if (0 != ret) {
                        SLOG(LOG_ERROR, TAG_VCD, "[Recorder ERROR] Fail to start recording, [ret(%d)]", ret);
                        return VCD_ERROR_OPERATION_FAILED;
@@ -611,7 +609,7 @@ int vcd_recorder_start()
 
        while (1) {
                snprintf(normal_file_name, sizeof(normal_file_name), "/tmp/vc_normal_%d_%d", getpid(), g_count);
-               ret = access(normal_file_name, 0);
+               int ret = access(normal_file_name, 0);
 
                if (0 == ret) {
                        SLOG(LOG_ERROR, TAG_VCD, "[Recorder ERROR] File is already exist");
@@ -639,10 +637,9 @@ int vcd_recorder_start()
 
 int vcd_recorder_stop()
 {
-       int ret = -1;
        vcd_audio_streaming_mode_e streaming_mode;
        vcd_config_get_audio_streaming_mode(&streaming_mode);
-       if (VCD_AUDIO_STREAMING_MODE_MULTI_ASSISTANT == streaming_mode || VCD_AUDIO_STREAMING_MODE_OUTSIDE == streaming_mode) {
+       if (VCD_AUDIO_STREAMING_MODE_OUTSIDE == streaming_mode) {
                SLOG(LOG_INFO, TAG_VCD, "[Recorder] Current audio streaming mode(%d)", streaming_mode);
                return VCD_ERROR_NONE;
        }
@@ -668,7 +665,7 @@ int vcd_recorder_stop()
                free(g_pcm_path);
                g_pcm_path = NULL;
        } else {
-               ret = dependency_audio_manager_stop_recording();
+               int ret = dependency_audio_manager_stop_recording();
                if (0 != ret) {
                        SLOG(LOG_ERROR, TAG_VCD, "[Recorder ERROR] Fail to stop audio : %d", ret);
                        return ret;