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

Michael Niedermayer michaelni
Wed Jun 16 08:31:40 CEST 2010


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

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Awnsering whenever a program halts or runs forever is
On a turing machine, in general impossible (turings halting problem).
On any real computer, always possible as a real computer has a finite number
of states N, and will either halt in less than N cycles or never halt.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100616/d182d0d8/attachment.pgp>



More information about the ffmpeg-devel mailing list