Commit 02b76aa3 authored by Marton Balint's avatar Marton Balint

ffplay: simplify early frame drop code

Also never early frame drop the first frame after a flush.
Signed-off-by: 's avatarMarton Balint <cus@passwd.hu>
parent d04b7de7
...@@ -1722,12 +1722,11 @@ static int get_video_frame(VideoState *is, AVFrame *frame, AVPacket *pkt, int *s ...@@ -1722,12 +1722,11 @@ static int get_video_frame(VideoState *is, AVFrame *frame, AVPacket *pkt, int *s
if (framedrop>0 || (framedrop && get_master_sync_type(is) != AV_SYNC_VIDEO_MASTER)) { if (framedrop>0 || (framedrop && get_master_sync_type(is) != AV_SYNC_VIDEO_MASTER)) {
SDL_LockMutex(is->pictq_mutex); SDL_LockMutex(is->pictq_mutex);
if (is->frame_last_pts != AV_NOPTS_VALUE && frame->pts != AV_NOPTS_VALUE) { if (frame->pts != AV_NOPTS_VALUE) {
double clockdiff = get_clock(&is->vidclk) - get_master_clock(is); double diff = dpts - get_master_clock(is);
double ptsdiff = dpts - is->frame_last_pts; if (!isnan(diff) && fabs(diff) < AV_NOSYNC_THRESHOLD &&
if (!isnan(clockdiff) && fabs(clockdiff) < AV_NOSYNC_THRESHOLD && diff - is->frame_last_filter_delay < 0 &&
!isnan(ptsdiff) && ptsdiff > 0 && ptsdiff < AV_NOSYNC_THRESHOLD && *serial == is->vidclk.serial &&
clockdiff + ptsdiff - is->frame_last_filter_delay < 0 &&
is->videoq.nb_packets) { is->videoq.nb_packets) {
is->frame_last_dropped_pos = av_frame_get_pkt_pos(frame); is->frame_last_dropped_pos = av_frame_get_pkt_pos(frame);
is->frame_last_dropped_pts = dpts; is->frame_last_dropped_pts = dpts;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment