Fix errors which are created by solving merge conflict 40/286140/1
authorSuyeon Hwang <stom.hwang@samsung.com>
Mon, 14 Nov 2022 02:57:54 +0000 (11:57 +0900)
committerSuyeon Hwang <stom.hwang@samsung.com>
Thu, 29 Dec 2022 02:03:08 +0000 (11:03 +0900)
- Issue:
Some changes from previous commits are disappeared.

- Solution:
This patch rollbacks the some codes that disappeares by solving merge
conflict. And also this patch fixes bug that are not return error.

Change-Id: I81968cfa7cedc84aeb6d28e0f041cfe45d7190d1
Signed-off-by: Suyeon Hwang <stom.hwang@samsung.com>
client/vc_mgr.c

index e974664..72f264b 100644 (file)
@@ -750,7 +750,7 @@ int vc_mgr_set_demandable_client_rule(const char* rule)
 
        SLOG(LOG_DEBUG, TAG_VCM, "@@@ [Manager] Set Demandable client rule(%s) DONE", rule);
 
-       return VC_ERROR_NONE;
+       return ret;
 }
 
 int vc_mgr_unset_demandable_client_rule(void)
@@ -1797,7 +1797,7 @@ int __vc_mgr_set_volume(float volume)
 {
        // called by app directly
        vc_mgr_core_set_volume(volume);
-       
+
        return VC_ERROR_NONE;
 }
 
@@ -2645,7 +2645,13 @@ static void __tts_feedback_thread(void* data, Ecore_Thread* thread)
 
                        /* waiting */
                        while (1) {
+                               if (ecore_thread_check(thread) == EINA_TRUE) {
+                                       SLOG(LOG_INFO, TAG_VCM, "[INFO] Stop feedback is called");
+                                       return;
+                               }
+
                                usleep(10000);
+
                                if (0 < vc_mgr_data_get_feedback_data_size()) {
                                        SLOG(LOG_INFO, TAG_VCM, "[INFO] Resume thread");
                                        break;
@@ -2685,16 +2691,6 @@ static void __tts_feedback_thread(void* data, Ecore_Thread* thread)
                                vc_mgr_client_not_use_callback();
 
                                pthread_mutex_unlock(&g_feedback_streaming_cb_mutex);
-
-                               /* If no feedback data and EVENT_FINISH */
-                               if (0 >= vc_mgr_data_get_feedback_data_size() && VC_FEEDBACK_EVENT_FINISH == feedback_data->event) {
-                                       SLOG(LOG_INFO, TAG_VCM, "[INFO] Finish feedback");
-                                       if (feedback_data) {
-                                               free(feedback_data);
-                                               feedback_data = NULL;
-                                       }
-                                       break;
-                               }
                        } else {
                                vc_mgr_vc_tts_streaming_cb callback = NULL;
                                void* user_data = NULL;
@@ -2715,16 +2711,6 @@ static void __tts_feedback_thread(void* data, Ecore_Thread* thread)
                                vc_mgr_client_not_use_callback();
 
                                pthread_mutex_unlock(&g_vc_tts_streaming_cb_mutex);
-
-                               /* If no feedback data and EVENT_FINISH */
-                               if (0 >= vc_mgr_data_get_feedback_data_size() && VC_FEEDBACK_EVENT_FINISH == feedback_data->event) {
-                                       SLOG(LOG_INFO, TAG_VCM, "[INFO] Finish vc tts feedback");
-                                       if (feedback_data) {
-                                               free(feedback_data);
-                                               feedback_data = NULL;
-                                       }
-                                       break;
-                               }
                        }
                        free(feedback_data);
                        feedback_data = NULL;
@@ -2802,8 +2788,12 @@ int vc_mgr_stop_feedback(void)
        RETVM_IF(VC_STATE_READY != state, VC_ERROR_INVALID_STATE, TAG_VCM, "[ERROR] Stop feedback : Current state is not 'Ready' (%d)", state);
 
 #if 1
-       ret = -1;
+       if (g_feedback_thread) {
+               ecore_thread_cancel(g_feedback_thread);
+               g_feedback_thread = NULL;
+       }
 
+       ret = -1;
        while (1) {
                vc_feedback_data_s* feedback_data = NULL;
 
@@ -3126,4 +3116,4 @@ int vc_mgr_reset_background_volume(void)
                SLOG(LOG_INFO, TAG_VCM, "[DEBUG] Success to recover volume");
 
        return ret;
-}
\ No newline at end of file
+}