[PATCH] alsa-util: Reset hwparams_copy before the second try of buffer setup

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 2014-03-21 at 09:18 +0200, Peter Ujfalusi wrote:
> hwparams_copy needs to be reset (as it is also reset for the third and
> fourth try) before the second try.
> 
> If the reset is not done and the first try fails:
> D: [lt-pulseaudio] alsa-util.c: Maximum hw buffer size is 743 ms
> I: [lt-pulseaudio] alsa-util.c: snd_pcm_hw_params_set_buffer_size_near() failed: Invalid argument
> I: [lt-pulseaudio] alsa-util.c: snd_pcm_hw_params_set_period_size_near() failed: Invalid argument
> I: [lt-pulseaudio] alsa-util.c: snd_pcm_hw_params_set_buffer_size_near() failed: Invalid argument
> D: [lt-pulseaudio] alsa-util.c: Set only period size (to 1102 samples).
> 
> We have three failures and finally the fourth (only period size) succeed.
> 
> With this patch:
> D: [lt-pulseaudio] alsa-util.c: Maximum hw buffer size is 743 ms
> I: [lt-pulseaudio] alsa-util.c: snd_pcm_hw_params_set_buffer_size_near() failed: Invalid argument
> D: [lt-pulseaudio] alsa-util.c: Set period size first (to 1102 samples), buffer size second (to 4408 samples).
> 
> We only fail with the first try, the second (period followed by buffer) is
> fine.
> 
> 
> Signed-off-by: Peter Ujfalusi <peter.ujfalusi at ti.com>
> ---
>  src/modules/alsa/alsa-util.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/src/modules/alsa/alsa-util.c b/src/modules/alsa/alsa-util.c
> index dca1f2e4c54d..1ce2e16d5f0c 100644
> --- a/src/modules/alsa/alsa-util.c
> +++ b/src/modules/alsa/alsa-util.c
> @@ -327,6 +327,7 @@ int pa_alsa_set_hw_params(
>                  goto success;
>              }
>  
> +            snd_pcm_hw_params_copy(hwparams_copy, hwparams);
>              /* Second try: set period size first, followed by buffer size */
>              if (set_period_size(pcm_handle, hwparams_copy, _period_size) >= 0 &&
>                  set_buffer_size(pcm_handle, hwparams_copy, _buffer_size) >= 0 &&

Thanks! Applied.

-- 
Tanu



[Index of Archives]     [Linux Audio Users]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux