From ba0e8b754c4282bae941aa5d30614b2a305f9f5f Mon Sep 17 00:00:00 2001 From: wm4 Date: Thu, 15 Jan 2015 20:10:46 +0100 Subject: af: verify filter input formats Just to make sure all filters get the correct format. Together wih the check in af_add_output_frame(), this asserts that af->prev->fmt_out == af->fmt_in This also requires setting the "in" pseudo-filter (s->first) formats correctly. Before this commit, the fmt_in/fmt_out fields weren't used for this filter. --- audio/filter/af.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/audio/filter/af.c b/audio/filter/af.c index 6e9ede612e..37d002fc5d 100644 --- a/audio/filter/af.c +++ b/audio/filter/af.c @@ -513,6 +513,7 @@ static int af_reinit(struct af_stream *s) { remove_auto_inserted_filters(s); af_chain_forget_frames(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. struct af_instance *af = s->first->next; @@ -774,7 +775,7 @@ void af_control_all(struct af_stream *s, int cmd, void *arg) void af_add_output_frame(struct af_instance *af, struct mp_audio *frame) { if (frame) { - assert(mp_audio_config_equals(af->data, frame)); + assert(mp_audio_config_equals(&af->fmt_out, frame)); MP_TARRAY_APPEND(af, af->out_queued, af->num_out_queued, frame); } } @@ -800,6 +801,8 @@ static struct mp_audio *af_dequeue_output_frame(struct af_instance *af) static int af_do_filter(struct af_instance *af, struct mp_audio *frame) { + if (frame) + assert(mp_audio_config_equals(&af->fmt_in, frame)); int r = 0; if (af->filter_frame) { r = af->filter_frame(af, frame); -- cgit v1.2.3