1
0
mirror of https://github.com/mpv-player/mpv synced 2024-12-22 06:42:03 +00:00

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.
This commit is contained in:
wm4 2015-06-04 19:08:40 +02:00
parent c277c17a93
commit 2dc46423d6

View File

@ -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) static int get_out_samples(struct af_resample *s, int in_samples)
{ {
return av_rescale_rnd(get_delay(s) + in_samples, return av_rescale_rnd(in_samples, s->ctx.out_rate, s->ctx.in_rate, AV_ROUND_UP)
s->ctx.out_rate, s->ctx.in_rate, AV_ROUND_UP); + swr_get_delay(s->avrctx, s->ctx.out_rate);
} }
#endif #endif