diff mbox series

[FFmpeg-devel,26/49] fftools/ffmpeg_mux: stop using AVStream.nb_frames in do_video_stats()

Message ID 20220404113037.13070-27-anton@khirnov.net
State New
Headers show
Series [FFmpeg-devel,01/49] fftools/ffmpeg: drop an obsolete hack | expand

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Anton Khirnov April 4, 2022, 11:30 a.m. UTC
Its use for muxing is not documented, in practice it is incremented per
each packet successfully passed to the muxer's write_packet(). Since
there is a lot of indirection between ffmpeg submitting a packet to the
muxer and it actually being written (e.g. the interleaving queue), using
nb_frames to count packets sent to the muxer is incorrect. Use
OutputStream.packets_written instead.
---
 fftools/ffmpeg_mux.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/fftools/ffmpeg_mux.c b/fftools/ffmpeg_mux.c
index 059beabaf3..49703ed727 100644
--- a/fftools/ffmpeg_mux.c
+++ b/fftools/ffmpeg_mux.c
@@ -72,7 +72,7 @@  static void do_video_stats(OutputStream *ost, int frame_size)
     }
 
     enc = ost->enc_ctx;
-    frame_number = ost->st->nb_frames;
+    frame_number = ost->packets_written - 1;
     if (vstats_version <= 1) {
         fprintf(vstats_file, "frame= %5d q= %2.1f ", frame_number,
                 ost->quality / (float)FF_QP2LAMBDA);