mirror of https://github.com/mpv-player/mpv
ao_coreaudio_chmap: allow stereo as fallback; avoid mono fallback
If no channel layouts were determined (which can actually happen with some "strange" devices), the selection code was falling back to mono, because mono is always added as a fallback. This doesn't seem quite right. Allow a fallback to stereo too, if no channel layout could be retrieved at all. So we always assume that mono and stereo work, if no other layouts are available. (I still don't know what the CoreAudio stereo layout is supposed to do. It could be used to swap left and right channels. It could also be used to pad/move the channels, but I have never seen that. And it can be set to non-stereo channels, which breaks mpv. Whatever.)
This commit is contained in:
parent
9ed289ef90
commit
c971fefd41
|
@ -242,8 +242,6 @@ bool ca_init_chmap(struct ao *ao, AudioDeviceID device)
|
|||
struct mp_chmap_sel chmap_sel = {.tmp = ta_ctx};
|
||||
struct mp_chmap chmap = {0};
|
||||
|
||||
mp_chmap_sel_add_map(&chmap_sel, &(struct mp_chmap)MP_CHMAP_INIT_MONO);
|
||||
|
||||
AudioChannelLayout *ml = ca_query_layout(ao, device, ta_ctx);
|
||||
if (ml && ca_layout_to_mp_chmap(ao, ml, &chmap))
|
||||
mp_chmap_sel_add_map(&chmap_sel, &chmap);
|
||||
|
@ -252,6 +250,11 @@ bool ca_init_chmap(struct ao *ao, AudioDeviceID device)
|
|||
if (sl && ca_layout_to_mp_chmap(ao, sl, &chmap))
|
||||
mp_chmap_sel_add_map(&chmap_sel, &chmap);
|
||||
|
||||
if (!chmap_sel.num_chmaps)
|
||||
mp_chmap_sel_add_map(&chmap_sel, &(struct mp_chmap)MP_CHMAP_INIT_STEREO);
|
||||
|
||||
mp_chmap_sel_add_map(&chmap_sel, &(struct mp_chmap)MP_CHMAP_INIT_MONO);
|
||||
|
||||
if (!ao_chmap_sel_adjust(ao, &chmap_sel, &ao->channels)) {
|
||||
MP_ERR(ao, "could not select a suitable channel map among the "
|
||||
"hardware supported ones. Make sure to configure your "
|
||||
|
|
Loading…
Reference in New Issue