Patch by Eli.Friedman (gmail) Originally committed as revision 24104 to svn://svn.ffmpeg.org/ffmpeg/trunk