PR #21605 opened by ngaullier
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21605
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21605.patch
When a decoder buffer is flushed, parts of the private context is reset,
which may affect show_streams().
Example:
ffprobe -of flat fate-suite/ac3/mp3ac325-4864-small.ts \
-analyze_frames -show_entries stream=ltrt_cmixlev
Before: ltrt_cmixlev="0.000000"
After: ltrt_cmixlev="0.707107"
Currently, it seems that only ac3 downmix info is concerned.
(ac3 downmix options are exported since
376bb8481ada994ffe16d0a02f6c8767bac21016).
Fix regression since 045a8b15b19ec7f872fb01cfb986faeaa26cb8bb.
Signed-off-by: Nicolas Gaullier <[email protected]>
>From 0204f391722f8c82d49bb94220ef7c8429d2c6e5 Mon Sep 17 00:00:00 2001
From: Nicolas Gaullier <[email protected]>
Date: Tue, 27 Jan 2026 17:29:11 +0100
Subject: [PATCH] fftools/ffprobe: keep decoder buffers unflushed for
show_streams()
When a decoder buffer is flushed, parts of the private context is reset,
which may affect show_streams().
Example:
ffprobe -of flat fate-suite/ac3/mp3ac325-4864-small.ts \
-analyze_frames -show_entries stream=ltrt_cmixlev
Before: ltrt_cmixlev="0.000000"
After: ltrt_cmixlev="0.707107"
Currently, it seems that only ac3 downmix info is concerned.
(ac3 downmix options are exported since
376bb8481ada994ffe16d0a02f6c8767bac21016).
Fix regression since 045a8b15b19ec7f872fb01cfb986faeaa26cb8bb.
Signed-off-by: Nicolas Gaullier <[email protected]>
---
fftools/ffprobe.c | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)
diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c
index 67111bc31f..f256d781d0 100644
--- a/fftools/ffprobe.c
+++ b/fftools/ffprobe.c
@@ -1695,8 +1695,6 @@ static int read_interval_packets(AVTextFormatContext
*tfc, InputFile *ifile,
pkt->stream_index = i;
if (do_read_frames) {
while (process_frame(tfc, ifile, frame, pkt, &(int){1}) > 0);
- if (ifile->streams[i].dec_ctx)
- avcodec_flush_buffers(ifile->streams[i].dec_ctx);
}
}
@@ -1710,6 +1708,18 @@ end:
return ret;
}
+static void flush_buffers(InputFile *ifile)
+{
+ int i;
+
+ if (!do_read_frames)
+ return;
+ for (i = 0; i < ifile->nb_streams; i++) {
+ if (ifile->streams[i].dec_ctx)
+ avcodec_flush_buffers(ifile->streams[i].dec_ctx);
+ }
+}
+
static int read_packets(AVTextFormatContext *tfc, InputFile *ifile)
{
AVFormatContext *fmt_ctx = ifile->fmt_ctx;
@@ -1721,6 +1731,10 @@ static int read_packets(AVTextFormatContext *tfc,
InputFile *ifile)
ret = read_interval_packets(tfc, ifile, &interval, &cur_ts);
} else {
for (i = 0; i < read_intervals_nb; i++) {
+ /* flushing buffers can reset parts of the private context which
may be
+ * readen by show_streams(), so only flush between each
read_interval */
+ if (i)
+ flush_buffers(ifile);
ret = read_interval_packets(tfc, ifile, &read_intervals[i],
&cur_ts);
if (ret < 0)
break;
--
2.52.0
_______________________________________________
ffmpeg-devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]