]> git.sesse.net Git - ffmpeg/blobdiff - ffmpeg.c
af_aresample: do not request a buffer with AV_PERM_REUSE2 permissions in filter_samples()
[ffmpeg] / ffmpeg.c
index 9901f0f324275fd19cd878e52e721fd9e82ecf7d..b887abd7f5ec979f68fba40ebbd8d3d243e2ec5a 100644 (file)
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -124,8 +124,6 @@ static const char *video_codec_name    = NULL;
 static const char *audio_codec_name    = NULL;
 static const char *subtitle_codec_name = NULL;
 
-static char *data_codec_name = NULL;
-
 static int file_overwrite = 0;
 static int do_benchmark = 0;
 static int do_hex_dump = 0;
@@ -1222,9 +1220,18 @@ static void do_video_out(AVFormatContext *s,
     AVFrame *final_picture;
     AVCodecContext *enc;
     double sync_ipts;
+    double duration = 0;
 
     enc = ost->st->codec;
 
+    if (ist->st->start_time != AV_NOPTS_VALUE && ist->st->first_dts != AV_NOPTS_VALUE) {
+        duration = FFMAX(av_q2d(ist->st->time_base), av_q2d(ist->st->codec->time_base));
+        if(ist->st->avg_frame_rate.num)
+            duration= FFMAX(duration, 1/av_q2d(ist->st->avg_frame_rate));
+
+        duration /= av_q2d(enc->time_base);
+    }
+
     sync_ipts = get_sync_ipts(ost) / av_q2d(enc->time_base);
 
     /* by default, we output a single frame */
@@ -1237,7 +1244,7 @@ static void do_video_out(AVFormatContext *s,
         format_video_sync = (s->oformat->flags & AVFMT_VARIABLE_FPS) ? 2 : 1;
 
     if (format_video_sync) {
-        double vdelta = sync_ipts - ost->sync_opts;
+        double vdelta = sync_ipts - ost->sync_opts + duration;
         //FIXME set to 0.5 after we fix some dts/pts bugs like in avidec.c
         if (vdelta < -1.1)
             nb_frames = 0;