From 919707efb7f58633dadab272b941a330c4f7025b Mon Sep 17 00:00:00 2001 From: wm4 Date: Mon, 26 Oct 2015 16:00:17 +0100 Subject: ao_coreaudio_exclusive: check for maximum channel count Until recently, the channel layout code happened to catch this, but now an explicit check is needed. Otherwise, it'd try to pad the missing channels with NA in the channel map fallback code. --- audio/out/ao_coreaudio_exclusive.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/audio/out/ao_coreaudio_exclusive.c b/audio/out/ao_coreaudio_exclusive.c index 4d47ae356e..af07fe0f3e 100644 --- a/audio/out/ao_coreaudio_exclusive.c +++ b/audio/out/ao_coreaudio_exclusive.c @@ -300,6 +300,12 @@ static int init(struct ao *ao) ca_print_asbd(ao, "virtual format", &p->stream_asbd); + if (p->stream_asbd.mChannelsPerFrame > MP_NUM_CHANNELS) { + MP_ERR(ao, "unsupported number of channels: %d > %d.\n", + p->stream_asbd.mChannelsPerFrame, MP_NUM_CHANNELS); + goto coreaudio_error; + } + int new_format = ca_asbd_to_mp_format(&p->stream_asbd); // If both old and new formats are spdif, avoid changing it due to the -- cgit v1.2.3