From b1a62661bfccdddeaa39d691722d83f8aab4eb9f Mon Sep 17 00:00:00 2001 From: gineera Date: Tue, 13 Aug 2013 20:37:04 +0000 Subject: [PATCH] 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). --- src/hostapi/alsa/pa_linux_alsa.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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; } -- 2.43.0