summaryrefslogtreecommitdiffstats
path: root/audio
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-07-22 14:42:11 +0200
committerwm4 <wm4@nowhere>2013-07-22 15:06:07 +0200
commit0c9b0ba40dfd5954c04882d5f3c7d84c1e7681b4 (patch)
tree2b173dc3e76988b6b44d074ebed9d93e7bcdfdeb /audio
parentf86b94f9b4623baa999961681e44b9a838834de5 (diff)
downloadmpv-0c9b0ba40dfd5954c04882d5f3c7d84c1e7681b4.tar.bz2
mpv-0c9b0ba40dfd5954c04882d5f3c7d84c1e7681b4.tar.xz
af: fix recovery code for filter insertion (changing volume with spdif crash)
This code is supposed to run if dynamic filter insertion (such as when inserting a volume filter in mixer.c) fails. Then it removes all filters and recreates the default list of filters. But the code just blew up and entered an endless loop, because it removed even the sentinel in/out filters. This could happen when trying to use softvol controls while using spdif, but also other situations. Fix it by calling the correct code. Also remove these obnoxious yoda-conditions.
Diffstat (limited to 'audio')
-rw-r--r--audio/filter/af.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/audio/filter/af.c b/audio/filter/af.c
index f8d4336a52..7e2bdb8c18 100644
--- a/audio/filter/af.c
+++ b/audio/filter/af.c
@@ -636,10 +636,8 @@ struct af_instance *af_add(struct af_stream *s, char *name)
return NULL;
// Reinitalize the filter list
- if (AF_OK != af_reinit(s) ||
- AF_OK != fixup_output_format(s)) {
- while (s->first)
- af_remove(s, s->first);
+ if (af_reinit(s) != AF_OK || fixup_output_format(s) != AF_OK) {
+ af_uninit(s);
af_init(s);
return NULL;
}