From 824e6550f8ef1f361701eae469ada35d3889ab83 Mon Sep 17 00:00:00 2001 From: wm4 Date: Sun, 10 Nov 2013 23:39:29 +0100 Subject: audio/filter: fix mul/delay scale and values Before this commit, the af_instance->mul/delay values were in bytes. Using bytes is confusing for non-interleaved audio, so switch mul to samples, and delay to seconds. For delay, seconds are more intuitive than bytes or samples, because it's used for the latency calculation. We also might want to replace the delay mechanism with real PTS tracking inside the filter chain some time in the future, and PTS will also require time-adjustments to be done in seconds. For most filters, we just remove the redundant mul=1 initialization. (Setting this used to be required, but not anymore.) --- audio/decode/dec_audio.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'audio/decode/dec_audio.c') diff --git a/audio/decode/dec_audio.c b/audio/decode/dec_audio.c index 3f92c3c4e6..ebb54cb55a 100644 --- a/audio/decode/dec_audio.c +++ b/audio/decode/dec_audio.c @@ -312,10 +312,9 @@ int decode_audio(sh_audio_t *sh_audio, struct mp_audio_buffer *outbuf, max_decode_len -= max_decode_len % unitsize; while (minsamples >= 0 && mp_audio_buffer_samples(outbuf) < minsamples) { - struct af_stream *afs = sh_audio->afilter; - int out_sstride = afs->output.sstride; - int declen = (minsamples - mp_audio_buffer_samples(outbuf)) - * out_sstride / filter_multiplier; + int decsamples = (minsamples - mp_audio_buffer_samples(outbuf)) + / filter_multiplier; + int declen = decsamples * sstride; // + some extra for possible filter buffering declen += unitsize << 5; if (huge_filter_buffer) -- cgit v1.2.3