[FFmpeg-cvslog] avfilter/avf_showvolume: make use of av_rescale

Paul B Mahol git at videolan.org
Tue May 28 12:16:58 EEST 2019


ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Tue May 28 10:49:09 2019 +0200| [d2e76a1f96d74ea9315ad09bfe018d5fe64ec68c] | committer: Paul B Mahol

avfilter/avf_showvolume: make use of av_rescale

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d2e76a1f96d74ea9315ad09bfe018d5fe64ec68c
---

 libavfilter/avf_showvolume.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavfilter/avf_showvolume.c b/libavfilter/avf_showvolume.c
index 7a8e583556..548d73c14f 100644
--- a/libavfilter/avf_showvolume.c
+++ b/libavfilter/avf_showvolume.c
@@ -165,7 +165,7 @@ static int config_input(AVFilterLink *inlink)
     AVFilterContext *ctx = inlink->dst;
     ShowVolumeContext *s = ctx->priv;
 
-    s->nb_samples = FFMAX(1024, ((double)inlink->sample_rate / av_q2d(s->frame_rate)) + 0.5);
+    s->nb_samples = FFMAX(1, av_rescale(inlink->sample_rate, s->frame_rate.den, s->frame_rate.num));
     s->values = av_calloc(inlink->channels * VAR_VARS_NB, sizeof(double));
     if (!s->values)
         return AVERROR(ENOMEM);



More information about the ffmpeg-cvslog mailing list