Browse code

Make sure -vsync 2 does not produce timestamps equal to the previous, rather drop a frame. Fixes Issue872.

Originally committed as revision 17643 to svn://svn.ffmpeg.org/ffmpeg/trunk

Michael Niedermayer authored on 2009/02/27 23:53:29
Showing 1 changed files
... ...
@@ -865,9 +865,12 @@ static void do_video_out(AVFormatContext *s,
865 865
         //FIXME set to 0.5 after we fix some dts/pts bugs like in avidec.c
866 866
         if (vdelta < -1.1)
867 867
             nb_frames = 0;
868
-        else if (video_sync_method == 2 || (video_sync_method<0 && (s->oformat->flags & AVFMT_VARIABLE_FPS)))
868
+        else if (video_sync_method == 2 || (video_sync_method<0 && (s->oformat->flags & AVFMT_VARIABLE_FPS))){
869
+            if(vdelta<=-0.6){
870
+                nb_frames=0;
871
+            }else if(vdelta>0.6)
869 872
             ost->sync_opts= lrintf(get_sync_ipts(ost) / av_q2d(enc->time_base));
870
-        else if (vdelta > 1.1)
873
+        }else if (vdelta > 1.1)
871 874
             nb_frames = lrintf(vdelta);
872 875
 //fprintf(stderr, "vdelta:%f, ost->sync_opts:%"PRId64", ost->sync_ipts:%f nb_frames:%d\n", vdelta, ost->sync_opts, get_sync_ipts(ost), nb_frames);
873 876
         if (nb_frames == 0){