[FFmpeg-devel] Cancel common in_rate/out_rate factors in resample2.c/av_resample_init?

Uoti Urpala uoti.urpala
Sun Oct 28 00:12:24 CEST 2007

While removing the private rational number implementation from MPlayer's
libaf I noticed that af_lavcresample currently cancels common factors in
the in_rate/out_rate values passed to av_resample_init. After a quick
look to the resample2.c code it looks like large values could at least
trigger an overflow and so the cancelling could potentially be useful.
It won't avoid all problems though if rates large enough to cause them
occur, as adjusting playback speed with the default keys is likely to
give values with no common factors.

It would be easy to keep this in the MPlayer code (add one "int gcd =
ff_gcd(a,b);" line and divide both arguments by that in the call), but
if it really is useful then always doing it in the called FFmpeg code
would make sense.

More information about the ffmpeg-devel mailing list