mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2025-11-03 09:01:52 -05:00
pcm: hw - prevent divide by zero for broken apps
Fixes: https://github.com/alsa-project/alsa-lib/issues/318 Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
parent
904f0f7e7a
commit
3661bdae35
1 changed files with 3 additions and 0 deletions
|
|
@ -742,6 +742,9 @@ static int snd_pcm_hw_drain(snd_pcm_t *pcm)
|
||||||
|
|
||||||
if (pcm->stream != SND_PCM_STREAM_PLAYBACK)
|
if (pcm->stream != SND_PCM_STREAM_PLAYBACK)
|
||||||
goto __skip_silence;
|
goto __skip_silence;
|
||||||
|
/* stream probably in SETUP, prevent divide by zero */
|
||||||
|
if (pcm->period_size == 0)
|
||||||
|
goto __skip_silence;
|
||||||
if (hw->drain_silence == 0 || hw->perfect_drain)
|
if (hw->drain_silence == 0 || hw->perfect_drain)
|
||||||
goto __skip_silence;
|
goto __skip_silence;
|
||||||
snd_pcm_sw_params_current_no_lock(pcm, &sw_params);
|
snd_pcm_sw_params_current_no_lock(pcm, &sw_params);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue