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.)
This commit is contained in:
wm4
2013-11-10 23:39:29 +01:00
parent 7510caa0c5
commit 824e6550f8
29 changed files with 24 additions and 56 deletions

View File

@@ -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)