aboutsummaryrefslogtreecommitdiffstats
path: root/fftools
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2023-10-01 13:04:33 +0200
committerAnton Khirnov <anton@khirnov.net>2023-10-03 16:57:02 +0200
commit303f10d4dd642b903091728447e2d26ef77614b9 (patch)
treeeff7e9b8b6b0222fec088cf37cb77f24d20fc55c /fftools
parentcdfd15f4d85c3e089ad258d8a24fb2c6907af10c (diff)
downloadffmpeg-303f10d4dd642b903091728447e2d26ef77614b9.tar.gz
fftools/ffmpeg_dec: disregard demuxer timestamps for NOTIMESTAMPS formats
In this case any timestamps are guessed by compute_pkt_fields() in libavformat. Since we are decoding the stream, we have more accurate information from the decoder and do not need any guesses. Eliminates spurious PTS gaps in a number of FATE tests. Also avoids dropping the majority of frames in fate-dirac*
Diffstat (limited to 'fftools')
-rw-r--r--fftools/ffmpeg_dec.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/fftools/ffmpeg_dec.c b/fftools/ffmpeg_dec.c
index 1de8234a97..fcee8b65ac 100644
--- a/fftools/ffmpeg_dec.c
+++ b/fftools/ffmpeg_dec.c
@@ -540,8 +540,9 @@ static int send_filter_eof(InputStream *ist)
return 0;
}
-static int packet_decode(InputStream *ist, const AVPacket *pkt, AVFrame *frame)
+static int packet_decode(InputStream *ist, AVPacket *pkt, AVFrame *frame)
{
+ const InputFile *ifile = input_files[ist->file_index];
Decoder *d = ist->decoder;
AVCodecContext *dec = ist->dec_ctx;
const char *type_desc = av_get_media_type_string(dec->codec_type);
@@ -556,6 +557,11 @@ static int packet_decode(InputStream *ist, const AVPacket *pkt, AVFrame *frame)
if (pkt && pkt->size == 0)
return 0;
+ if (pkt && ifile->format_nots) {
+ pkt->pts = AV_NOPTS_VALUE;
+ pkt->dts = AV_NOPTS_VALUE;
+ }
+
ret = avcodec_send_packet(dec, pkt);
if (ret < 0 && !(ret == AVERROR_EOF && !pkt)) {
// In particular, we don't expect AVERROR(EAGAIN), because we read all