2 * Copyright (c) 2011-2016 Samsung Electronics Co., Ltd All Rights Reserved
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 * http://www.apache.org/licenses/LICENSE-2.0
7 * Unless required by applicable law or agreed to in writing, software
8 * distributed under the License is distributed on an "AS IS" BASIS,
9 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 * See the License for the specific language governing permissions and
11 * limitations under the License.
22 #include <sound_manager.h>
24 #include <bluetooth_product.h>
28 #include "sttd_dbus.h"
29 #include "sttd_recorder.h"
30 #include "sttd_main.h"
33 #define FRAME_LENGTH 160
34 #define BUFFER_LENGTH FRAME_LENGTH * 2
36 static pthread_mutex_t sttd_audio_in_handle_mutex = PTHREAD_MUTEX_INITIALIZER;
39 STTD_RECORDER_STATE_NONE = -1,
40 STTD_RECORDER_STATE_READY = 0, /**< Recorder is ready to start */
41 STTD_RECORDER_STATE_RECORDING /**< In the middle of recording */
42 } sttd_recorder_state;
47 stte_audio_type_e audio_type;
50 static stt_recorder_s* g_recorder = NULL;
52 static stt_recorder_audio_cb g_audio_cb;
54 static sound_stream_info_h g_stream_info_h;
56 static stt_recorder_interrupt_cb g_interrupt_cb;
58 static sttd_recorder_state g_recorder_state = STTD_RECORDER_STATE_NONE;
60 static int g_buffer_count;
62 static int g_stream_focus_id;
64 /* Sound buf save for test */
69 static char g_temp_file_name[128] = {'\0',};
73 static int g_count = 1;
77 static float get_volume_decibel(char* data, int size, stte_audio_type_e type);
79 //static stt_recorder_s* __get_recorder(int engine_id);
81 static int g_bt_extend_count;
83 #define SMART_CONTROL_EXTEND_CMD 0x03
84 #define SMART_CONTROL_START_CMD 0x04
86 static void _bt_cb_hid_state_changed(int result, bool connected, const char *remote_address, void *user_data)
88 SLOG(LOG_DEBUG, TAG_STTD, "[Recorder] Bluetooth Event [%d] Received address [%s]", result, remote_address);
91 static void _bt_hid_audio_data_receive_cb(bt_hid_voice_data_s *voice_data, void *user_data)
93 if (STTD_RECORDER_STATE_RECORDING != g_recorder_state) {
94 /* SLOG(LOG_DEBUG, TAG_STTD, "[Recorder] Exit audio reading normal func"); */
98 if (NULL != g_audio_cb) {
99 if (0 != g_audio_cb((void*)voice_data->audio_buf, (unsigned int)voice_data->length)) {
100 SLOG(LOG_ERROR, TAG_STTD, "[Recorder ERROR] Fail to read audio");
101 sttd_recorder_stop();
104 if (NULL == g_recorder) {
108 float vol_db = get_volume_decibel((char*)voice_data->audio_buf, (int)voice_data->length, g_recorder->audio_type);
109 if (0 != sttdc_send_set_volume(g_recorder->uid, vol_db)) {
110 SLOG(LOG_ERROR, TAG_STTD, "[Recorder] Fail to send recording volume(%f)", vol_db);
114 if (0 == g_buffer_count || 0 == g_buffer_count % 50) {
115 SLOG(LOG_WARN, TAG_STTD, "[Recorder][%d] Recording... : read_size(%d)", g_buffer_count, voice_data->length);
117 if (0 == g_bt_extend_count % 5 && 0 != g_buffer_count) {
118 const unsigned char input_data[2] = {SMART_CONTROL_EXTEND_CMD, 0x10 };
119 if (BT_ERROR_NONE != bt_hid_send_rc_command(NULL, input_data, sizeof(input_data))) {
120 SLOG(LOG_ERROR, TAG_STTD, "[Recorder ERROR] Fail bt_hid_send_rc_command(NULL, %s, %d)", input_data, sizeof(input_data));
122 SLOG(LOG_DEBUG, TAG_STTD, "[Recorder] Extend bt audio recorder");
127 if (100000 == g_buffer_count) {
135 /* write pcm buffer */
136 fwrite(data, 1, len, g_pFile);
143 const char* __stt_get_focus_changed_reason_code(sound_stream_focus_change_reason_e reason)
146 case SOUND_STREAM_FOCUS_CHANGED_BY_MEDIA: return "SOUND_STREAM_FOCUS_CHANGED_BY_MEDIA";
147 case SOUND_STREAM_FOCUS_CHANGED_BY_SYSTEM: return "SOUND_STREAM_FOCUS_CHANGED_BY_SYSTEM";
148 case SOUND_STREAM_FOCUS_CHANGED_BY_ALARM: return "SOUND_STREAM_FOCUS_CHANGED_BY_ALARM";
149 case SOUND_STREAM_FOCUS_CHANGED_BY_NOTIFICATION: return "SOUND_STREAM_FOCUS_CHANGED_BY_NOTIFICATION";
150 case SOUND_STREAM_FOCUS_CHANGED_BY_EMERGENCY: return "SOUND_STREAM_FOCUS_CHANGED_BY_EMERGENCY";
151 case SOUND_STREAM_FOCUS_CHANGED_BY_VOICE_INFORMATION: return "SOUND_STREAM_FOCUS_CHANGED_BY_VOICE_INFORMATION";
152 case SOUND_STREAM_FOCUS_CHANGED_BY_VOICE_RECOGNITION: return "SOUND_STREAM_FOCUS_CHANGED_BY_VOICE_RECOGNITION";
153 case SOUND_STREAM_FOCUS_CHANGED_BY_RINGTONE: return "SOUND_STREAM_FOCUS_CHANGED_BY_RINGTONE";
154 case SOUND_STREAM_FOCUS_CHANGED_BY_VOIP: return "SOUND_STREAM_FOCUS_CHANGED_BY_VOIP";
155 case SOUND_STREAM_FOCUS_CHANGED_BY_CALL: return "SOUND_STREAM_FOCUS_CHANGED_BY_CALL";
156 case SOUND_STREAM_FOCUS_CHANGED_BY_MEDIA_EXTERNAL_ONLY: return "SOUND_STREAM_FOCUS_CHANGED_BY_MEDIA_EXTERNAL_ONLY";
157 default: return "Undefined reason code";
161 void __recorder_focus_state_watch_cb(int id, sound_stream_focus_mask_e focus_mask, sound_stream_focus_state_e focus_state,
162 sound_stream_focus_change_reason_e reason, const char *extra_info, void *user_data)
164 SLOG(LOG_WARN, TAG_STTD, "[Recorder] focus_state_watch_cb is called, focus_state(%d), reason(%s)", (int)focus_state, __stt_get_focus_changed_reason_code(reason));
166 if (STTD_RECORDER_STATE_RECORDING == g_recorder_state && SOUND_STREAM_FOCUS_STATE_ACQUIRED == focus_state) {
167 SLOG(LOG_WARN, TAG_STTD, "[Recorder] Focus released as interrupt");
168 if (NULL != g_interrupt_cb) {
174 int sttd_recorder_initialize(stt_recorder_audio_cb audio_cb, stt_recorder_interrupt_cb interrupt_cb)
176 if (NULL == audio_cb || NULL == interrupt_cb) {
177 SLOG(LOG_ERROR, TAG_STTD, "[Recorder ERROR] Input param is NOT valid");
178 return STTD_ERROR_INVALID_PARAMETER;
181 if (STTD_RECORDER_STATE_NONE != g_recorder_state) {
182 SLOG(LOG_ERROR, TAG_STTD, "[Recorder ERROR] Current state of recorder is recording");
183 return STTD_ERROR_INVALID_STATE;
186 if (0 != pthread_mutex_init(&sttd_audio_in_handle_mutex, NULL)) {
187 SLOG(LOG_ERROR, TAG_STTD, "[Recorder ERROR] Fail to initialize audio in handle mutex.");
190 g_audio_cb = audio_cb;
191 g_interrupt_cb = interrupt_cb;
192 g_recorder_state = STTD_RECORDER_STATE_NONE;
195 if (0 != sound_manager_create_stream_information(SOUND_STREAM_TYPE_VOICE_RECOGNITION, NULL, NULL, &g_stream_info_h)) {
196 SLOG(LOG_ERROR, TAG_STTD, "[Recorder ERROR] Fail to create stream info");
199 if (0 != sound_manager_add_focus_state_watch_cb(SOUND_STREAM_FOCUS_FOR_BOTH, __recorder_focus_state_watch_cb, NULL, &g_stream_focus_id)) {
200 SLOG(LOG_ERROR, TAG_STTD, "[Recorder ERROR] Fail to add focus state watch callback");
204 if (BT_ERROR_NONE != bt_product_init()) {
205 SLOG(LOG_ERROR, TAG_STTD, "[Recorder ERROR] Fail to init bt");
206 return STTD_ERROR_OPERATION_FAILED;
209 if (BT_ERROR_NONE != bt_hid_host_initialize(_bt_cb_hid_state_changed, NULL)) {
210 SLOG(LOG_ERROR, TAG_STTD, "[Recorder ERROR] Fail bt_hid_host_initialize()");
211 return STTD_ERROR_OPERATION_FAILED;
218 int sttd_recorder_deinitialize()
220 if (0 != pthread_mutex_destroy(&sttd_audio_in_handle_mutex)) {
221 SLOG(LOG_ERROR, TAG_STTD, "[Server ERROR] Fail to destroy audio in handle mutex.");
224 if (0 != sound_manager_remove_focus_state_watch_cb(g_stream_focus_id)) {
225 SLOG(LOG_ERROR, TAG_STTD, "[Recorder ERROR] Fail to remove focus state watch callback");
228 if (0 != sound_manager_destroy_stream_information(g_stream_info_h)) {
229 SLOG(LOG_ERROR, TAG_STTD, "[Recorder ERROR] Fail to destroy stream info");
232 if (NULL != g_recorder) {
233 audio_in_destroy(g_recorder->audio_h);
234 g_recorder->audio_h = NULL;
239 #ifdef __UNUSED_CODES__
240 /* Remove all recorder */
242 stt_recorder_s *recorder = NULL;
244 iter = g_slist_nth(g_recorder_list, 0);
246 while (NULL != iter) {
247 recorder = iter->data;
249 if (NULL != recorder) {
250 g_recorder_list = g_slist_remove(g_recorder_list, recorder);
251 if (recorder->audio_h) {
252 audio_in_destroy(recorder->audio_h);
253 recorder->audio_h = NULL;
258 iter = g_slist_nth(g_recorder_list, 0);
263 bt_hid_host_deinitialize();
268 g_recorder_state = STTD_RECORDER_STATE_NONE;
273 int sttd_recorder_set_audio_session()
278 int sttd_recorder_unset_audio_session()
283 int sttd_recorder_create(stte_audio_type_e type, int channel, unsigned int sample_rate)
285 /* Check engine id is valid */
286 if (NULL != g_recorder) {
287 SLOG(LOG_WARN, TAG_STTD, "[Recorder WARNING] Engine id is already registered");
288 return STTD_ERROR_INVALID_PARAMETER;
291 audio_in_h temp_in_h = NULL;
294 audio_channel_e audio_ch;
295 audio_sample_type_e audio_type;
298 case 1: audio_ch = AUDIO_CHANNEL_MONO; break;
299 case 2: audio_ch = AUDIO_CHANNEL_STEREO; break;
301 SLOG(LOG_ERROR, TAG_STTD, "[Recorder ERROR] Input channel is not supported");
302 return STTD_ERROR_OPERATION_FAILED;
307 case STTE_AUDIO_TYPE_PCM_S16_LE: audio_type = AUDIO_SAMPLE_TYPE_S16_LE; break;
308 case STTE_AUDIO_TYPE_PCM_U8: audio_type = AUDIO_SAMPLE_TYPE_U8; break;
310 SLOG(LOG_ERROR, TAG_STTD, "[Recorder ERROR] Invalid Audio Type");
311 return STTD_ERROR_OPERATION_FAILED;
316 ret = audio_in_create(sample_rate, audio_ch, audio_type, &temp_in_h);
317 if (AUDIO_IO_ERROR_NONE != ret) {
318 SLOG(LOG_ERROR, TAG_STTD, "[Recorder ERROR] Fail to create audio handle : %d", ret);
319 return STTD_ERROR_OPERATION_FAILED;
322 if (BT_ERROR_NONE != bt_hid_set_audio_data_receive_cb(_bt_hid_audio_data_receive_cb, NULL)) {
323 SLOG(LOG_ERROR, TAG_STTD, "[Recorder ERROR] Fail bt_hid_set_audio_data_receive_cb()");
324 return STTD_ERROR_OPERATION_FAILED;
328 stt_recorder_s* recorder;
329 recorder = (stt_recorder_s*)calloc(1, sizeof(stt_recorder_s));
330 if (NULL == recorder) {
333 audio_in_destroy(temp_in_h);
337 SLOG(LOG_ERROR, TAG_STTD, "[Recorder ERROR] Fail to allocate memory");
338 return STTD_ERROR_OUT_OF_MEMORY;
342 recorder->audio_h = temp_in_h;
343 recorder->audio_type = type;
345 g_recorder = recorder;
347 g_recorder_state = STTD_RECORDER_STATE_READY;
352 int sttd_recorder_destroy()
354 // critical section required because this function can be called from stt engine thread context
355 SLOG(LOG_WARN, TAG_STTD, "[Recorder WARNING] Enter critical section");
356 pthread_mutex_lock(&sttd_audio_in_handle_mutex);
358 /* Check engine id is valid */
359 if (NULL == g_recorder) {
360 SLOG(LOG_WARN, TAG_STTD, "[Recorder WARNING] Engine id is not valid");
361 pthread_mutex_unlock(&sttd_audio_in_handle_mutex);
362 return STTD_ERROR_INVALID_PARAMETER;
367 if (STTD_RECORDER_STATE_RECORDING == g_recorder_state) {
368 if (g_recorder->audio_h) {
369 ret = audio_in_unprepare(g_recorder->audio_h);
370 if (AUDIO_IO_ERROR_NONE != ret) {
371 SLOG(LOG_ERROR, TAG_STTD, "[Recorder ERROR] Fail to unprepare audioin : %d", ret);
375 g_recorder_state = STTD_RECORDER_STATE_READY;
378 if (g_recorder->audio_h) {
379 ret = audio_in_destroy(g_recorder->audio_h);
380 if (AUDIO_IO_ERROR_NONE != ret) {
381 SLOG(LOG_ERROR, TAG_STTD, "[Recorder ERROR] Fail to destroy audioin : %d", ret);
383 g_recorder->audio_h = NULL;
387 if (STTD_RECORDER_STATE_RECORDING == g_recorder_state) {
388 g_recorder_state = STTD_RECORDER_STATE_READY;
391 bt_hid_unset_audio_data_receive_cb();
397 pthread_mutex_unlock(&sttd_audio_in_handle_mutex);
398 SLOG(LOG_WARN, TAG_STTD, "[Recorder WARNING] Leave critical section");
403 static float get_volume_decibel(char* data, int size, stte_audio_type_e type)
405 #define MAX_AMPLITUDE_MEAN_16 32768
406 #define MAX_AMPLITUDE_MEAN_08 128
413 unsigned long long square_sum = 0;
415 if (type == STTE_AUDIO_TYPE_PCM_S16_LE)
420 for (i = 0; i < size; i += (depthByte<<1)) {
421 if (depthByte == 2) {
423 memcpy(&pcm16, data + i, sizeof(short));
424 square_sum += pcm16 * pcm16;
427 memcpy(&pcm8, data + i, sizeof(char));
428 square_sum += pcm8 * pcm8;
436 rms = sqrt((double)square_sum/count);
439 db = 20 * log10(rms/MAX_AMPLITUDE_MEAN_16);
441 db = 20 * log10(rms/MAX_AMPLITUDE_MEAN_08);
447 Eina_Bool __read_audio_func(void *data)
450 static char g_buffer[BUFFER_LENGTH];
452 /* Check engine id is valid */
453 if (NULL == g_recorder) {
457 if (STTD_RECORDER_STATE_READY == g_recorder_state) {
458 SLOG(LOG_DEBUG, TAG_STTD, "[Recorder] Exit audio reading func");
462 read_byte = audio_in_read(g_recorder->audio_h, g_buffer, BUFFER_LENGTH);
464 SLOG(LOG_WARN, TAG_STTD, "[Recorder WARNING] Fail to read audio : %d", read_byte);
465 g_recorder_state = STTD_RECORDER_STATE_READY;
469 if (0 != g_audio_cb(g_buffer, read_byte)) {
470 SLOG(LOG_WARN, TAG_STTD, "[Recorder WARNING] Fail audio callback");
471 sttd_recorder_stop();
475 if (0 == g_buffer_count % 30) {
476 float vol_db = get_volume_decibel(g_buffer, BUFFER_LENGTH, g_recorder->audio_type);
477 if (0 != sttdc_send_set_volume(g_recorder->uid, vol_db)) {
478 SLOG(LOG_ERROR, TAG_STTD, "[Recorder] Fail to send recording volume(%f)", vol_db);
483 if (0 == g_buffer_count % 50) {
484 SLOG(LOG_DEBUG, TAG_STTD, "[Recorder][%d] Recording... : read_size(%d)", g_buffer_count, read_byte);
486 if (100000 == g_buffer_count) {
494 /* write pcm buffer */
495 fwrite(g_buffer, 1, BUFFER_LENGTH, g_pFile);
502 int sttd_recorder_start(int uid)
504 if (STTD_RECORDER_STATE_RECORDING == g_recorder_state)
509 /* Check engine id is valid */
510 if (NULL == g_recorder) {
511 SLOG(LOG_WARN, TAG_STTD, "[Recorder WARNING] Engine id is not valid");
512 return STTD_ERROR_INVALID_PARAMETER;
515 ret = audio_in_set_sound_stream_info(g_recorder->audio_h, g_stream_info_h);
516 if (AUDIO_IO_ERROR_NONE != ret) {
517 SLOG(LOG_ERROR, TAG_STTD, "[Recorder ERROR] Fail to set stream info");
520 ret = audio_in_prepare(g_recorder->audio_h);
521 if (AUDIO_IO_ERROR_NONE != ret) {
522 SLOG(LOG_ERROR, TAG_STTD, "[Recorder ERROR] Fail to start audio : %d", ret);
523 return STTD_ERROR_RECORDER_BUSY;
526 /* Add ecore timer to read audio data */
527 ecore_timer_add(0, __read_audio_func, NULL);
530 g_bt_extend_count = 0;
531 const unsigned char input_data[2] = {SMART_CONTROL_START_CMD, 0x00 };
533 bool started = false;
534 while (5 > bt_retry) {
535 ret = bt_hid_send_rc_command(NULL, input_data, sizeof(input_data));
536 if (BT_ERROR_NONE == ret) {
537 SLOG(LOG_DEBUG, TAG_STTD, "[Recorder] Start bt audio recorder");
540 } else if (BT_ERROR_NOW_IN_PROGRESS == ret) {
541 SLOG(LOG_ERROR, TAG_STTD, "[Recorder ERROR] Fail bt_hid_send_rc_command(NULL, %s, %d)", input_data, sizeof(input_data));
548 if (false == started) {
549 SLOG(LOG_ERROR, TAG_STTD, "[Recorder ERROR] Fail to start bt audio");
550 return STTD_ERROR_OPERATION_FAILED;
553 g_recorder_state = STTD_RECORDER_STATE_RECORDING;
554 g_recorder->uid = uid;
562 snprintf(g_temp_file_name, sizeof(g_temp_file_name), "/tmp/stt_temp_%d_%d", getpid(), g_count);
563 ret = access(g_temp_file_name, 0);
566 SLOG(LOG_ERROR, TAG_STTD, "[Recorder ERROR] File is already exist");
567 if (0 == remove(g_temp_file_name)) {
568 SLOG(LOG_DEBUG, TAG_STTD, "[Recorder] Remove file");
578 SECURE_SLOG(LOG_DEBUG, TAG_STTD, "[Recorder] Temp file name=[%s]", g_temp_file_name);
581 g_pFile = fopen(g_temp_file_name, "wb+x");
583 SLOG(LOG_ERROR, TAG_STTD, "[Recorder ERROR] File not found!");
591 int sttd_recorder_stop()
593 if (STTD_RECORDER_STATE_READY == g_recorder_state)
596 // critical section required because this function can be called from stt engine thread context
597 SLOG(LOG_WARN, TAG_STTD, "[Recorder WARNING] Enter critical section");
598 pthread_mutex_lock(&sttd_audio_in_handle_mutex);
600 /* Check engine id is valid */
601 if (NULL == g_recorder) {
602 SLOG(LOG_WARN, TAG_STTD, "[Recorder WARNING] Engine id is not valid");
603 pthread_mutex_unlock(&sttd_audio_in_handle_mutex);
604 return STTD_ERROR_INVALID_PARAMETER;
607 g_recorder->uid = -1;
611 ret = audio_in_unprepare(g_recorder->audio_h);
612 if (AUDIO_IO_ERROR_NONE != ret) {
613 SLOG(LOG_ERROR, TAG_STTD, "[Recorder ERROR] Fail to unprepare audioin : %d", ret);
617 bool stopped = false;
618 while (5 > bt_retry) {
619 ret = bt_hid_rc_stop_sending_voice(NULL);
620 if (BT_ERROR_NONE == ret) {
621 SLOG(LOG_DEBUG, TAG_STTD, "[Recorder] Stop bt audio");
624 } else if (BT_ERROR_NOW_IN_PROGRESS == ret) {
625 SLOG(LOG_ERROR, TAG_STTD, "[Recorder ERROR] Fail bt_hid_rc_stop_sending_voice()");
629 SLOG(LOG_ERROR, TAG_STTD, "[Recorder ERROR] bt_hid_rc_stop_sending_voice(): ret(%d)", ret);
633 if (false == stopped) {
634 SLOG(LOG_ERROR, TAG_STTD, "[Recorder ERROR] Fail to stop bt audio(%d)", ret);
635 // return STTD_ERROR_OPERATION_FAILED;
639 g_recorder_state = STTD_RECORDER_STATE_READY;
644 pthread_mutex_unlock(&sttd_audio_in_handle_mutex);
645 SLOG(LOG_WARN, TAG_STTD, "[Recorder WARNING] Leave critical section");
650 int sttd_recorder_start_file(int uid, const char *filepath)
652 if (STTD_RECORDER_STATE_RECORDING == g_recorder_state)
655 /* Check engine id is valid */
656 if (NULL == g_recorder) {
657 SLOG(LOG_WARN, TAG_STTD, "[Recorder WARNING] Engine id is not valid");
658 return STTD_ERROR_INVALID_PARAMETER;
660 g_recorder_state = STTD_RECORDER_STATE_RECORDING;
661 g_recorder->uid = uid;
664 int totalReadBytes = 0;
666 FILE *infile = fopen(filepath, "rb");
669 if (infile != NULL) {
670 while (!feof(infile)) {
671 static char pcm_buff[BUFFER_LENGTH];
672 int read_byte = fread(pcm_buff, 1, BUFFER_LENGTH, infile);
673 totalReadBytes += read_byte;
674 if (0 != read_byte) {
675 if (0 != g_audio_cb(pcm_buff, read_byte)) {
676 SLOG(LOG_ERROR, TAG_STTD, "[Recorder ERROR] Fail to call audio callback");
681 float vol_db = get_volume_decibel(pcm_buff, BUFFER_LENGTH, g_recorder->audio_type);
682 if (0 != sttdc_send_set_volume(g_recorder->uid, vol_db)) {
683 SLOG(LOG_ERROR, TAG_STTD, "[Recorder] Fail to send recording volume(%f)", vol_db);
689 SLOG(LOG_DEBUG, TAG_STTD, "[Recorder][%d] Recording... : read_size(%d)", cnt, read_byte);
696 SLOG(LOG_DEBUG, TAG_STTD, "[Recorder][%d] total bytes(%d)", cnt, totalReadBytes);
700 int sttd_recorder_stop_file()
702 if (STTD_RECORDER_STATE_READY == g_recorder_state)
705 /* Check engine id is valid */
706 if (NULL == g_recorder) {
707 SLOG(LOG_WARN, TAG_STTD, "[Recorder WARNING] Engine id is not valid");
708 return STTD_ERROR_INVALID_PARAMETER;
711 g_recorder->uid = -1;
712 g_recorder_state = STTD_RECORDER_STATE_READY;
717 int sttd_recorder_clear()
720 SLOG(LOG_DEBUG, TAG_STTD, "[Recorder DEBUG] Clear recorder on TV");
722 if (STTD_RECORDER_STATE_RECORDING == g_recorder_state) {
723 sttd_recorder_stop();
725 if (STTD_RECORDER_STATE_READY == g_recorder_state) {
726 sttd_recorder_destroy();
730 return STTD_ERROR_NONE;