[FFmpeg-devel] [PATCH] Fix failure in av_read_frame on timestamp rollover

Stephen Dredge i sdredge
Tue Jun 22 02:36:37 CEST 2010


On 06/21/2010 06:50 PM, Michael Niedermayer wrote:
> On Mon, Jun 21, 2010 at 06:01:59PM +1000, Stephen Dredge i wrote:
>    
>> On 06/18/2010 08:13 PM, Michael Niedermayer wrote:
>>      
>>> On Fri, Jun 18, 2010 at 06:29:03PM +1000, Stephen Dredge i wrote:
>>>
>>>        
>>>> On 06/16/2010 04:31 PM, Michael Niedermayer wrote:
>>>>
>>>>          
>>>>> On Tue, Jun 15, 2010 at 04:43:14PM +1000, Stephen Dredge i wrote:
>>>>>
>>>>>
>>>>>            
>>>>>> On 06/12/2010 12:03 AM, Michael Niedermayer wrote:
>>>>>>
>>>>>>
>>>>>>              
>>>>>>> On Fri, Jun 11, 2010 at 06:59:01PM +1000, Stephen Dredge i wrote:
>>>>>>>
>>>>>>>
>>>>>>>                
>>>>> [...]
>>>>>
>>>>>
>>>>>            
>>>>>> diff --git a/libavutil/mathematics.c b/libavutil/mathematics.c
>>>>>> index 00b81f1..2a85943 100644
>>>>>> --- a/libavutil/mathematics.c
>>>>>> +++ b/libavutil/mathematics.c
>>>>>> @@ -144,8 +144,13 @@ int av_compare_ts(int64_t ts_a, AVRational tb_a,
>>>>>> int64_t ts_b, AVRational tb_b){
>>>>>>         return 0;
>>>>>>     }
>>>>>>
>>>>>> -int64_t av_compare_mod(uint64_t a, uint64_t b, uint64_t mod){
>>>>>> -    int64_t c= (a-b)&    (mod-1);
>>>>>> +int64_t av_compare_mod(uint64_t a, uint64_t b, int mod_bits){
>>>>>> +    int64_t c;
>>>>>> +    int64_t mod;
>>>>>> +    if(!mod_bits || mod_bits>= 63)
>>>>>> +        return a-b;
>>>>>> +    mod= 1LL<<mod_bits;
>>>>>> +    c= (a-b)&    (mod-1);
>>>>>>         if(c>    (mod>>1))
>>>>>>             c-= mod;
>>>>>>         return c;
>>>>>>
>>>>>>
>>>>>>              
>>>>> looks unneeded
>>>>>
>>>>>            
>>>> The !mod_bits test?, two demuxers use av_read_frame so I wasn't sure,
>>>> Also
>>>> I was thinking of future uses.
>>>>
>>>>          
>>> iam talking about the whole hunk
>>>
>>> [...]
>>>
>>>        
>> just this then?
>>
>>      
>>>
>>>
>>> _______________________________________________
>>> ffmpeg-devel mailing list
>>> ffmpeg-devel at mplayerhq.hu
>>> https://lists.mplayerhq.hu/mailman/listinfo/ffmpeg-devel
>>>        
>>
>> -- 
>>    Stephen Dredge                        sdredge at tpg.com.au
>> _______________________________________________________________
>>   System Administrator
>>   +61 2 9850 0979
>>
>>    TPG Internet
>>   www.tpg.com.au
>>
>>
>>
>>      
>    
>>   utils.c |    6 +++---
>>   1 file changed, 3 insertions(+), 3 deletions(-)
>> 5202c2b6e2f57c519c2f7563426eb36ea6bd521c  rollover_fix5.patch
>> diff --git a/libavformat/utils.c b/libavformat/utils.c
>> index 59ca6bb..3e5ffab 100644
>> --- a/libavformat/utils.c
>> +++ b/libavformat/utils.c
>> @@ -1187,13 +1187,13 @@ int av_read_frame(AVFormatContext *s, AVPacket *pkt)
>>           pktl = s->packet_buffer;
>>           if (pktl) {
>>               AVPacket *next_pkt=&pktl->pkt;
>> +            int wrap_bits = s->streams[next_pkt->stream_index]->pts_wrap_bits;
>>
>>               if(genpts&&  next_pkt->dts != AV_NOPTS_VALUE){
>>                   while(pktl&&  next_pkt->pts == AV_NOPTS_VALUE){
>>      
> the wrap_bits can be moved into the if() no need to calculate them when
> genpts is not set
>
> [...]
>    
Ok
>
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at mplayerhq.hu
> https://lists.mplayerhq.hu/mailman/listinfo/ffmpeg-devel


-- 
   Stephen Dredge                        sdredge at tpg.com.au
_______________________________________________________________
  System Administrator
  +61 2 9850 0979

   TPG Internet
  www.tpg.com.au



-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: rollover_fix6.patch
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100622/d46a6f56/attachment.asc>



More information about the ffmpeg-devel mailing list