/*
-* Copyright (c) 2011-2014 Samsung Electronics Co., Ltd All Rights Reserved
+* Copyright (c) 2011-2016 Samsung Electronics Co., Ltd All Rights Reserved
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
SLOG(LOG_ERROR, TAG_STTD, "[Recorder] Fail to send recording volume(%f)", vol_db);
}
}
-
+
if (0 == g_buffer_count || 0 == g_buffer_count % 50) {
SLOG(LOG_WARN, TAG_STTD, "[Recorder][%d] Recording... : read_size(%d)", g_buffer_count, voice_data->length);
}
}
g_bt_extend_count++;
-
+
if (100000 == g_buffer_count) {
g_buffer_count = 0;
}
}
SLOG(LOG_WARN, TAG_STTD, "[Recorder] focus state changed to (%d) with reason(%s)", (int)state_for_recording, __stt_get_focus_changed_reason_code(reason));
-
+
if (STTD_RECORDER_STATE_RECORDING == g_recorder_state && SOUND_STREAM_FOCUS_STATE_RELEASED == state_for_recording) {
SLOG(LOG_WARN, TAG_STTD, "[Recorder] Focus released as interrupt");
if (NULL != g_interrupt_cb) {
if (NULL != recorder) {
g_recorder_list = g_slist_remove(g_recorder_list, recorder);
- audio_in_destroy(recorder->audio_h);
-
+ if(recorder->audio_h) {
+ audio_in_destroy(recorder->audio_h);
+ recorder->audio_h = NULL;
+ }
free(recorder);
}
recorder = (stt_recorder_s*)calloc(1, sizeof(stt_recorder_s));
if (NULL == recorder) {
#ifndef TV_BT_MODE
- audio_in_destroy(temp_in_h);
+ if (temp_in_h) {
+ audio_in_destroy(temp_in_h);
+ temp_in_h = NULL;
+ }
#endif
SLOG(LOG_ERROR, TAG_STTD, "[Recorder ERROR] Fail to allocate memory");
return STTD_ERROR_OUT_OF_MEMORY;
#ifndef TV_BT_MODE
int ret;
if (STTD_RECORDER_STATE_RECORDING == g_recorder_state) {
- ret = audio_in_unprepare(recorder->audio_h);
- if (AUDIO_IO_ERROR_NONE != ret) {
- SLOG(LOG_ERROR, TAG_STTD, "[Recorder ERROR] Fail to unprepare audioin : %d", ret);
+ if (recorder->audio_h) {
+ ret = audio_in_unprepare(recorder->audio_h);
+ if (AUDIO_IO_ERROR_NONE != ret) {
+ SLOG(LOG_ERROR, TAG_STTD, "[Recorder ERROR] Fail to unprepare audioin : %d", ret);
+ }
}
g_recorder_state = STTD_RECORDER_STATE_READY;
}
- ret = audio_in_destroy(recorder->audio_h);
- if (AUDIO_IO_ERROR_NONE != ret) {
- SLOG(LOG_ERROR, TAG_STTD, "[Recorder ERROR] Fail to destroy audioin : %d", ret);
+ if (recorder->audio_h) {
+ ret = audio_in_destroy(recorder->audio_h);
+ if (AUDIO_IO_ERROR_NONE != ret) {
+ SLOG(LOG_ERROR, TAG_STTD, "[Recorder ERROR] Fail to destroy audioin : %d", ret);
+ }
+ recorder->audio_h = NULL;
}
-#else
+#else
if (STTD_RECORDER_STATE_RECORDING == g_recorder_state) {
g_recorder_state = STTD_RECORDER_STATE_READY;
}
SLOG(LOG_ERROR, TAG_STTD, "[Recorder ERROR] Fail to set stream info");
}
}
-
+
ret = audio_in_prepare(recorder->audio_h);
if (AUDIO_IO_ERROR_NONE != ret) {
SLOG(LOG_ERROR, TAG_STTD, "[Recorder ERROR] Fail to start audio : %d", ret);
if (AUDIO_IO_ERROR_NONE != ret) {
SLOG(LOG_ERROR, TAG_STTD, "[Recorder ERROR] Fail to unprepare audioin : %d", ret);
}
-#else
+#else
int bt_retry = 0;
bool stopped = false;
while (5 > bt_retry) {