summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2016-01-29 22:43:18 +0100
committerwm4 <wm4@nowhere>2016-01-29 22:43:18 +0100
commitd980fd0856c3773d488f4649d77d44cd8c1baf0e (patch)
treee4f6f8d952d1d081d2c14dde145db1dc3ce117d4
parent354c1fc06d5c2381dc59a39f02aa61a3c252b283 (diff)
downloadmpv-d980fd0856c3773d488f4649d77d44cd8c1baf0e.tar.bz2
mpv-d980fd0856c3773d488f4649d77d44cd8c1baf0e.tar.xz
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.
-rw-r--r--video/decode/dec_video.c17
1 files 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.