mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2025-11-04 13:30:08 -05:00
Fix blocking during draining in dmix
Fix the blocking during draining in dmix plugin due to ioctl conflicts (bug #1074). This is a temporary workaround.
This commit is contained in:
parent
10557ca6b9
commit
1aaf4a50af
1 changed files with 14 additions and 10 deletions
|
|
@ -35,6 +35,7 @@
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
|
#include <sys/poll.h>
|
||||||
#include <sys/shm.h>
|
#include <sys/shm.h>
|
||||||
#include <sys/sem.h>
|
#include <sys/sem.h>
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
|
|
@ -418,16 +419,19 @@ int snd_pcm_direct_async(snd_pcm_t *pcm, int sig, pid_t pid)
|
||||||
/* empty the timer read queue */
|
/* empty the timer read queue */
|
||||||
void snd_pcm_direct_clear_timer_queue(snd_pcm_direct_t *dmix)
|
void snd_pcm_direct_clear_timer_queue(snd_pcm_direct_t *dmix)
|
||||||
{
|
{
|
||||||
|
struct pollfd fds[4];
|
||||||
|
int fdn = snd_timer_poll_descriptors(dmix->timer, fds, 4);
|
||||||
|
|
||||||
|
while (poll(fds, fdn, 0) > 0) {
|
||||||
/* rbuf might be overwriten by multiple plugins */
|
/* rbuf might be overwriten by multiple plugins */
|
||||||
/* we don't need the value */
|
/* we don't need the value */
|
||||||
if (dmix->tread) {
|
if (dmix->tread) {
|
||||||
snd_timer_tread_t rbuf;
|
snd_timer_tread_t rbuf;
|
||||||
while (snd_timer_read(dmix->timer, &rbuf, sizeof(rbuf)) == sizeof(rbuf))
|
snd_timer_read(dmix->timer, &rbuf, sizeof(rbuf));
|
||||||
;
|
|
||||||
} else {
|
} else {
|
||||||
snd_timer_read_t rbuf;
|
snd_timer_read_t rbuf;
|
||||||
while (snd_timer_read(dmix->timer, &rbuf, sizeof(rbuf)) == sizeof(rbuf))
|
snd_timer_read(dmix->timer, &rbuf, sizeof(rbuf));
|
||||||
;
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue