diff options
author | wm4 <wm4@nowhere> | 2015-01-15 20:10:46 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2015-01-15 20:10:46 +0100 |
commit | ba0e8b754c4282bae941aa5d30614b2a305f9f5f (patch) | |
tree | 0d6c2ae058e5c60de0a3248d37a107d581f6a8c7 | |
parent | 66c8a87485dbed3c0007ff3a9d509ec985deeb2c (diff) |
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.
-rw-r--r-- | audio/filter/af.c | 5 |
1 files changed, 4 insertions, 1 deletions
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); |