In attach a sample file, who make a crash. (on mac os x with latest git version, and on windows with older version).
i just make the test now, and s->nb_channels can be 0. (this is the case with the file in attach). For the coding style. Do you prefer something like that : ? if (s->nb_channels == 0) || (nb_samples !=0) return; Best regards Martin 2015-03-08 0:07 GMT+01:00 Nicolas George <geo...@nsup.org>: > Le septidi 17 ventôse, an CCXXIII, Martin Vignali a écrit : > > Exemple to create the crash : > > ffmpeg -i fileWithoutSound -filter astats -f null - > > I experience no crash. As far as I can see, the divisions happen with > floats, which is valid. > > > From 621b18a278c3d314da773b8eec9f9e12707a20bb Mon Sep 17 00:00:00 2001 > > From: Martin Vignali <martin.vign...@gmail.com> > > Date: Sat, 7 Mar 2015 23:09:40 +0100 > > Subject: [PATCH] Fix crash in astats filter, whith no audio input > > > > Avoid Zero division in print part. > > --- > > libavfilter/af_astats.c | 24 +++++++++++++----------- > > 1 file changed, 13 insertions(+), 11 deletions(-) > > > > diff --git a/libavfilter/af_astats.c b/libavfilter/af_astats.c > > index 60ccd73..8e90f6b 100644 > > --- a/libavfilter/af_astats.c > > +++ b/libavfilter/af_astats.c > > @@ -222,18 +222,20 @@ static void print_stats(AVFilterContext *ctx) > > av_log(ctx, AV_LOG_INFO, "Peak count: %"PRId64"\n", > p->min_count + p->max_count); > > } > > > > - av_log(ctx, AV_LOG_INFO, "Overall\n"); > > - av_log(ctx, AV_LOG_INFO, "DC offset: %f\n", max_sigma_x / > (nb_samples / s->nb_channels)); > > - av_log(ctx, AV_LOG_INFO, "Min level: %f\n", min); > > - av_log(ctx, AV_LOG_INFO, "Max level: %f\n", max); > > - av_log(ctx, AV_LOG_INFO, "Peak level dB: %f\n", > LINEAR_TO_DB(FFMAX(-min, max))); > > - av_log(ctx, AV_LOG_INFO, "RMS level dB: %f\n", > LINEAR_TO_DB(sqrt(sigma_x2 / nb_samples))); > > - av_log(ctx, AV_LOG_INFO, "RMS peak dB: %f\n", > LINEAR_TO_DB(sqrt(max_sigma_x2))); > > Please do the reindent in a separate patch. > > > - if (min_sigma_x2 != 1) > > > + if ((s->nb_channels != 0)&&(nb_samples !=0)){/* Avoid crash when > input don't have sound */ > > s->nb_channels can not be 0. > > And cosmetic nit: the standard coding style in FFmpeg is: no "!= 0", no > extra parentheses on tests, spaces around operators, including &&, and > between clause and braces. > > > + av_log(ctx, AV_LOG_INFO, "Overall\n"); > > + av_log(ctx, AV_LOG_INFO, "DC offset: %f\n", max_sigma_x / > (nb_samples / s->nb_channels)); > > + av_log(ctx, AV_LOG_INFO, "Min level: %f\n", min); > > + av_log(ctx, AV_LOG_INFO, "Max level: %f\n", max); > > + av_log(ctx, AV_LOG_INFO, "Peak level dB: %f\n", > LINEAR_TO_DB(FFMAX(-min, max))); > > + av_log(ctx, AV_LOG_INFO, "RMS level dB: %f\n", > LINEAR_TO_DB(sqrt(sigma_x2 / nb_samples))); > > + av_log(ctx, AV_LOG_INFO, "RMS peak dB: %f\n", > LINEAR_TO_DB(sqrt(max_sigma_x2))); > > + if (min_sigma_x2 != 1) > > av_log(ctx, AV_LOG_INFO, "RMS trough dB: %f\n", > LINEAR_TO_DB(sqrt(min_sigma_x2))); > > - av_log(ctx, AV_LOG_INFO, "Flat factor: %f\n", > LINEAR_TO_DB((min_runs + max_runs) / (min_count + max_count))); > > - av_log(ctx, AV_LOG_INFO, "Peak count: %f\n", (min_count + > max_count) / (double)s->nb_channels); > > - av_log(ctx, AV_LOG_INFO, "Number of samples: %"PRId64"\n", > nb_samples / s->nb_channels); > > + av_log(ctx, AV_LOG_INFO, "Flat factor: %f\n", > LINEAR_TO_DB((min_runs + max_runs) / (min_count + max_count))); > > + av_log(ctx, AV_LOG_INFO, "Peak count: %f\n", (min_count + > max_count) / (double)s->nb_channels); > > + av_log(ctx, AV_LOG_INFO, "Number of samples: %"PRId64"\n", > nb_samples / s->nb_channels); > > + } > > } > > > > static av_cold void uninit(AVFilterContext *ctx) > > Regards, > > -- > Nicolas George > > _______________________________________________ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel > >
movSsSon.mov
Description: QuickTime movie
_______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel