pcm: hw_params - copy periods and buffer_time to the local variable

It is expected to return the correct numbers for get_periods and
get_buffer_time requests. Copy the appropriate fields in the
hw_params call.

Fixes: https://github.com/alsa-project/alsa-lib/issues/258
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
Jaroslav Kysela 2022-08-18 11:23:42 +02:00
parent 8033ff9996
commit 0222f45d11

View file

@ -2407,6 +2407,8 @@ int _snd_pcm_hw_params_internal(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
INTERNAL(snd_pcm_hw_params_get_subformat)(params, &pcm->subformat);
INTERNAL(snd_pcm_hw_params_get_channels)(params, &pcm->channels);
INTERNAL(snd_pcm_hw_params_get_rate)(params, &pcm->rate, 0);
snd_interval_copy(&pcm->periods, &params->intervals[SND_PCM_HW_PARAM_PERIODS - SND_PCM_HW_PARAM_FIRST_INTERVAL]);
snd_interval_copy(&pcm->buffer_time, &params->intervals[SND_PCM_HW_PARAM_BUFFER_TIME - SND_PCM_HW_PARAM_FIRST_INTERVAL]);
INTERNAL(snd_pcm_hw_params_get_period_time)(params, &pcm->period_time, 0);
INTERNAL(snd_pcm_hw_params_get_period_size)(params, &pcm->period_size, 0);
INTERNAL(snd_pcm_hw_params_get_buffer_size)(params, &pcm->buffer_size);