static vc_audio_type_e g_feedback_audio_type = 0;
static Ecore_Thread* g_feedback_thread = NULL;
+static pthread_mutex_t g_feedback_streaming_cb_mutex = PTHREAD_MUTEX_INITIALIZER;
+static pthread_mutex_t g_vc_tts_streaming_cb_mutex = PTHREAD_MUTEX_INITIALIZER;
static Eina_Bool __vc_mgr_notify_state_changed(void *data);
static void __vc_mgr_notify_error(void *data);
if (NULL == callback)
return VC_ERROR_INVALID_PARAMETER;
+ pthread_mutex_lock(&g_feedback_streaming_cb_mutex);
+
vc_state_e state;
if (0 != vc_mgr_client_get_client_state(g_vc_m, &state)) {
SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Set feedback streaming callback : A handle is not available");
+ pthread_mutex_unlock(&g_feedback_streaming_cb_mutex);
return VC_ERROR_INVALID_STATE;
}
/* check state */
if (VC_STATE_INITIALIZED != state) {
SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Set feedback streaming callback : Current state is not 'Initialized' (%d)", state);
+ pthread_mutex_unlock(&g_feedback_streaming_cb_mutex);
return VC_ERROR_INVALID_STATE;
}
vc_mgr_client_set_feedback_streaming_cb(g_vc_m, callback, user_data);
+ pthread_mutex_unlock(&g_feedback_streaming_cb_mutex);
+
SLOG(LOG_DEBUG, TAG_VCM, "[SUCCESS] Set feedback streaming callback");
return 0;
return VC_ERROR_PERMISSION_DENIED;
}
+ pthread_mutex_lock(&g_feedback_streaming_cb_mutex);
+
vc_state_e state;
if (0 != vc_mgr_client_get_client_state(g_vc_m, &state)) {
SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Unset feedback streaming callback : A handle is not available");
+ pthread_mutex_unlock(&g_feedback_streaming_cb_mutex);
return VC_ERROR_INVALID_STATE;
}
/* check state */
if (VC_STATE_INITIALIZED != state) {
SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Unset feedback streaming callback : Current state is not 'Initialized' (%d)", state);
+ pthread_mutex_unlock(&g_feedback_streaming_cb_mutex);
return VC_ERROR_INVALID_STATE;
}
vc_mgr_client_set_feedback_streaming_cb(g_vc_m, NULL, NULL);
+ pthread_mutex_unlock(&g_feedback_streaming_cb_mutex);
+
SLOG(LOG_DEBUG, TAG_VCM, "[SUCCESS] Unset feedback streaming callback");
return 0;
if (NULL == callback)
return VC_ERROR_INVALID_PARAMETER;
+ pthread_mutex_lock(&g_vc_tts_streaming_cb_mutex);
+
vc_state_e state;
if (0 != vc_mgr_client_get_client_state(g_vc_m, &state)) {
SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Set feedback streaming callback : A handle is not available");
+ pthread_mutex_unlock(&g_vc_tts_streaming_cb_mutex);
return VC_ERROR_INVALID_STATE;
}
/* check state */
if (VC_STATE_INITIALIZED != state) {
SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Set feedback streaming callback : Current state is not 'Initialized' (%d)", state);
+ pthread_mutex_unlock(&g_vc_tts_streaming_cb_mutex);
return VC_ERROR_INVALID_STATE;
}
vc_mgr_client_set_vc_tts_streaming_cb(g_vc_m, callback, user_data);
+ pthread_mutex_unlock(&g_vc_tts_streaming_cb_mutex);
+
SLOG(LOG_DEBUG, TAG_VCM, "[SUCCESS] Set feedback streaming callback");
return 0;
int vc_mgr_unset_vc_tts_streaming_cb()
{
+ pthread_mutex_lock(&g_vc_tts_streaming_cb_mutex);
+
vc_state_e state;
if (0 != vc_mgr_client_get_client_state(g_vc_m, &state)) {
SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Unset feedback streaming callback : A handle is not available");
+ pthread_mutex_unlock(&g_vc_tts_streaming_cb_mutex);
return VC_ERROR_INVALID_STATE;
}
/* check state */
if (VC_STATE_INITIALIZED != state) {
SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Unset feedback streaming callback : Current state is not 'Initialized' (%d)", state);
+ pthread_mutex_unlock(&g_vc_tts_streaming_cb_mutex);
return VC_ERROR_INVALID_STATE;
}
vc_mgr_client_set_vc_tts_streaming_cb(g_vc_m, NULL, NULL);
+ pthread_mutex_unlock(&g_vc_tts_streaming_cb_mutex);
+
SLOG(LOG_DEBUG, TAG_VCM, "[SUCCESS] Unset feedback streaming callback");
return 0;
vc_mgr_feedback_streaming_cb callback = NULL;
void* user_data = NULL;
+ pthread_mutex_lock(&g_feedback_streaming_cb_mutex);
+
vc_mgr_client_get_feedback_streaming_cb(g_vc_m, &callback, &user_data);
if (NULL == callback) {
SLOG(LOG_WARN, TAG_VCM, "[WARNING] TTS feedback streaming callback is null");
vc_mgr_data_clear_feedback_data(&feedback_data);
+ pthread_mutex_unlock(&g_feedback_streaming_cb_mutex);
return;
}
callback(feedback_data->event, feedback_data->data, feedback_data->data_size, user_data);
vc_mgr_client_not_use_callback(g_vc_m);
+ 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");
vc_mgr_vc_tts_streaming_cb callback = NULL;
void* user_data = NULL;
+ pthread_mutex_lock(&g_vc_tts_streaming_cb_mutex);
+
vc_mgr_client_get_vc_tts_streaming_cb(g_vc_m, &callback, &user_data);
if (NULL == callback) {
SLOG(LOG_WARN, TAG_VCM, "[WARNING] vc tts streaming callback is null");
vc_mgr_data_clear_feedback_data(&feedback_data);
+ pthread_mutex_unlock(&g_vc_tts_streaming_cb_mutex);
return;
}
callback(feedback_data->pid, feedback_data->utt_id, feedback_data->event, feedback_data->data, feedback_data->data_size, user_data);
vc_mgr_client_not_use_callback(g_vc_m);
+ 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");