mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2025-10-29 05:40:25 -04:00
Fix drain of dmix without data
Fixed the drain of dmix plugin without any data. It should return immediately.
This commit is contained in:
parent
2ada7a8b81
commit
cf4f4bc9c4
1 changed files with 8 additions and 3 deletions
|
|
@ -487,9 +487,14 @@ static int snd_pcm_dmix_drain(snd_pcm_t *pcm)
|
||||||
return -EBADFD;
|
return -EBADFD;
|
||||||
if (pcm->mode & SND_PCM_NONBLOCK)
|
if (pcm->mode & SND_PCM_NONBLOCK)
|
||||||
return -EAGAIN;
|
return -EAGAIN;
|
||||||
if (dmix->state == SND_PCM_STATE_PREPARED &&
|
if (dmix->state == SND_PCM_STATE_PREPARED) {
|
||||||
snd_pcm_mmap_playback_hw_avail(pcm) > 0)
|
if (snd_pcm_mmap_playback_hw_avail(pcm) > 0)
|
||||||
snd_pcm_dmix_start(pcm);
|
snd_pcm_dmix_start(pcm);
|
||||||
|
else {
|
||||||
|
snd_pcm_dmix_drop(pcm);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
stop_threshold = pcm->stop_threshold;
|
stop_threshold = pcm->stop_threshold;
|
||||||
if (pcm->stop_threshold > pcm->buffer_size)
|
if (pcm->stop_threshold > pcm->buffer_size)
|
||||||
pcm->stop_threshold = pcm->buffer_size;
|
pcm->stop_threshold = pcm->buffer_size;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue