changeset 9073:d1238ea3db6f libavcodec

Adjust time_base exactly when changing ticks_per_frame to 2 this is safer and for some raw h264 we managed to change the timebase twice before.
author michael
date Sat, 28 Feb 2009 20:58:07 +0000
parents d56b711c6c5d
children 0e2f21d65473
files h264.c
diffstat 1 files changed, 5 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/h264.c	Sat Feb 28 13:48:54 2009 +0000
+++ b/h264.c	Sat Feb 28 20:58:07 2009 +0000
@@ -2210,8 +2210,12 @@
     h->outputed_poc = INT_MIN;
     h->prev_poc_msb= 1<<16;
     reset_sei(h);
-    if(avctx->codec_id == CODEC_ID_H264)
+    if(avctx->codec_id == CODEC_ID_H264){
+        if(avctx->ticks_per_frame == 1){
+            s->avctx->time_base.den *=2;
+        }
         avctx->ticks_per_frame = 2;
+    }
     return 0;
 }
 
@@ -3776,9 +3780,6 @@
                 s->avctx->time_base.den *= 2;
             av_reduce(&s->avctx->time_base.num, &s->avctx->time_base.den,
                       s->avctx->time_base.num, s->avctx->time_base.den, 1<<30);
-        }else if(!h->sps.time_scale && !s->avctx->frame_number){
-            s->avctx->time_base.den *=2;
-            h->sps.time_scale= s->avctx->time_base.den;
         }
     }