diff options
author | wm4 <wm4@nowhere> | 2016-07-11 12:23:25 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2016-07-11 12:23:32 +0200 |
commit | e246c3f060513a9bcda6097f6ca6ddfba5bf3579 (patch) | |
tree | 0371677e0ff6817a867fa7af6cf9ba4416f325de /audio | |
parent | 61afe3820a9e967a471e6ef90162158f5cf87f39 (diff) | |
download | mpv-e246c3f060513a9bcda6097f6ca6ddfba5bf3579.tar.bz2 mpv-e246c3f060513a9bcda6097f6ca6ddfba5bf3579.tar.xz |
audio: fix code for adjusting conversion filters
This code was supposed to adjust existing conversion filters (to make
them output a different format). But the code was just broken,
apparently a refactoring accident. It accessed af instead of af->prev.
The bug tended to add new conversion filters, even if an existing one
could have been used. (Can be tested by inserting a dummy lavrresample
filter followed by a format filter which forces conversion.)
In addition, it's probably better to return the actual error code if
reinitializing the filter fails. It would then respect an AF_FALSE
return value, which means format negotiation failed, instead of a
generic error.
Diffstat (limited to 'audio')
-rw-r--r-- | audio/filter/af.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/audio/filter/af.c b/audio/filter/af.c index 5706f73daa..8d1ce889c4 100644 --- a/audio/filter/af.c +++ b/audio/filter/af.c @@ -315,12 +315,13 @@ static int filter_reinit_with_conversion(struct af_stream *s, struct af_instance // First try if we can change the output format of the previous // filter to the input format the current filter is expecting. struct mp_audio in = af->fmt_in; - if (af->prev != s->first && !mp_audio_config_equals(af->data, &in)) { + if (af->prev != s->first && !mp_audio_config_equals(af->prev->data, &in)) { // This should have been successful (because it succeeded // before), even if just reverting to the old output format. - mp_audio_copy_config(af->data, &in); - if (filter_reinit(af->prev) != AF_OK) - return AF_ERROR; + mp_audio_copy_config(af->prev->data, &in); + rv = filter_reinit(af->prev); + if (rv != AF_OK) + return rv; } if (!mp_audio_config_equals(af->prev->data, &in)) { // Retry with conversion filter added. |