Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
* [FFmpeg-devel] [PR] fftools/ffprobe: keep decoder buffers unflushed for show_streams() (PR #21605)
@ 2026-01-29 15:28 ngaullier via ffmpeg-devel
  0 siblings, 0 replies; only message in thread
From: ngaullier via ffmpeg-devel @ 2026-01-29 15:28 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: ngaullier

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 <nicolas.gaullier@cji.paris>


>From 0204f391722f8c82d49bb94220ef7c8429d2c6e5 Mon Sep 17 00:00:00 2001
From: Nicolas Gaullier <nicolas.gaullier@cji.paris>
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 <nicolas.gaullier@cji.paris>
---
 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 -- ffmpeg-devel@ffmpeg.org
To unsubscribe send an email to ffmpeg-devel-leave@ffmpeg.org

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-01-29 15:29 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-01-29 15:28 [FFmpeg-devel] [PR] fftools/ffprobe: keep decoder buffers unflushed for show_streams() (PR #21605) ngaullier via ffmpeg-devel

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git