diff mbox series

[FFmpeg-devel,v2] ffmpeg: delay first stats

Message ID 20201223112339.1652-1-ffmpeg@gyani.pro
State Accepted
Commit 9a0f5e412ad42a1c1a959d582e4fe2021b9ceda6
Headers show
Series [FFmpeg-devel,v2] ffmpeg: delay first stats
Related show

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

Gyan Doshi Dec. 23, 2020, 11:23 a.m. UTC
Wait for all output files to be initialized before printing first stats.

Avoids breaking output file dump report.
---
 fftools/ffmpeg.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Gyan Doshi Dec. 23, 2020, 4:22 p.m. UTC | #1
Plan to push tomorrow morning.

On 23-12-2020 04:53 pm, Gyan Doshi wrote:
> Wait for all output files to be initialized before printing first stats.
>
> Avoids breaking output file dump report.
> ---
>   fftools/ffmpeg.c | 5 ++++-
>   1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
> index 2c0820aacf..84a60f944a 100644
> --- a/fftools/ffmpeg.c
> +++ b/fftools/ffmpeg.c
> @@ -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();
Gyan Doshi Dec. 24, 2020, 4:36 a.m. UTC | #2
On 23-12-2020 09:52 pm, Gyan Doshi wrote:
> Plan to push tomorrow morning.

Pushed as 9a0f5e412ad42a1c1a959d582e4fe2021b9ceda6


>
> On 23-12-2020 04:53 pm, Gyan Doshi wrote:
>> Wait for all output files to be initialized before printing first stats.
>>
>> Avoids breaking output file dump report.
>> ---
>>   fftools/ffmpeg.c | 5 ++++-
>>   1 file changed, 4 insertions(+), 1 deletion(-)
>>
>> diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
>> index 2c0820aacf..84a60f944a 100644
>> --- a/fftools/ffmpeg.c
>> +++ b/fftools/ffmpeg.c
>> @@ -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();
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
diff mbox series

Patch

diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index 2c0820aacf..84a60f944a 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -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();