From 0c9b0ba40dfd5954c04882d5f3c7d84c1e7681b4 Mon Sep 17 00:00:00 2001 From: wm4 Date: Mon, 22 Jul 2013 14:42:11 +0200 Subject: 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. --- audio/filter/af.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'audio') 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; } -- cgit v1.2.3