avformat/dvdvideodec: drop packets with unset PTS or DTS

The packets effectively serve no purpose and we are already
dropping packets with PTS less than 0. This also creates
for a smoother seeking experience after the subdemuxer
reset fix.

Signed-off-by: Marth64 <marth64@proxyid.net>
This commit is contained in:
Marth64 2024-10-07 18:05:03 -05:00
parent 3656379d92
commit f2f238c3a4
1 changed files with 13 additions and 18 deletions

View File

@ -1643,10 +1643,9 @@ static int dvdvideo_read_packet(AVFormatContext *s, AVPacket *pkt)
}
}
if (!st_mapped)
if (!st_mapped || pkt->pts == AV_NOPTS_VALUE || pkt->dts == AV_NOPTS_VALUE)
goto discard;
if (pkt->pts != AV_NOPTS_VALUE && pkt->dts != AV_NOPTS_VALUE) {
if (!c->play_started) {
/* try to start at the beginning of a GOP */
if (st_subdemux->codecpar->codec_type != AVMEDIA_TYPE_VIDEO || !is_key)
@ -1661,10 +1660,6 @@ static int dvdvideo_read_packet(AVFormatContext *s, AVPacket *pkt)
if (pkt->pts < 0)
goto discard;
} else {
av_log(s, AV_LOG_WARNING, "Unset PTS or DTS @ st=%d pts=%" PRId64 " dts=%" PRId64 "\n",
pkt->stream_index, pkt->pts, pkt->dts);
}
av_log(s, AV_LOG_TRACE, "st=%d pts=%" PRId64 " dts=%" PRId64 " "
"pts_offset=%" PRId64 " first_pts=%" PRId64 "\n",