[MPlayer-dev-eng] [PATCH] Fix int wrap around in af_gcd from /libaf/af.c
Rich Felker
dalias at aerifal.cx
Mon Sep 18 09:53:21 CEST 2006
On Sat, Sep 16, 2006 at 02:22:36PM +0200, Ahmet İnan wrote:
> i was wondering, why "-af resample=9600:0:2" worked from 44100hz files, but
> always failed from 48000hz files.
>
> it turned out to be a problem in "af_gcd" from "/libaf/af.c", where:
>
> "if (a * b_org < 0)"
>
> would be fine, as long as the multiplication wouldnt leave the limits of "int".
> it does for 48000 * 96000 tho. so ive come up with this solution:
>
> "if (a < 0 && b_org > 0 || a > 0 && b_org < 0)"
>
> im sure, there are more elegant and better ways for this, but currently, this
> solves it for me. it would be nice to have this in the next release included.
Try if ((a ^ b) < 0)
And give a few hundred litres to whoever came up with using a multiply
for this test in the first place...
Rich
More information about the MPlayer-dev-eng
mailing list