summaryrefslogtreecommitdiffstats
path: root/audio/out/ao_coreaudio_exclusive.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-10-21 18:54:48 +0200
committerwm4 <wm4@nowhere>2015-10-21 18:54:48 +0200
commitdda16ee1fbe681ad747210aaea7727a3378c9af2 (patch)
tree4173267c71a2bee59ad4386655c35ec616025703 /audio/out/ao_coreaudio_exclusive.c
parent78112c858246f9018140d87d8cfc32868ff56fbb (diff)
downloadmpv-dda16ee1fbe681ad747210aaea7727a3378c9af2.tar.bz2
mpv-dda16ee1fbe681ad747210aaea7727a3378c9af2.tar.xz
ao_coreaudio_exclusive: deal with devices return different channel count
If the device returns an unexpected number of channels instead of the requested count on init, don't immediately error out. Instead, look if there's a channel map with the given number of channels. If there isn't, still error out, because we don't want to guess the channel layout.
Diffstat (limited to 'audio/out/ao_coreaudio_exclusive.c')
-rw-r--r--audio/out/ao_coreaudio_exclusive.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/audio/out/ao_coreaudio_exclusive.c b/audio/out/ao_coreaudio_exclusive.c
index f8aba87188..c998ee825c 100644
--- a/audio/out/ao_coreaudio_exclusive.c
+++ b/audio/out/ao_coreaudio_exclusive.c
@@ -315,7 +315,10 @@ static int init(struct ao *ao)
ao->samplerate = p->stream_asbd.mSampleRate;
if (ao->channels.num != p->stream_asbd.mChannelsPerFrame) {
- // We really expect that ca_init_chmap() fixes the layout to the HW's.
+ ca_active_chmap(ao, p->device, p->stream_asbd.mChannelsPerFrame,
+ &ao->channels);
+ }
+ if (!ao->channels.num) {
MP_ERR(ao, "number of channels changed, and unknown channel layout!\n");
goto coreaudio_error;
}