From: gineera Date: Tue, 13 Aug 2013 20:37:04 +0000 (+0000) Subject: Alsa: Fix handling of poll descriptors in PaAlsaStream_WaitForFrames(). Otherwise... X-Git-Tag: pa_stable_v19_20140130_r1919~13 X-Git-Url: https://andrewgundersen.net/repos?a=commitdiff_plain;h=b1a62661bfccdddeaa39d691722d83f8aab4eb9f;p=portaudio Alsa: Fix handling of poll descriptors in PaAlsaStream_WaitForFrames(). Otherwise if capture signals before playback a duplex stream could poll the wrong descriptor, causing a loop (reported by Alexander Kartashov). --- diff --git a/src/hostapi/alsa/pa_linux_alsa.c b/src/hostapi/alsa/pa_linux_alsa.c index 7783d01..acd01cd 100644 --- a/src/hostapi/alsa/pa_linux_alsa.c +++ b/src/hostapi/alsa/pa_linux_alsa.c @@ -3770,7 +3770,8 @@ static PaError PaAlsaStream_WaitForFrames( PaAlsaStream *self, unsigned long *fr } if( pollPlayback ) { - playbackPfds = self->pfds + (self->capture.pcm ? self->capture.nfds : 0); + /* self->pfds is in effect an array of fds; if necessary, index past the capture fds */ + playbackPfds = self->pfds + (pollCapture ? self->capture.nfds : 0); PA_ENSURE( PaAlsaStreamComponent_BeginPolling( &self->playback, playbackPfds ) ); totalFds += self->playback.nfds; }