static unsigned char *audiobuf;
static size_t bytes_per_frame;
static struct timeval *start_time;
static unsigned char *audiobuf;
static size_t bytes_per_frame;
static struct timeval *start_time;
snd_pcm_info_alloca(&info);
if (snd_output_stdio_attach(&log, stderr, 0) < 0)
snd_pcm_info_alloca(&info);
if (snd_output_stdio_attach(&log, stderr, 0) < 0)
return -E_SET_BUFFER_TIME;
if (snd_pcm_hw_params(handle, hwparams) < 0)
return -E_HW_PARAMS;
return -E_SET_BUFFER_TIME;
if (snd_pcm_hw_params(handle, hwparams) < 0)
return -E_HW_PARAMS;
- PARA_DEBUG_LOG("buffer size: %lu, period_size: %lu\n", buffer_size, chunk_size);
- if (chunk_size == buffer_size)
+ PARA_DEBUG_LOG("buffer size: %lu, period_size: %lu\n", buffer_size, period_size);
+ if (period_size == buffer_size)
return -E_BAD_PERIOD;
snd_pcm_sw_params_current(handle, swparams);
err = snd_pcm_sw_params_get_xfer_align(swparams, &xfer_align);
if (err < 0 || !xfer_align)
return -E_GET_XFER;
// snd_pcm_sw_params_set_sleep_min(handle, swparams, 0);
return -E_BAD_PERIOD;
snd_pcm_sw_params_current(handle, swparams);
err = snd_pcm_sw_params_get_xfer_align(swparams, &xfer_align);
if (err < 0 || !xfer_align)
return -E_GET_XFER;
// snd_pcm_sw_params_set_sleep_min(handle, swparams, 0);
if (snd_pcm_sw_params(handle, swparams) < 0)
return -E_SW_PARAMS;
bytes_per_frame = snd_pcm_format_physical_width(FORMAT) * conf.channels_arg / 8;
if (snd_pcm_sw_params(handle, swparams) < 0)
return -E_SW_PARAMS;
bytes_per_frame = snd_pcm_format_physical_width(FORMAT) * conf.channels_arg / 8;