From mboxrd@z Thu Jan 1 00:00:00 1970 From: Takashi Iwai Subject: Re: possible ALSA bug/feature (was: important recording broke. why?) (fwd) Date: Tue, 25 Mar 2003 19:01:35 +0100 Sender: alsa-devel-admin@lists.sourceforge.net Message-ID: References: Mime-Version: 1.0 (generated by SEMI 1.14.4 - "Hosorogi") Content-Type: multipart/mixed; boundary="Multipart_Tue_Mar_25_19:01:35_2003-1" Return-path: In-Reply-To: Errors-To: alsa-devel-admin@lists.sourceforge.net List-Help: List-Post: List-Subscribe: , List-Unsubscribe: , List-Archive: To: Kai Vehmanen Cc: alsa-devel@lists.sourceforge.net, The Eye List-Id: alsa-devel@alsa-project.org --Multipart_Tue_Mar_25_19:01:35_2003-1 Content-Type: text/plain; charset=US-ASCII At Fri, 21 Mar 2003 16:16:04 +0200 (EET), Kai Vehmanen wrote: > > Hi, > > first please read the mail to ecasound-list below. > > It seems that with newer ALSA versions, snd_pcm_read[in]() sometimes > returns -EIO even though documentation says nothing about this. After some > testing this seems to not happen on direct hw-access, only with > the pcm_plugin. The EIO comes from snd_pcm_wait(). > > Is this a bug or or a feature? i also don't know whether Jaroslav added as a feature or as an unexpected bug. anyway, this means that the poll failed and the pcm status is abnormal, typically xruns... how about the attached patch? (untested) Takashi --Multipart_Tue_Mar_25_19:01:35_2003-1 Content-Type: application/octet-stream Content-Disposition: attachment; filename="pcm-poll-err-fix.dif" Content-Transfer-Encoding: 7bit Index: alsa-lib/src/pcm/pcm.c =================================================================== RCS file: /suse/tiwai/cvs/alsa/alsa-lib/src/pcm/pcm.c,v retrieving revision 1.130 diff -u -r1.130 pcm.c --- alsa-lib/src/pcm/pcm.c 20 Mar 2003 11:06:13 -0000 1.130 +++ alsa-lib/src/pcm/pcm.c 25 Mar 2003 18:00:13 -0000 @@ -6110,9 +6110,15 @@ } err = snd_pcm_wait(pcm, -1); - if (err < 0) - break; 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; + break; + } goto _again; } --Multipart_Tue_Mar_25_19:01:35_2003-1-- ------------------------------------------------------- This SF.net email is sponsored by: The Definitive IT and Networking Event. Be There! NetWorld+Interop Las Vegas 2003 -- Register today! http://ads.sourceforge.net/cgi-bin/redirect.pl?keyn0001en