}
#ifdef TV_BT_MODE
- if (BT_ERROR_NONE != bt_initialize()) {
+ if (BT_ERROR_NONE != bt_product_init()) {
SLOG(LOG_ERROR, TAG_STTD, "[Recorder ERROR] Fail to init bt");
return STTD_ERROR_OPERATION_FAILED;
}
#ifdef TV_BT_MODE
bt_hid_host_deinitialize();
- bt_deinitialize();
+ bt_product_deinit();
#endif
g_recorder_state = STTD_RECORDER_STATE_NONE;
if (STTD_RECORDER_STATE_READY == g_recorder_state)
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) {
SLOG(LOG_WARN, TAG_STTD, "[Recorder WARNING] Engine id is not valid");
+ pthread_mutex_unlock(&sttd_audio_in_handle_mutex);
return STTD_ERROR_INVALID_PARAMETER;
}
#ifdef BUF_SAVE_MODE
fclose(g_pFile);
#endif
+ pthread_mutex_unlock(&sttd_audio_in_handle_mutex);
+ SLOG(LOG_WARN, TAG_STTD, "[Recorder WARNING] Leave critical section");
return 0;
}
return 0;
}
+
+int sttd_recorder_reset()
+{
+#ifdef TV_BT_MODE
+ SLOG(LOG_DEBUG, TAG_STTD, "[Recorder DEBUG] Reset recorder on TV");
+
+ if (STTD_RECORDER_STATE_RECORDING == g_recorder_state) {
+ sttd_recorder_stop();
+ }
+ if (STTD_RECORDER_STATE_READY == g_recorder_state) {
+ sttd_recorder_destroy();
+ }
+#endif
+
+ return STTD_ERROR_NONE;
+}