/* get current engine from config */
if (0 == sttd_config_get_default_engine(&cur_engine_uuid)) {
SECURE_SLOG(LOG_DEBUG, TAG_STTD, "[Engine Agent] current engine from config : %s", cur_engine_uuid);
- if (NULL != g_engine_info->engine_uuid) {
+ if (NULL != g_engine_info->engine_uuid && NULL != cur_engine_uuid) {
if (!strcmp(g_engine_info->engine_uuid, cur_engine_uuid)) {
is_default_engine = true;
}
}
if (false == is_default_engine) {
- SLOG(LOG_DEBUG, TAG_STTD, "[Engine Agent] Current engine is not Default engine");
+ SLOG(LOG_INFO, TAG_STTD, "[Engine Agent] Current engine is not Default engine");
} else {
- SLOG(LOG_DEBUG, TAG_STTD, "[Engine Agent] Current engine is Default engine");
+ SLOG(LOG_INFO, TAG_STTD, "[Engine Agent] Current engine is Default engine");
}
/* Load engine */
#endif
g_engine_info->is_loaded = true;
- SECURE_SLOG(LOG_DEBUG, TAG_STTD, "[Engine Agent SUCCESS] The %s has been loaded !!!", g_engine_info->engine_name);
+ SECURE_SLOG(LOG_INFO, TAG_STTD, "[Engine Agent SUCCESS] The %s has been loaded !!!", g_engine_info->engine_name);
return 0;
}
return STTD_ERROR_OPERATION_FAILED;
}
+ bool temp = false;
+ if (0 != stt_engine_support_silence(&temp)) {
+ SLOG(LOG_WARN, TAG_STTD, "[WARNING] Fail to get support silence");
+ }
+
*silence = g_engine_info->support_silence_detection;
+ if (temp != *silence) {
+ SLOG(LOG_WARN, TAG_STTD, "[WARNING] Metadata and Engine spec are different (engine:%d) (meta:%d)", temp, *silence);
+ }
return 0;
}
if (engine->support_silence_detection) {
if (2 == silence) {
/* default option set */
- if (g_default_silence_detected != engine->silence_detection) {
+// if (g_default_silence_detected != engine->silence_detection) {
if (0 != stt_engine_set_silence_detection(g_default_silence_detected)) {
SECURE_SLOG(LOG_ERROR, TAG_STTD, "[Engine Agent ERROR] Fail to set silence detection : %s", g_default_silence_detected ? "true" : "false");
} else {
engine->silence_detection = g_default_silence_detected;
SECURE_SLOG(LOG_DEBUG, TAG_STTD, "[Engine Agent] Set silence detection : %s", g_default_silence_detected ? "true" : "false");
}
- }
+// }
} else {
if (silence != engine->silence_detection) {
if (0 != stt_engine_set_silence_detection(silence)) {
return STTD_ERROR_OPERATION_FAILED;
}
- SLOG(LOG_DEBUG, TAG_STTD, "g_default_language %s", g_default_language);
+ SLOG(LOG_INFO, TAG_STTD, "g_default_language %s", g_default_language);
int ret;
char* temp = NULL;
temp = strdup(lang);
}
- SLOG(LOG_DEBUG, TAG_STTD, "[Engine Agent] Start engine");
+ SLOG(LOG_INFO, TAG_STTD, "[Engine Agent] Start engine");
ret = stt_engine_recognize_start(temp, recognition_type, appid, credential, user_param);
if (NULL != temp) free(temp);
if (0 != ret) {
SLOG(LOG_ERROR, TAG_STTD, "[Engine Agent ERROR] Recognition start error(%d)", ret);
- sttd_recorder_destroy();
return ret;
}
return ret;
}
- SLOG(LOG_DEBUG, TAG_STTD, "[Engine Agent] Create recorder");
+ SLOG(LOG_INFO, TAG_STTD, "[Engine Agent] Create recorder");
ret = sttd_recorder_create(atype, channels, rate);
if (0 != ret) {
return STTD_ERROR_OPERATION_FAILED;
}
- SLOG(LOG_DEBUG, TAG_STTD, "[Engine Agent] Start recorder");
+ SLOG(LOG_INFO, TAG_STTD, "[Engine Agent] Start recorder");
int ret;
ret = sttd_recorder_start(uid);
return 0;
}
+int sttd_engine_agent_recognize_start_file(int uid, const char* filepath)
+{
+ if (NULL == g_engine_info) {
+ SECURE_SLOG(LOG_ERROR, TAG_STTD, "[Engine Agent ERROR] The engine is not valid");
+ return STTD_ERROR_INVALID_PARAMETER;
+ }
+
+ if (false == g_engine_info->is_loaded) {
+ SLOG(LOG_ERROR, TAG_STTD, "[Engine Agent ERROR] Not loaded engine");
+ return STTD_ERROR_OPERATION_FAILED;
+ }
+
+ SLOG(LOG_INFO, TAG_STTD, "[Engine Agent] Start recorder");
+
+ int ret;
+ ret = sttd_recorder_start_file(uid, filepath);
+ if (0 != ret) {
+ SLOG(LOG_ERROR, TAG_STTD, "[Engine Agent ERROR] Fail to start recorder : result(%d)", ret);
+ stt_engine_recognize_cancel();
+ sttd_recorder_stop_file();
+ return ret;
+ }
+
+ return 0;
+}
+
int sttd_engine_agent_set_recording_data(const void* data, unsigned int length)
{
if (false == g_agent_init) {
return ret;
}
+int sttd_engine_agent_recognize_stop_file()
+{
+ if (false == g_agent_init) {
+ SLOG(LOG_ERROR, TAG_STTD, "[Engine Agent ERROR] Not Initialized");
+ return STTD_ERROR_OPERATION_FAILED;
+ }
+
+ if (NULL == g_engine_info) {
+ SECURE_SLOG(LOG_ERROR, TAG_STTD, "[Engine Agent ERROR] The engine is not valid");
+ return STTD_ERROR_INVALID_PARAMETER;
+ }
+
+ if (false == g_engine_info->is_loaded) {
+ SLOG(LOG_ERROR, TAG_STTD, "[Engine Agent ERROR] Not loaded engine");
+ return STTD_ERROR_OPERATION_FAILED;
+ }
+
+ SLOG(LOG_INFO, TAG_STTD, "[Engine Agent] Stop recorder");
+ int ret;
+ ret = sttd_recorder_stop_file();
+ if (0 != ret) {
+ SLOG(LOG_ERROR, TAG_STTD, "[Engine Agent ERROR] Fail to stop recorder : result(%d)", ret);
+ return ret;
+ }
+
+#ifdef AUDIO_CREATE_ON_START
+ SECURE_SLOG(LOG_INFO, TAG_STTD, "[Engine Agent] Destroy recorder");
+ if (0 != sttd_recorder_destroy())
+ SECURE_SLOG(LOG_WARN, TAG_STTD, "[Engine Agent] Fail to destroy recorder");
+#endif
+
+ SLOG(LOG_INFO, TAG_STTD, "[Engine Agent Success] Stop recorder");
+ return 0;
+}
+
int sttd_engine_agent_recognize_stop_recorder()
{
if (false == g_agent_init) {
return STTD_ERROR_OPERATION_FAILED;
}
- SLOG(LOG_DEBUG, TAG_STTD, "[Engine Agent] Stop recorder");
+ SLOG(LOG_INFO, TAG_STTD, "[Engine Agent] Stop recorder");
int ret;
ret = sttd_recorder_stop();
if (0 != ret) {
SECURE_SLOG(LOG_WARN, TAG_STTD, "[Engine Agent] Fail to destroy recorder");
#endif
- SLOG(LOG_DEBUG, TAG_STTD, "[Engine Agent Success] Stop recorder");
+ SLOG(LOG_INFO, TAG_STTD, "[Engine Agent Success] Stop recorder");
return 0;
}
return STTD_ERROR_OPERATION_FAILED;
}
- SLOG(LOG_DEBUG, TAG_STTD, "[Engine Agent] Stop engine");
+ SLOG(LOG_INFO, TAG_STTD, "[Engine Agent] Stop engine");
int ret;
ret = stt_engine_recognize_stop();
return ret;
}
- SLOG(LOG_DEBUG, TAG_STTD, "[Engine Agent Success] Stop engine");
+ SLOG(LOG_INFO, TAG_STTD, "[Engine Agent Success] Stop engine");
return 0;
}
return STTD_ERROR_OPERATION_FAILED;
}
- SLOG(LOG_DEBUG, TAG_STTD, "[Engine Agent] Cancel engine");
+ SLOG(LOG_INFO, TAG_STTD, "[Engine Agent] Cancel engine");
int ret;
ret = stt_engine_recognize_cancel();
return ret;
}
- SLOG(LOG_DEBUG, TAG_STTD, "[Engine Agent] Stop recorder");
+ SLOG(LOG_INFO, TAG_STTD, "[Engine Agent] Stop recorder");
ret = sttd_recorder_stop();
if (0 != ret) {
}
#ifdef AUDIO_CREATE_ON_START
- SLOG(LOG_DEBUG, TAG_STTD, "[Engine Agent] Destroy recorder");
+ SLOG(LOG_INFO, TAG_STTD, "[Engine Agent] Destroy recorder");
if (0 != sttd_recorder_destroy())
SECURE_SLOG(LOG_WARN, TAG_STTD, "[Engine Agent] Fail to destroy recorder");
#endif
- SLOG(LOG_DEBUG, TAG_STTD, "[Engine Agent Success] Cancel recognition");
+ SLOG(LOG_INFO, TAG_STTD, "[Engine Agent Success] Cancel recognition");
return 0;
}
return STTD_ERROR_ENGINE_NOT_FOUND;
}
- SECURE_SLOG(LOG_DEBUG, TAG_STTD, "[Engine Agent] Default engine uuid(%s)", g_engine_info->engine_uuid);
+ SECURE_SLOG(LOG_INFO, TAG_STTD, "[Engine Agent] Default engine uuid(%s)", g_engine_info->engine_uuid);
return 0;
}
}
- SLOG(LOG_DEBUG, TAG_STTD, "[Engine Agent] Get engine right : %s", *result ? "true" : "false");
+ SLOG(LOG_INFO, TAG_STTD, "[Engine Agent] Get engine right : %s", *result ? "true" : "false");
return 0;
}
static void __recorder_destroy_by_error_result(void *data)
{
- SLOG(LOG_DEBUG, TAG_STTD, "[Engine Agent] Destroy recorder");
+ SLOG(LOG_INFO, TAG_STTD, "[Engine Agent] Destroy recorder");
if (0 != sttd_recorder_destroy())
SECURE_SLOG(LOG_WARN, TAG_STTD, "[Engine Agent] Fail to destroy recorder");
return STTD_ERROR_OPERATION_FAILED;
}
- SLOG(LOG_DEBUG, TAG_STTD, "[Server] === Result time callback ===");
+ SLOG(LOG_INFO, TAG_STTD, "[Server] === Result time callback ===");
if (NULL != time_info) {
/* Get the time info */
}
}
- SLOG(LOG_DEBUG, TAG_STTD, "[Server] ============================");
+ SLOG(LOG_INFO, TAG_STTD, "[Server] ============================");
ret = g_result_cb(event, type, result, result_count, msg, user_data);
char* err_msg = NULL;
int ret = STTD_ERROR_NONE;
+
if (NULL != msg) {
err_msg = strdup(msg);
}
ret = sttdc_send_error_signal(uid, error, err_msg);
if (0 != ret) {
SLOG(LOG_ERROR, TAG_STTD, "[Server ERROR] Fail to send error info.");
-
- if (NULL != err_msg) {
- free(err_msg);
- err_msg = NULL;
- }
-
- return ret;
}
if (NULL != err_msg) {