mirror of
https://github.com/mpv-player/mpv.git
synced 2025-12-28 05:33:14 +00:00
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.
This commit is contained in:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user