diff mbox series

[FFmpeg-devel,06/15] fftools/ffmpeg_demux: only print demuxing stats if demuxing actually started

Message ID 20230523135842.20388-6-anton@khirnov.net
State Accepted
Commit 6ee57fd2b6769725afa66d2f742d928db48ff19f
Headers show
Series [FFmpeg-devel,01/15] fftools/ffmpeg_hw: move hw_device_setup_for_decode() to ffmpeg_dec | expand

Checks

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

Commit Message

Anton Khirnov May 23, 2023, 1:58 p.m. UTC
If the transcoding process never got to reading any packets from this
input then printing stats is just pointless noise.
---
 fftools/ffmpeg_demux.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/fftools/ffmpeg_demux.c b/fftools/ffmpeg_demux.c
index 7318abc6d9..ed8d5d165a 100644
--- a/fftools/ffmpeg_demux.c
+++ b/fftools/ffmpeg_demux.c
@@ -113,6 +113,8 @@  typedef struct Demuxer {
     int                   thread_queue_size;
     pthread_t             thread;
     int                   non_blocking;
+
+    int                   read_started;
 } Demuxer;
 
 typedef struct DemuxMsg {
@@ -734,6 +736,8 @@  static int thread_start(Demuxer *d)
         goto fail;
     }
 
+    d->read_started = 1;
+
     return 0;
 fail:
     av_thread_message_queue_free(&d->in_thread_queue);
@@ -833,7 +837,7 @@  void ifile_close(InputFile **pf)
 
     thread_stop(d);
 
-    if (f->ctx)
+    if (d->read_started)
         demux_final_stats(d);
 
     for (int i = 0; i < f->nb_streams; i++)