From b0ed93d87ddf351a6983d3cb87063c75efa04281 Mon Sep 17 00:00:00 2001 From: wm4 Date: Mon, 1 Dec 2014 15:28:06 +0100 Subject: audio: allow more than 20 channel map entries This could trigger an assertion when using ao_alsa or ao_coreaudio. The code was simply assuming the number of channel maps was bounded statically (which was true at first in both AOs). Fix by using dynamic memory allocation. It needs to be explicitly enabled by the AOs by setting a temp context, because otherwise the memory couldn't be freed. (Or at least this seems to be the most elegant solution.) Fixes #1306. --- audio/chmap_sel.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'audio/chmap_sel.h') diff --git a/audio/chmap_sel.h b/audio/chmap_sel.h index c9d75196a5..7758ca5d74 100644 --- a/audio/chmap_sel.h +++ b/audio/chmap_sel.h @@ -26,8 +26,12 @@ struct mp_chmap_sel { // should be considered opaque bool allow_any, allow_waveext; bool speakers[MP_SPEAKER_ID_COUNT]; - struct mp_chmap chmaps[20]; + struct mp_chmap *chmaps; int num_chmaps; + + struct mp_chmap chmaps_storage[20]; + + void *tmp; // set to any talloc context to allow more chmaps entries }; void mp_chmap_sel_add_any(struct mp_chmap_sel *s); -- cgit v1.2.3