[pulseaudio-discuss] Multiple PulseAudio bugs affecting mplayer2 users

Uoti Urpala uoti.urpala at pp1.inet.fi
Mon Aug 6 07:12:15 PDT 2012


On Mon, 2012-08-06 at 11:29 +0200, David Henningsson wrote:
> Just a thing I spotted while reading it through quickly:
> 
>  > +static void subtract_helper(size_t *p, size_t amount)
>  > +{
>  > +    if (*p == (size_t) -1)
>  > +        return;
>  > +    if (*p < amount)
>  > +        *p = 0;
>  > +    *p -= amount;
>  > +}
> 
> Maybe you meant:
> 
> if (*p < amount)
>      *p = 0;
> else
>      *p -= amount;
> 
> Otherwise *p might end up being "-amount" instead of "0"?

Yes.

After this change, the use of underrun_for in sink_input_pop_cb() may
also need to be changed to make sure the PLAYBACK_STREAM_MESSAGE_STARTED
is sent even if underrun_for goes back to 0 due to a rewind (if we
already told the client that playback was stopped). I wonder if there is
any reason why that test uses underrun_for instead of s->is_underrun.
Only because the is_underrun field was added after that test and the
code was not made consistent later?



More information about the pulseaudio-discuss mailing list