Patch by James Zern, Google, Inc. backport r23449 by cehoyos Originally committed as revision 23455 to svn://svn.ffmpeg.org/ffmpeg/branches/0.6