Hi all,
I follow the audio i/o tutorial (https://developer.tizen.org/dev-guide/2.4/org.tizen.tutorials/html/native/multimedia/audio_io_tutorial_n.htm) to build a real-time audio recording app. However, the callback is called very infrequently for recording the whole sound. For example, when I start the recording for 5 second, the callback actually only gives a 2-second clip (instead of 5).
Here is a dummy testing code which only dumps how many bytes have been recorded:
int _audio_read_total;
static void _audio_io_stream_read_cb(audio_in_h handle, size_t nbytes, void *userdata)
{
const void *buffer = NULL;
if (nbytes > 0) {
int error_code = audio_in_peek(handle, &buffer, &nbytes);
_audio_read_total += nbytes;
dlog_print(DLOG_DEBUG, LOG_TAG, "nbytes = %d,_audio_read_total = %d", nbytes, _audio_read_total);
error_code = audio_in_drop(handle); // remove audio data from internal buffer
}
}
static void start_audio_recording(appdata_s *ad)
{
int error_code = audio_in_create(48000, AUDIO_CHANNEL_MONO, AUDIO_SAMPLE_TYPE_S16_LE, &ad->input);
error_code = audio_in_set_stream_cb(ad->input, _audio_io_stream_read_cb, ad);
error_code = audio_in_prepare(ad->input);}

