From 2dc46423d6c794b0b840f939afdc3e3cd5125480 Mon Sep 17 00:00:00 2001 From: wm4 Date: Thu, 4 Jun 2015 19:08:40 +0200 Subject: af_lavrresample: change output samples calculation This is better, because now we call swr_get_delay() with the output samplerate, instead of with the input samplerate and then multiplying it with the ratio and rounding it up. --- audio/filter/af_lavrresample.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/audio/filter/af_lavrresample.c b/audio/filter/af_lavrresample.c index 64c3d06acd..f5c0e33fe9 100644 --- a/audio/filter/af_lavrresample.c +++ b/audio/filter/af_lavrresample.c @@ -114,8 +114,8 @@ static void drop_all_output(struct af_resample *s) } static int get_out_samples(struct af_resample *s, int in_samples) { - return av_rescale_rnd(get_delay(s) + in_samples, - s->ctx.out_rate, s->ctx.in_rate, AV_ROUND_UP); + return av_rescale_rnd(in_samples, s->ctx.out_rate, s->ctx.in_rate, AV_ROUND_UP) + + swr_get_delay(s->avrctx, s->ctx.out_rate); } #endif -- cgit v1.2.3