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

Damien Fouilleul Damien.Fouilleul at laposte.net
Fri Jan 12 00:19:12 CET 2007


Christophe Massiot wrote:
> On Thu, Jan 11, 2007, Christophe Mutricy wrote:
>
>   
>>> So, is there anything else necessary from my side to get this somehow  
>>> in SVN? Should I post it on trac?
>>>       
>> Not really. Exept bugging us from time to to time if it doesn't get into
>> the svn.
>>
>> Or if you are very motivated you could review the code and find out if
>> there is any reasons why frame.pts is a "signed int" so we can make it
>> unsigned.
>>     
>
> frame.pts comes from libavcodec, and indeed I think the problem lies in
> libavcodec, however we have no entitlement there. The cast to "signed
> int" was a bad fix, a correct fix would be to cast AV_NOPTS_VALUE to
> int64_t. Maybe someone with more compiler knowledge than me would know
> why :
>
> #define AV_NOPTS_VALUE          INT64_C(0x8000000000000000)
>
> is considered unsigned and needs to be casted to int64_t.
>
>   
This may be a bug with gcc warning which may consider a hexadecimal 
constant as a bit pattern rather than a typed integer value. A bit 
pattern has inherently no sign until you assign it to a typed value. 
Therefore as far gcc is concerned the LL suffix is not used to specify a 
signed long long type, but a 64 bit pattern, which is unfortunately is 
typed into an unsigned long long by default.

however converting AV_NOPTS_VALUE to a signed int is a bad mistake, as 
the value will become 0 and not INT_MIN (the upper 32 bits will be 
discarded). Therefore I suggest that the (signed int)AV_NOPTS_VALUE be 
replaced with I64C(AV_NOPTS_VALUE) in ffmpeg/encoder.c

Damien



-- 
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