[MPlayer-dev-eng] [PATCH 2/2] playback_speed limits: MP_CMD_SPEED_*

Reimar Döffinger Reimar.Doeffinger at stud.uni-karlsruhe.de
Sun Jun 3 20:03:06 CEST 2007


Hello,
On Sat, Jun 02, 2007 at 03:10:37PM -0400, Robert Juliano wrote:
> Patch 2: prevent non-positive playback_speed
> 
> While -speed and mp_property_playback_speed clamp playback_speed,
> MP_CMD_SPEED_* didn't.  Ex. with input.conf "[ speed_incr -0.1",
> playback_speed could still become non-positive.

Actually I think that is not the case and this is a bug that your first
patch introduces.

>                 playback_speed += v;
> +               if (playback_speed <= 0) playback_speed = .01;

This check makes no sense, if the current value was e.g. 0.005 and you
give the command to decrease it the code will actually increase it to
0.01 instead of leaving it unchanged.
 playback_speed = FFMAX(playback_speed, 0.01);
would work better.
And while you're at it you might want to also add a check that the
sample rate integer will not overflow for too big values.

Greetings,
Reimar Döffinger



More information about the MPlayer-dev-eng mailing list