1
0
mirror of https://github.com/mpv-player/mpv synced 2024-12-23 23:32:26 +00:00

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.
This commit is contained in:
wm4 2015-10-26 15:51:26 +01:00
parent c21c26472c
commit fa510bd00c

View File

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