Browse code

ffplay: simplify early frame drop code

Also never early frame drop the first frame after a flush.

Signed-off-by: Marton Balint <cus@passwd.hu>

Marton Balint authored on 2013/05/26 04:51:35
Showing 1 changed files
... ...
@@ -1722,12 +1722,11 @@ static int get_video_frame(VideoState *is, AVFrame *frame, AVPacket *pkt, int *s
1722 1722
 
1723 1723
         if (framedrop>0 || (framedrop && get_master_sync_type(is) != AV_SYNC_VIDEO_MASTER)) {
1724 1724
             SDL_LockMutex(is->pictq_mutex);
1725
-            if (is->frame_last_pts != AV_NOPTS_VALUE && frame->pts != AV_NOPTS_VALUE) {
1726
-                double clockdiff = get_clock(&is->vidclk) - get_master_clock(is);
1727
-                double ptsdiff = dpts - is->frame_last_pts;
1728
-                if (!isnan(clockdiff) && fabs(clockdiff) < AV_NOSYNC_THRESHOLD &&
1729
-                    !isnan(ptsdiff) && ptsdiff > 0 && ptsdiff < AV_NOSYNC_THRESHOLD &&
1730
-                    clockdiff + ptsdiff - is->frame_last_filter_delay < 0 &&
1725
+            if (frame->pts != AV_NOPTS_VALUE) {
1726
+                double diff = dpts - get_master_clock(is);
1727
+                if (!isnan(diff) && fabs(diff) < AV_NOSYNC_THRESHOLD &&
1728
+                    diff - is->frame_last_filter_delay < 0 &&
1729
+                    *serial == is->vidclk.serial &&
1731 1730
                     is->videoq.nb_packets) {
1732 1731
                     is->frame_last_dropped_pos = av_frame_get_pkt_pos(frame);
1733 1732
                     is->frame_last_dropped_pts = dpts;