[FFmpeg-devel] [PATCH 1/2] Only add frame_delay to video_clock after the picture was actually queued

Marton Balint cus at passwd.hu
Fri Jul 22 20:59:35 CEST 2011


Video_refresh expects video_clock to contain the pts of the next frame which is
not yet in the queue.
---
 ffplay.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/ffplay.c b/ffplay.c
index 8e0ee4d..8286709 100644
--- a/ffplay.c
+++ b/ffplay.c
@@ -1317,7 +1317,6 @@ static int queue_picture(VideoState *is, AVFrame *src_frame, double pts1, int64_
     /* for MPEG2, the frame can be repeated, so we update the
        clock accordingly */
     frame_delay += src_frame->repeat_pict * (frame_delay * 0.5);
-    is->video_clock += frame_delay;
 
 #if defined(DEBUG_SYNC) && 0
     printf("frame_type=%c clock=%0.3f pts=%0.3f\n",
@@ -1423,6 +1422,7 @@ static int queue_picture(VideoState *is, AVFrame *src_frame, double pts1, int64_
         is->pictq_size++;
         SDL_UnlockMutex(is->pictq_mutex);
     }
+    is->video_clock += frame_delay;
     return 0;
 }
 
-- 
1.7.3.4



More information about the ffmpeg-devel mailing list