snd_pcm_poll_descriptors_count is not reliable use SIO_MAXNFDS

This commit is contained in:
Alexandre Ratchov 2012-10-26 18:50:09 +02:00
parent 1e60e2e649
commit 1c240e397d
2 changed files with 11 additions and 6 deletions

View File

@ -269,11 +269,16 @@ sio_alsa_open(const char *str, unsigned mode, int nbio)
goto bad_free_opcm;
}
}
hdl->nfds = 0;
if (mode & SIO_PLAY)
hdl->nfds += snd_pcm_poll_descriptors_count(hdl->opcm);
if (mode & SIO_REC)
hdl->nfds += snd_pcm_poll_descriptors_count(hdl->ipcm);
/*
* snd_pcm_poll_descriptors_count returns a small value
* that grow later, after the stream is started
*/
hdl->nfds = SIO_MAXNFDS;
//if (mode & SIO_PLAY)
// hdl->nfds += snd_pcm_poll_descriptors_count(hdl->opcm);
//if (mode & SIO_REC)
// hdl->nfds += snd_pcm_poll_descriptors_count(hdl->ipcm);
DPRINTF("mode = %d, nfds = %d\n", mode, hdl->nfds);
/*

View File

@ -20,7 +20,7 @@
#include <sys/param.h>
#include "sndio.h"
#define SIO_MAXNFDS 16
#define SIO_MAXNFDS 4
/*
* private ``handle'' structure