PR #24123 opened by adorn URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/24123 Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/24123.patch
Over HTTP, seeking to a trailing chunk can make avio_size() stale, so the PCM duration guard fails and duration is N/A. Cache size before seeking. Fixes #24122 >From 1e46f021bd389b83b6081fd95d92f1f170292d8a Mon Sep 17 00:00:00 2001 From: Andreas Menze <[email protected]> Date: Thu, 13 Aug 2026 09:11:27 +0200 Subject: [PATCH] avformat/wavdec: cache avio_size() before footer seeks Over HTTP, seeking to a trailing chunk can make avio_size() stale, so the PCM duration guard fails and duration is N/A. Cache size before seeking. Fixes #24122 --- libavformat/wavdec.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libavformat/wavdec.c b/libavformat/wavdec.c index 8501d94deb..8d19e52ead 100644 --- a/libavformat/wavdec.c +++ b/libavformat/wavdec.c @@ -370,11 +370,13 @@ static int wav_read_header(AVFormatContext *s) WAVDemuxContext *wav = s->priv_data; int ret, got_fmt = 0, got_xma2 = 0; int64_t next_tag_ofs, data_ofs = -1; + int64_t filesize; wav->unaligned = avio_tell(s->pb) & 1; wav->smv_data_ofs = -1; + filesize = avio_size(pb); /* read chunk ID */ tag = avio_rl32(pb); switch (tag) { @@ -661,7 +663,7 @@ break_loop: if ( st->codecpar->ch_layout.nb_channels && data_size && av_get_bits_per_sample(st->codecpar->codec_id) - && wav->data_end <= avio_size(pb)) + && wav->data_end <= filesize) sample_count = (data_size << 3) / (st->codecpar->ch_layout.nb_channels * (uint64_t)av_get_bits_per_sample(st->codecpar->codec_id)); -- 2.52.0 _______________________________________________ ffmpeg-devel mailing list -- [email protected] To unsubscribe send an email to [email protected]
