Update of /cvsroot/alsa/alsa-lib/src/pcm In directory sc8-pr-cvs1:/tmp/cvs-serv11592
Modified Files: pcm.c Log Message: - snd_pcm_wait() returns more understandable error code when an error happens during poll(). - clean up the code along with the change above. Index: pcm.c =================================================================== RCS file: /cvsroot/alsa/alsa-lib/src/pcm/pcm.c,v retrieving revision 1.256 retrieving revision 1.257 diff -u -r1.256 -r1.257 --- pcm.c 22 Jun 2003 09:59:03 -0000 1.256 +++ pcm.c 16 Jul 2003 11:37:25 -0000 1.257 @@ -2000,6 +2000,7 @@ * \param pcm PCM handle * \param timeout maximum time in milliseconds to wait * \return a positive value on success otherwise a negative error code + * (-EPIPE for the xrun and -ESTRPIPE for the suspended status) * \retval 0 timeout occurred * \retval 1 PCM stream is ready for I/O */ @@ -2016,8 +2017,17 @@ err = snd_pcm_poll_descriptors_revents(pcm, &pfd, 1, &revents); if (err < 0) return err; - if (revents & (POLLERR | POLLNVAL)) - return -EIO; + if (revents & (POLLERR | POLLNVAL)) { + /* check more precisely */ + switch (snd_pcm_state(pcm)) { + case SND_PCM_STATE_XRUN: + return -EPIPE; + case SND_PCM_STATE_SUSPENDED: + return -ESTRPIPE; + default: + return -EIO; + } + } return err > 0 ? 1 : 0; } @@ -6110,15 +6120,8 @@ } err = snd_pcm_wait(pcm, -1); - state = snd_pcm_state(pcm); - if (err < 0) { - /* check more precisely */ - if (state == SND_PCM_STATE_XRUN) - err = -EPIPE; - else if (state == SND_PCM_STATE_SUSPENDED) - err = -ESTRPIPE; + if (err < 0) break; - } goto _again; } @@ -6187,15 +6190,8 @@ } err = snd_pcm_wait(pcm, -1); - state = snd_pcm_state(pcm); - if (err < 0) { - /* check more precisely */ - if (state == SND_PCM_STATE_XRUN) - err = -EPIPE; - else if (state == SND_PCM_STATE_SUSPENDED) - err = -ESTRPIPE; + if (err < 0) break; - } goto _again; } ------------------------------------------------------- This SF.net email is sponsored by: VM Ware With VMware you can run multiple operating systems on a single machine. WITHOUT REBOOTING! Mix Linux / Windows / Novell virtual machines at the same time. Free trial click here: http://www.vmware.com/wl/offer/345/0 _______________________________________________ Alsa-cvslog mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/alsa-cvslog