Commit 6ee77139 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont
Browse files

alsa: set period time before buffer time

Currently, the period time is more critical, so constrain it first.
Both values are interdependant with some drivers.
parent 570edfeb
......@@ -472,6 +472,15 @@ static int Start (audio_output_t *aout, audio_sample_format_t *restrict fmt)
}
sys->rate = fmt->i_rate;
#if 1 /* work-around for period-long latency outputs (e.g. PulseAudio): */
param = AOUT_MIN_PREPARE_TIME;
val = snd_pcm_hw_params_set_period_time_near (pcm, hw, &param, NULL);
if (val)
{
msg_Err (aout, "cannot set period: %s", snd_strerror (val));
goto error;
}
#endif
/* Set buffer size */
param = AOUT_MAX_ADVANCE_TIME;
val = snd_pcm_hw_params_set_buffer_time_near (pcm, hw, &param, NULL);
......@@ -489,15 +498,13 @@ static int Start (audio_output_t *aout, audio_sample_format_t *restrict fmt)
}
else
param /= 2;
#else /* work-around for period-long latency outputs (e.g. PulseAudio): */
param = AOUT_MIN_PREPARE_TIME;
#endif
val = snd_pcm_hw_params_set_period_time_near (pcm, hw, &param, NULL);
if (val)
{
msg_Err (aout, "cannot set period: %s", snd_strerror (val));
goto error;
}
#endif
/* Commit hardware parameters */
val = snd_pcm_hw_params (pcm, hw);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment