[FFmpeg-devel] [PATCH 4/5] ffplay: fix frame_delay calculation in new avfilter code

Marton Balint cus at passwd.hu
Thu Jun 7 00:02:34 CEST 2012


Signed-off-by: Marton Balint <cus at passwd.hu>
---
 ffplay.c |   13 ++++++-------
 1 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/ffplay.c b/ffplay.c
index d832488..f143ab6 100644
--- a/ffplay.c
+++ b/ffplay.c
@@ -1540,9 +1540,6 @@ static int get_video_frame(VideoState *is, AVFrame *frame, int64_t *pts, AVPacke
             SDL_UnlockMutex(is->pictq_mutex);
         }
 
-        if (ret)
-            is->frame_last_returned_time = av_gettime() / 1000000.0;
-
         return ret;
     }
     return 0;
@@ -1678,10 +1675,6 @@ static int video_thread(void *arg)
         if (!ret)
             continue;
 
-        is->frame_last_filter_delay = av_gettime() / 1000000.0 - is->frame_last_returned_time;
-        if (fabs(is->frame_last_filter_delay) > AV_NOSYNC_THRESHOLD / 10.0)
-            is->frame_last_filter_delay = 0;
-
 #if CONFIG_AVFILTER
         if (   last_w != is->video_st->codec->width
             || last_h != is->video_st->codec->height
@@ -1720,12 +1713,18 @@ static int video_thread(void *arg)
             av_buffersrc_write_frame(filt_in, frame);
 
         while (ret >= 0) {
+            is->frame_last_returned_time = av_gettime() / 1000000.0;
+
             ret = av_buffersink_get_buffer_ref(filt_out, &picref, 0);
             if (ret < 0) {
                 ret = 0;
                 break;
             }
 
+            is->frame_last_filter_delay = av_gettime() / 1000000.0 - is->frame_last_returned_time;
+            if (fabs(is->frame_last_filter_delay) > AV_NOSYNC_THRESHOLD / 10.0)
+                is->frame_last_filter_delay = 0;
+
             avfilter_fill_frame_from_video_buffer_ref(frame, picref);
 
             pts_int = picref->pts;
-- 
1.7.3.4



More information about the ffmpeg-devel mailing list