[pulseaudio-discuss] [PATCH] pulse: Fix invalid buffer pointer return value
gmane at colin.guthr.ie
Sun Jan 10 10:45:06 PST 2010
'Twas brillig, and David Henningsson at 10/01/10 18:35 did gyre and gimble:
> David Henningsson wrote:
>>> 'Twas brillig, and David Henningsson at 09/01/10 09:00 did gyre and
>>>> The pulse ALSA plugin has been known, for a while, to not work properly,
>>>> causing underruns, hangs etc. I sat down yesterday trying to figure it
>>>> out, and I'm pretty certain this patch improves the situation, but I
>>>> don't mind getting some help testing it before it is committed upstream.
>>>> Related bug: https://bugs.launchpad.net/bugs/485488
>>>> The patch is for the alsa-plugins tree at git.alsa-projects.org.
>>> I applied this to 1.0.22 (cleanly) and sadly it's not helping my test
>>> case using mpg123.
>> I've tried to debug the mpg123 issue a little further.
> To sum up, I have two solutions/workarounds which both (independently)
> fixes the mpg123 issue, but I could use some discussion regarding we
> should apply either or both. And as said earlier, this is something
> different from the patch posted earlier.
> First, we can avoid the initial underrun altogether by avoiding calling
> pa_stream_cork() and pa_stream_trigger() after having written just a few
> bytes. If we do that, playback will start when prebuf number of bytes
> have been written instead.
> Second, we can ignore underruns if more buffers have been pushed since
> the underrun occurred. Assuming the first fix is not applied, this will
> cause an initial - to me inaudible - underrun, but since more buffers
> are pushed in queue, the underrun will end automatically and after that
> the stream will hopefully flow the way it should.
> Both fixes can, at least in theory, cause regressions. (And according to
> both Murphy's law and own experience - if it breaks in theory, it
> probably breaks in practice as well!) The first fix could cause a
> regression for short event sounds where we never reach the prebuf limit.
> The second could perhaps cause regressions for ALSA clients
> automatically increasing buffer size if they find an underrun. Hiding
> that underrun would then be a bad thing.
Awesome work, thanks for looking into this in such depth.
Lennart is the best person to comment on this as I'm nowhere near
qualified. Hopefully he'll do a purge of his ML queue soon and provide
some feedback :)
Tribalogic Limited [http://www.tribalogic.net/]
Mandriva Linux Contributor [http://www.mandriva.com/]
PulseAudio Hacker [http://www.pulseaudio.org/]
Trac Hacker [http://trac.edgewall.org/]
More information about the pulseaudio-discuss