[vlc-devel] Re: ffmpeg encoder bugfix: almost fed libavcodec with a frame in the past

Måns Rullgård mru at inprovide.com
Wed Jan 10 22:00:03 CET 2007


Robert Stepanek <rost at lo-res.org> writes:

> Hi,
>
> when using the current SVN version (Revision: 18544) and transcoding
> a stream using the ffmpeg encoder plugin I get the following error
> messages: "ffmpeg encoder warning: almost fed libavcodec with a frame
> in the past (current: -9223372036854775808, last: 0)" and no video
> frames at all.
>
> This is due to a cast in modules/codec/ffmpeg/encoder.c in line 805
> between the frame's pts and ffmpeg's AV_NOPTS_VALUE.
>
> Here is a patch which fixes the bug by doing the cast the other way
> round (casting frame.pts to an unsigned int versus casting
> AV_NOPTS_VALUE to a signed int ).
>
> Hope it helps (it did for me ;) )
>
> Please tell me if patches are not welcome on this list (e.g. use trac
> for this?).
>
> regards,
> Robert
>
> <PATCH BEGIN>
> --- vlc-trunk-vanilla/modules/codec/ffmpeg/encoder.c    2007-01-10
> 20:50:15.000000000 +0100
> +++ vlc-trunk/modules/codec/ffmpeg/encoder.c    2007-01-10
> 21:01:37.000000000 +0100
> @@ -802,7 +802,7 @@
>           frame.pts = AV_NOPTS_VALUE;
>       }
> -    if ( frame.pts != (signed int) AV_NOPTS_VALUE && frame.pts != 0 )
> +    if ( (uint64_t)frame.pts != AV_NOPTS_VALUE && frame.pts != 0 )
>       {
>           if ( p_sys->i_last_pts == frame.pts )
>           {
> <PATCH END>

This cast looks unnecessary.  The value of AV_NOPTS_VALUE requires 64
bits, so unless frame.pts is already a 64-bit number, it can't
possibly hold that value.  Besides, a cast that doesn't change
anything is useless and shouldn't be there at all in the first place.

-- 
Måns Rullgård
mru at inprovide.com

-- 
This is the vlc-devel mailing-list, see http://www.videolan.org/vlc/
To unsubscribe, please read http://developers.videolan.org/lists.html



More information about the vlc-devel mailing list