summaryrefslogtreecommitdiffstats
path: root/audio
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-10-26 15:51:26 +0100
committerwm4 <wm4@nowhere>2015-10-26 15:51:26 +0100
commitfa510bd00cc62646255123504b3bfd4fc491f6bc (patch)
treef5db46fa480a4cc508ad87fc43e530689b12c43e /audio
parentc21c26472c918947c4cc060ab06bd2a470db3068 (diff)
downloadmpv-fa510bd00cc62646255123504b3bfd4fc491f6bc.tar.bz2
mpv-fa510bd00cc62646255123504b3bfd4fc491f6bc.tar.xz
af: prevent endless loop when removing filters due to spdif
This code removes filters which can not take spdif inout. This was made so that PCM filters are transparently dropped in spdif mode. This entered an endless loop with: --af=lavcac3enc:::2 --audio-channels=5.1 The forced number of output channels is incompatible with spdif. It's trying to insert af_lavrresample as conversion filter to compensate for it. Of course this doesn't work, which triggers the PCM filter removal. Then it goes on normally - since the new state is exactly as before, it will try the same thing again, forever. Fix by reusing the retry counter, which is a very dumb but very effective measure against these cases of filter negotiation failure. We could try to be more clever (for example, if the removed filter is a conversion filter, we can be sure this won't work, and error out immediately). But better keep it simple and robust.
Diffstat (limited to 'audio')
-rw-r--r--audio/filter/af.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/audio/filter/af.c b/audio/filter/af.c
index 62ba6a9665..7ff3b49ae8 100644
--- a/audio/filter/af.c
+++ b/audio/filter/af.c
@@ -461,7 +461,8 @@ static int af_reinit(struct af_stream *s)
struct af_instance *aft = af->prev;
af_remove(s, af);
af = aft->next;
- break;
+ retry++;
+ continue;
}
}
goto negotiate_error;