[pulseaudio-discuss] Documentation for how rewinding works

Tanu Kaskinen tanuk at iki.fi
Tue Aug 21 23:28:48 PDT 2012


On Mon, 2012-08-20 at 09:43 +0200, David Henningsson wrote:
> On 08/19/2012 01:06 PM, Tanu Kaskinen wrote:
> > Hi,
> >
> > While reviewing a rewind related patch, I noticed that I don't
> > understand the rewinding code thoroughly, even though I have studied it
> > a few times in the past. I decided that I should write a wiki page for
> > the code so that working with it would be easier in the future for me
> > and everybody else.
> >
> > So, here's the result:
> > http://www.freedesktop.org/wiki/Software/PulseAudio/Documentation/Developer/Rewinding
> 
> Great writeup. :-) I think in case of resampling there would be even one 
> more buffer to deal with (per sink input)? Not strictly related to 
> rewinding though, so not sure if it's worth mentioning.

Whether or not it's related to rewinding depends on whether the buffer
can contain data between pa_resampler_run() calls, data which is neither
in the sink buffer or in the render_memblockq. Do the resamplers have
such buffers? They do: I added the leftover handling in 2.0, and that
buffer can, at least in theory, contain such data. The leftover data in
the resampler buffer should be taken into account when rewinding.
Currently that's not done. When there's a rewind that affects a
resampler, the resampler is reset, which throws away the leftover
buffer. That data is lost forever, which means that there's a skip in
the stream audio.

My impression is that in practice the leftover buffer is used extremely
rarely, and when it's used, it will contain only one frame. Therefore,
it's not a serious bug, but it's still a bug.

> > While doing that, I found quite a few bugs, which are noted on that
> > page. I don't plan fixing them any time soon (help with that would be
> > very welcome), so I will just file bugs about the issues so that they
> > are not forgotten.
> 
> Were there any bugs that popped out as being real problems for our users 
> today, rather than the more janitorial "it would be more elegant if we 
> didn't call it here and here, but instead here"?

There are real bugs that affect users today (e.g. audio skipping or
repeating when doing a rewind), but my impression is that they happen
only with filter sinks.

As a sidenote, I have observed some audio issues on my own machine that
sound like rewind bugs, but I don't use any filter sinks, so I probably
haven't found the cause for those problems. I haven't actively debugged
those issues either.

-- 
Tanu



More information about the pulseaudio-discuss mailing list