]> git.sesse.net Git - ffmpeg/commitdiff
ffmpeg: delay first stats
authorGyan Doshi <ffmpeg@gyani.pro>
Wed, 23 Dec 2020 04:53:30 +0000 (10:23 +0530)
committerGyan Doshi <ffmpeg@gyani.pro>
Thu, 24 Dec 2020 04:34:38 +0000 (10:04 +0530)
Wait for all output files to be initialized before printing first stats.

Avoids breaking output file dump report.

fftools/ffmpeg.c

index 2c0820aacf5633075c463c7b1c245f0db2d9f165..84a60f944a3f98b28ce65a4c49acdab93d726441 100644 (file)
@@ -136,6 +136,7 @@ static int nb_frames_dup = 0;
 static unsigned dup_warning = 1000;
 static int nb_frames_drop = 0;
 static int64_t decode_error_stat[2];
+static unsigned nb_output_dumped = 0;
 
 static int want_sdp = 1;
 
@@ -1699,7 +1700,8 @@ static void print_report(int is_last_report, int64_t timer_start, int64_t cur_ti
         if (last_time == -1) {
             last_time = cur_time;
         }
-        if ((cur_time - last_time) < stats_period && !first_report)
+        if (((cur_time - last_time) < stats_period && !first_report) ||
+            (first_report && nb_output_dumped < nb_output_files))
             return;
         last_time = cur_time;
     }
@@ -3017,6 +3019,7 @@ static int check_init_output_file(OutputFile *of, int file_index)
     of->header_written = 1;
 
     av_dump_format(of->ctx, file_index, of->ctx->url, 1);
+    nb_output_dumped++;
 
     if (sdp_filename || want_sdp)
         print_sdp();