From 771583c285fd2d7da2d739fdcdfe5cb15624f6b8 Mon Sep 17 00:00:00 2001 From: wm4 Date: Fri, 19 Sep 2014 23:57:48 +0200 Subject: video: actually count decoder-dropped frames Normally, feeding a packet to the decoder should always return a frame _if_ we received a frame before. So while we can't know exactly whether a frame was dropped, at least the normal case is easily detectable. This means we display something closer to the actual framedrop count, instead of a bad guess. --- player/video.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/player/video.c b/player/video.c index 3332aca737..61cbb09713 100644 --- a/player/video.c +++ b/player/video.c @@ -344,11 +344,7 @@ static int check_framedrop(struct MPContext *mpctx) // we should avoid dropping too many frames in sequence unless we // are too late. and we allow 100ms A-V delay here: if (mpctx->last_av_difference - 0.100 > mpctx->dropped_frames * frame_time) - { - mpctx->drop_frame_cnt++; - mpctx->dropped_frames++; return !!(opts->frame_dropping & 2); - } } return 0; } @@ -384,6 +380,13 @@ static int decode_image(struct MPContext *mpctx) bool had_packet = !!pkt; talloc_free(pkt); + if (had_packet && !d_video->waiting_decoded_mpi && + mpctx->video_status == STATUS_PLAYING) + { + mpctx->drop_frame_cnt++; + mpctx->dropped_frames++; + } + return had_packet ? VD_PROGRESS : VD_EOF; } -- cgit v1.2.3