PR #23533 opened by James Almer (jamrial) URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/23533 Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/23533.patch
Both the seek index and the stream duration are constantly being updated as trun boxes are read. Fixes mpv issue 18149. >From 62731e05ab6f8b1aaefc33f3400952e88ada04fe Mon Sep 17 00:00:00 2001 From: James Almer <[email protected]> Date: Thu, 18 Jun 2026 13:46:52 -0300 Subject: [PATCH] avformat/mov: don't assume a sample to be the last in fragmented input Both the seek index and the stream duration are constantly being updated as trun boxes are read. Fixes mpv issue 18149. Signed-off-by: James Almer <[email protected]> --- libavformat/mov.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libavformat/mov.c b/libavformat/mov.c index 7513b3ccc1..0915b35a7f 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -11626,6 +11626,7 @@ static int get_eia608_packet(AVIOContext *pb, AVPacket *pkt, int src_size) static int mov_finalize_packet(AVFormatContext *s, AVStream *st, AVIndexEntry *sample, int64_t current_index, AVPacket *pkt) { + MOVContext *mov = s->priv_data; MOVStreamContext *sc = st->priv_data; pkt->stream_index = sc->ffindex; @@ -11647,7 +11648,7 @@ static int mov_finalize_packet(AVFormatContext *s, AVStream *st, AVIndexEntry *s pkt->pts = pkt->dts; } - if (st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO && + if (st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO && !mov->fragment.found_tfhd && sc->current_sample >= ffstream(st)->nb_index_entries) { int64_t pts = av_rescale_q(pkt->pts, st->time_base, (AVRational){ 1, st->codecpar->sample_rate }); int64_t total = av_rescale_q(st->duration, st->time_base, (AVRational){ 1, st->codecpar->sample_rate }); -- 2.52.0 _______________________________________________ ffmpeg-devel mailing list -- [email protected] To unsubscribe send an email to [email protected]
