if (0 != sttd_config_get_default_language(&(g_default_language))) {
SLOG(LOG_WARN, TAG_STTD, "[Engine Agent WARNING] There is No default voice in config");
+ free(g_default_language);
/* Set default voice */
g_default_language = strdup("en_US");
} else {
int sttd_recorder_stop()
{
+ // critical section required because this function can be called from stt engine thread context
+ SLOG(LOG_WARN, TAG_STTD, "[Recorder WARNING] Enter critical section");
+ pthread_mutex_lock(&sttd_audio_in_handle_mutex);
+
if (STTD_RECORDER_STATE_NONE == g_recorder_state) {
SLOG(LOG_WARN, TAG_STTD, "[Recorder WARNING] Recorder is not created yet");
+ pthread_mutex_unlock(&sttd_audio_in_handle_mutex);
return STTD_ERROR_NONE;
}
- if (STTD_RECORDER_STATE_READY == g_recorder_state)
+ if (STTD_RECORDER_STATE_READY == g_recorder_state) {
+ SLOG(LOG_WARN, TAG_STTD, "[Recorder WARNING] Recorder state is currently READY");
+ pthread_mutex_unlock(&sttd_audio_in_handle_mutex);
return 0;
-
- // critical section required because this function can be called from stt engine thread context
- SLOG(LOG_WARN, TAG_STTD, "[Recorder WARNING] Enter critical section");
- pthread_mutex_lock(&sttd_audio_in_handle_mutex);
+ }
/* Check engine id is valid */
if (NULL == g_recorder) {