path: root/audio/decode
diff options
authorwm4 <wm4@nowhere>2013-11-10 23:39:29 +0100
committerwm4 <wm4@nowhere>2013-11-12 23:34:35 +0100
commit824e6550f8ef1f361701eae469ada35d3889ab83 (patch)
tree7170184cfcdce814fde9308941fd2b4ff74d126c /audio/decode
parent7510caa0c5ef3db320d1065f869d14c0eddecf79 (diff)
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.)
Diffstat (limited to 'audio/decode')
1 files changed, 3 insertions, 4 deletions
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)