From ee5ba9678a17368428e0f69029786dfd767d9a63 Mon Sep 17 00:00:00 2001 From: wm4 Date: Fri, 19 Feb 2016 18:16:21 +0100 Subject: 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. --- video/decode/dec_video.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'video/decode/dec_video.c') 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); -- cgit v1.2.3