[pulseaudio-discuss] write callback stops getting called

Eric Thornton gonesurfingnc at yahoo.com
Tue Apr 7 21:02:23 PDT 2015


I ran into this issue also. Once a buffer underrun occurs, you won't get any more write callbacks until you satisfy the prebuf attribute value. Setting it to 0 certainly will work around this if you don't need a playback buffer. However you can use the buffer underrun callback to write the required amount of data to the playback stream, then playback will start once the number of bytes set by prebuf is received by the server. Write callbacks will resume normally at that point.


Hope this helps.


Eric

Sent from Yahoo Mail on Android

From:"Andrew Kelley" <superjoe30 at gmail.com>
Date:Sat, Apr 4, 2015 at 11:14 PM
Subject:Re: [pulseaudio-discuss] write callback stops getting called

Found this just after I sent the email: 


To make sure that a particular stream doesn't stop to play when a server side buffer underrun happens on it while the other synchronized streams continue playing and hence deviate, you need to pass a "prebuf" pa_buffer_attr of 0 when connecting it.


from http://freedesktop.org/software/pulseaudio/doxygen/streams.html#sync_streams


I tried setting `prebuf` to 0 instead of `(uint_t) -1` and it looks like that did the trick.


On Sat, Apr 4, 2015 at 8:06 PM, Andrew Kelley <superjoe30 at gmail.com> wrote:

I have a program which plays an audio file with some filtering using the PulseAudio asynchronous API. When the CPU usage spikes elsewhere in my computer, for example if I do `make -j` to use up all processing power, the filter code runs a little slow and might cause a buffer underrun. Sometimes this causes PulseAudio to stop calling the write callback. I checked and I am certainly calling `begin_write` and `write` for each time that the write callback is called.


How can I ensure that PulseAudio continues to call the write callback?


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/pulseaudio-discuss/attachments/20150407/428d84ae/attachment-0001.html>


More information about the pulseaudio-discuss mailing list