diff options
Diffstat (limited to 'audio/filter/af.c')
-rw-r--r-- | audio/filter/af.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/audio/filter/af.c b/audio/filter/af.c index 8d29e332a8..7b957c16bd 100644 --- a/audio/filter/af.c +++ b/audio/filter/af.c @@ -505,6 +505,15 @@ static int af_fix_rate(struct af_stream *s, struct af_instance **p_af, return AF_OK; } +static void reset_formats(struct af_stream *s) +{ + for (struct af_instance *af = s->first; af; af = af->next) { + af->control(af, AF_CONTROL_SET_RESAMPLE_RATE, &(int){0}); + af->control(af, AF_CONTROL_SET_CHANNELS, &(struct mp_chmap){0}); + af->control(af, AF_CONTROL_SET_FORMAT, &(int){0}); + } +} + // Return AF_OK on success or AF_ERROR on failure. // Warning: // A failed af_reinit() leaves the audio chain behind in a useless, broken @@ -515,6 +524,7 @@ static int af_reinit(struct af_stream *s) { remove_auto_inserted_filters(s); af_chain_forget_frames(s); + reset_formats(s); s->first->fmt_in = s->first->fmt_out = s->input; // Start with the second filter, as the first filter is the special input // filter which needs no initialization. |