summaryrefslogtreecommitdiffstats
path: root/video
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2016-02-19 18:16:21 +0100
committerwm4 <wm4@nowhere>2016-02-19 18:16:21 +0100
commitee5ba9678a17368428e0f69029786dfd767d9a63 (patch)
tree41725c8127da6367acf6b52046c799752059b96b /video
parente832e46bd6d7e2c06d88e2129d1cd3dfd1be21e1 (diff)
downloadmpv-ee5ba9678a17368428e0f69029786dfd767d9a63.tar.bz2
mpv-ee5ba9678a17368428e0f69029786dfd767d9a63.tar.xz
video: move unreliable-packet-PTS check
This tries to determine whether packet PTS values are accurate and can be used for frame dropping during seeking. Move both checks (PTS is missing; PTs is non-monotonic) to the earliest place where they can be done.
Diffstat (limited to 'video')
-rw-r--r--video/decode/dec_video.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/video/decode/dec_video.c b/video/decode/dec_video.c
index 0a33adfc28..ecba84f6a7 100644
--- a/video/decode/dec_video.c
+++ b/video/decode/dec_video.c
@@ -263,6 +263,9 @@ static struct mp_image *decode_packet(struct dec_video *d_video,
double pkt_pts = packet ? packet->pts : MP_NOPTS_VALUE;
double pkt_dts = packet ? packet->dts : MP_NOPTS_VALUE;
+ if (pkt_pts == MP_NOPTS_VALUE)
+ d_video->has_broken_packet_pts = 1;
+
double pkt_pdts = pkt_pts == MP_NOPTS_VALUE ? pkt_dts : pkt_pts;
if (pkt_pdts != MP_NOPTS_VALUE && d_video->first_packet_pdts == MP_NOPTS_VALUE)
d_video->first_packet_pdts = pkt_pdts;
@@ -302,6 +305,11 @@ static struct mp_image *decode_packet(struct dec_video *d_video,
d_video->codec_dts = mpi->dts;
}
+ if (d_video->has_broken_packet_pts < 0)
+ d_video->has_broken_packet_pts++;
+ if (d_video->num_codec_pts_problems)
+ d_video->has_broken_packet_pts = 1;
+
// If PTS is unset, or non-monotonic, fall back to DTS.
if ((d_video->num_codec_pts_problems > d_video->num_codec_dts_problems ||
pts == MP_NOPTS_VALUE) && dts != MP_NOPTS_VALUE)
@@ -321,11 +329,6 @@ static struct mp_image *decode_packet(struct dec_video *d_video,
}
}
- if (d_video->has_broken_packet_pts < 0)
- d_video->has_broken_packet_pts++;
- if (d_video->num_codec_pts_problems || pkt_pts == MP_NOPTS_VALUE)
- d_video->has_broken_packet_pts = 1;
-
if (!mp_image_params_equal(&d_video->last_format, &mpi->params))
fix_image_params(d_video, &mpi->params);