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.
This commit is contained in:
wm4 2013-07-22 14:42:11 +02:00
parent f86b94f9b4
commit 0c9b0ba40d
1 changed files with 2 additions and 4 deletions

View File

@ -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;
}