diff options
author | Max Kellermann <max@duempel.org> | 2009-12-25 14:56:14 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2009-12-25 16:39:47 +0100 |
commit | bd29f7e3c880ff58a80aca84d951e1da9df788e7 (patch) | |
tree | 6ca323aa6b30d361b6e32892725871c2f0023869 | |
parent | c3bb81abecbdefb91e0cccb86c28a694a1f63129 (diff) | |
download | mpd-bd29f7e3c880ff58a80aca84d951e1da9df788e7.tar.gz mpd-bd29f7e3c880ff58a80aca84d951e1da9df788e7.tar.xz mpd-bd29f7e3c880ff58a80aca84d951e1da9df788e7.zip |
filter/route: check configured channel count in method init()
Detect misconfiguration during MPD startup, not when playback begins.
Diffstat (limited to '')
-rw-r--r-- | src/filter/route_filter_plugin.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/filter/route_filter_plugin.c b/src/filter/route_filter_plugin.c index a90abe56f..7fef2bc12 100644 --- a/src/filter/route_filter_plugin.c +++ b/src/filter/route_filter_plugin.c @@ -178,6 +178,14 @@ route_filter_parse(const struct config_param *param, g_strfreev(sd); } + if (!audio_valid_channel_count(filter->min_output_channels)) { + g_strfreev(tokens); + g_set_error(error_r, audio_format_quark(), 0, + "Invalid number of output channels requested: %d", + filter->min_output_channels); + return false; + } + // Allocate a map of "copy nothing to me" filter->sources = g_malloc(filter->min_output_channels * sizeof(signed char)); @@ -242,7 +250,7 @@ route_filter_finish(struct filter *_filter) static const struct audio_format * route_filter_open(struct filter *_filter, const struct audio_format *audio_format, - GError **error_r) + G_GNUC_UNUSED GError **error_r) { struct route_filter *filter = (struct route_filter *)_filter; @@ -251,13 +259,6 @@ route_filter_open(struct filter *_filter, filter->input_frame_size = audio_format_frame_size(&filter->input_format); - if (!audio_valid_channel_count(filter->min_output_channels)) { - g_set_error(error_r, audio_format_quark(), 2, - "Invalid number of output channels requested: %d", - filter->min_output_channels); - return NULL; - } - // Decide on an output format which has enough channels, // and is otherwise identical filter->output_format = *audio_format; |