From: Jeff W. <we...@ya...> - 2005-11-12 15:48:17
|
Hi James, Good to hear from you! I've been reading a little on ALSA this pase week, and it looks like not handling the EPIPE error is behind some of GWC's troubles. I was showing the "broken pipe" errors consistently at the end of a playback section -- because the playback cursor lags a few milliseconds behind the audio playback, and the call to snd_pcm_delay in function audio_device_processed_bytes would give the EPIPE when the audio_buffer had already emptied. This does not affect playback sound quality, but I have trapped that error. I took your thought here about the EPIPE in the nonblocking_write_buffersize call and added one tweak -- attempt recover the sound device handle before failing. Attached is my current audio_alsa.c (which changed the function perr to snd_perr, and recover_write to recover_snd_handle.) See how this works. Johan, let us know. I think there is still problems with the audio buffer size, and when playback starts there will be a message on the console, if you could tell us what it says: "ALSA audio_device_best_buffer_size:xxxx (frames:xxxx)" --- For the Makefile problem, if you will insert the lines from Makefile.fix indicated below, it will pick up changes to the audio src. You can put these lines into Makefile.in as well and then "configure" will build the right Makefile. I'd just send my Makefile but I don't know what other options you may or may not have. Be sure for the indents that it is a single tab, or make won't work properly. ############### Changes for Makefile #################################### gwc : $(OBJS) meschach.a $(CC) $(OBJS) $(EFENCE) $(LFLAGS) $(LIBS) -o gwc ==> ==> audio_device.o : audio_device.c audio_alsa.c audio_oss.c audio_osx.c ==> $(COMPILE) -c audio_device.c .c.o : $(COMPILE) -c $< ##################################################################### Cheers, Jeff James Tappin wrote: >On Wednesday 02 November 2005 21:51, Johan De Groote wrote: >JD> I can open it fine, load a file, make a selection etc. But if I hit > playback I JD> get: >JD> >JD> ... >JD> ########################################################## >JD> audio_device_nonblocking_write_buffer_size: snd_pcm_avail_update >JD> Broken pipe >JD> audio_device_processed_bytes: snd_pcm_delay Broken pipe >JD> ########################################################## >JD> audio_device_nonblocking_write_buffer_size: snd_pcm_avail_update >JD> Broken pipe >JD> audio_device_processed_bytes: snd_pcm_delay Broken pipe >JD> ... >JD> >JD> Once this message starts sound stops and so does the cursor. Until I stop >JD> playback this message keeps coming in the terminal. The time to get this > is JD> variable, but never longer than a few seconds (15 at most). Gwc > doesn't JD> crash, and alsa continues as well. Hitting playback again will > restart the JD> selection, until "it" happens again. >JD> > >Hi, I'm back! > >I think I'm making some progress on this one (which seems to be a similar >problem to one I was having a while back (April 04) [only then it wasn't >possible to stop it]. snd_pcm_avail_update() returns -EPIPE if the output >buffer has emptied, and the driver has tried to get some data. Because >audio_device_nonblocking_write_buffer_size() bails out on any error, the >buffer never gets filled so it goes into an infinite loop. I think that the >answer is at least in part to modify audio_alsa.c, so that a "broken pipe >error is effectively ignored (patch at the end) -- it could be rearranged to >eliminate the message altogether but I was trying to see what influenced the >problem. > >The other things that may help are to increase the buffer size (in >audio_device.h) [BTW there is a redundant redefinition of MAXBUFSIZE in >audio_util.c which ought to be removed.] and not popping windows or generally >doing too much with X while playing back. > >James > >P.S. I've changed distro yet again -- Kubuntu now. > >++ BEGIN PATCH ++ >*** audio_alsa.c 2005-11-11 16:28:08.000000000 +0000 >--- audio_alsa.c~ 2005-11-11 15:57:50.000000000 +0000 >*************** >*** 267,273 **** > if (frames < 0) { > perr("audio_device_nonblocking_write_buffer_size: >snd_pcm_avail_update", > frames); >! if (frames != -EPIPE ) return 0; > } > len = snd_pcm_frames_to_bytes(handle, frames); > >--- 267,273 ---- > if (frames < 0) { > perr("audio_device_nonblocking_write_buffer_size: >snd_pcm_avail_update", > frames); >! return 0; > } > len = snd_pcm_frames_to_bytes(handle, frames); > ++END PATCH++ > > >As far as I can tell > > |