X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavfilter%2Faf_stereotools.c;h=8ab184df11c01715881461777375fecba667fe2a;hb=99f2a563889285b8be3e87fb5c5ba8c86a104785;hp=a22efb02eae7e010da49317591e86f01f081372f;hpb=4aa900acbdf6bb4191aa65aad8dabf1224bf42f6;p=ffmpeg diff --git a/libavfilter/af_stereotools.c b/libavfilter/af_stereotools.c index a22efb02eae..8ab184df11c 100644 --- a/libavfilter/af_stereotools.c +++ b/libavfilter/af_stereotools.c @@ -110,6 +110,10 @@ static int config_input(AVFilterLink *inlink) StereoToolsContext *s = ctx->priv; s->length = 2 * inlink->sample_rate * 0.05; + if (s->length <= 1 || s->length & 1) { + av_log(ctx, AV_LOG_ERROR, "sample rate is too small\n"); + return AVERROR(EINVAL); + } s->buffer = av_calloc(s->length, sizeof(*s->buffer)); if (!s->buffer) return AVERROR(ENOMEM); @@ -139,10 +143,10 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) const double sc_level = s->sc_level; const double delay = s->delay; const int length = s->length; - const int mute_l = floor(s->mute_l + 0.5); - const int mute_r = floor(s->mute_r + 0.5); - const int phase_l = floor(s->phase_l + 0.5); - const int phase_r = floor(s->phase_r + 0.5); + const int mute_l = s->mute_l; + const int mute_r = s->mute_r; + const int phase_l = s->phase_l; + const int phase_r = s->phase_r; double *buffer = s->buffer; AVFrame *out; double *dst;