mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2025-10-29 05:40:25 -04:00
pcm: hw: fix the silence size setup in drain
The silence size cannot exceed the silence threshold. Move the check from the manual condition to the common code. This may happen for small ring buffers (where the 1/10th second is too large). Suggested-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
parent
798f387fe9
commit
58077e2f0d
1 changed files with 2 additions and 2 deletions
|
|
@ -747,8 +747,6 @@ static int snd_pcm_hw_drain(snd_pcm_t *pcm)
|
|||
snd_pcm_sw_params_current_no_lock(pcm, &sw_params);
|
||||
if (hw->drain_silence > 0) {
|
||||
silence_size = (pcm->rate * hw->drain_silence) / 1000;
|
||||
if (silence_size > pcm->buffer_size)
|
||||
silence_size = pcm->buffer_size;
|
||||
goto __manual_silence;
|
||||
}
|
||||
/* compute end silence size, align to period size + extra time */
|
||||
|
|
@ -770,6 +768,8 @@ __manual_silence:
|
|||
* or the next period wake up)
|
||||
*/
|
||||
sw_params.silence_threshold = pcm->buffer_size;
|
||||
if (silence_size > pcm->buffer_size)
|
||||
silence_size = pcm->buffer_size;
|
||||
sw_params.silence_size = silence_size;
|
||||
if (ioctl(hw->fd, SNDRV_PCM_IOCTL_SW_PARAMS, &sw_params) < 0) {
|
||||
err = -errno;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue