From d980fd0856c3773d488f4649d77d44cd8c1baf0e Mon Sep 17 00:00:00 2001 From: wm4 Date: Fri, 29 Jan 2016 22:43:18 +0100 Subject: video: fix broken-PTS fallback determination This codes tries to deal with broken PTS timestamps, but since commit 271cabe6 it didn't always overwrite the previous timestamp as it should have. This mattered only if there were broken timestamps in the video stream. Also remove the pointless prev_codec_pts variables, since the decoder doesn't overwrite these fields anymore. --- video/decode/dec_video.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/video/decode/dec_video.c b/video/decode/dec_video.c index 1d2806f17a..2bda6d1533 100644 --- a/video/decode/dec_video.c +++ b/video/decode/dec_video.c @@ -285,9 +285,6 @@ static struct mp_image *decode_packet(struct dec_video *d_video, if (avi_pts) add_avi_pts(d_video, pkt_pdts); - double prev_codec_pts = d_video->codec_pts; - double prev_codec_dts = d_video->codec_dts; - if (d_video->header->codec->avi_dts) drop_frame = 0; @@ -313,18 +310,16 @@ static struct mp_image *decode_packet(struct dec_video *d_video, double pts = mpi->pts; double dts = mpi->dts; - if (pts == MP_NOPTS_VALUE) { - d_video->codec_pts = prev_codec_pts; - } else if (pts < prev_codec_pts) { + if (pts != MP_NOPTS_VALUE) { + if (pts < d_video->codec_pts) + d_video->num_codec_pts_problems++; d_video->codec_pts = mpi->pts; - d_video->num_codec_pts_problems++; } - if (dts == MP_NOPTS_VALUE) { - d_video->codec_dts = prev_codec_dts; - } else if (dts <= prev_codec_dts) { + if (dts != MP_NOPTS_VALUE) { + if (dts <= d_video->codec_dts) + d_video->num_codec_dts_problems++; d_video->codec_dts = mpi->dts; - d_video->num_codec_dts_problems++; } // If PTS is unset, or non-monotonic, fall back to DTS. -- cgit v1.2.3