[pulseaudio-discuss] Possible bug in pa_sink_input_request_rewind

Tanu Kaskinen tanu.kaskinen at linux.intel.com
Mon Nov 11 03:35:51 PST 2013

On Fri, 2013-11-08 at 23:18 +0600, Alexander E. Patrakov wrote:
> Hello.
> In pa_sink_input_request_rewind, nbytes == 0 means "rewind as far as
> possible". However, I think I have found (by code inspection) a case
> where it is not honored. The case is where
> i->thread_info.rewrite_nbytes is already non-zero due to a prior
> rewind request.
> In this case, nbytes will be set to i->thread_info.rewrite_nbytes (a
> non-zero value) and thus the later test for nbytes <= 0 will fail.

Yes, it looks like you're right. So if two rewind requests are merged,
where the first one is "rewind a little bit" and the second is "rewind
everything", the end result will be that only a little bit will be

> BTW, the "<=" is misleading, as nbytes is unsigned.

I think it's part of Lennart's coding style. I don't like it much
either, but it's a very common thing in PulseAudio's code base to use
"foo <= 0" for unsigned variables.


More information about the pulseaudio-discuss mailing list