mirror of
https://github.com/mpv-player/mpv.git
synced 2025-12-28 05:33:14 +00:00
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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user