[FFmpeg-devel] [PATCH] flv 32 bit signed timestamps

Baptiste Coudurier baptiste.coudurier
Mon Jul 28 19:17:13 CEST 2008


Michael Niedermayer wrote:
> On Sun, Jul 27, 2008 at 10:19:17PM -0700, Baptiste Coudurier wrote:
>> Hi,
>>
>> Like figured out, flv uses 32 bit signed timestamps, meaning that
>> pts_wrap_bits must be set to 31.
> 
> What fails, why does it fail and how is it fixed by this change?

Don't remember ? Let me restate, FLV specs say timestamps are unsigned,
while flash player use _signed_ 32 bits, this means that max timestamp
value is INT_MAX, if you go > INT_MAX, flash player just interpret
timestamps as 0, which is broken.

> [...]
>> @@ -362,7 +366,7 @@
>>          put_byte(pb,1); // AAC raw
>>      else if (enc->codec_id == CODEC_ID_H264) {
>>          put_byte(pb,1); // AVC NALU
>> -        put_be24(pb,pkt->pts - (int32_t)pkt->dts);
>> +        put_be24(pb,pkt->pts - pkt->dts);
>>      }
> 
> Why was that int32_t cast there?
> 

To get the really painful first negative dts which gets wrapped during
truncate_ts.

-- 
Baptiste COUDURIER                              GnuPG Key Id: 0x5C1ABAAA
Smartjog USA Inc.                                http://www.smartjog.com
Key fingerprint                 8D77134D20CC9220201FC5DB0AC9325C5C1ABAAA




More information about the ffmpeg-devel mailing list