Browse Source

audiounit: fix surround input on stereo output

setPreferredOutputNumberOfChannels can fail, don't configure more
channels than accepted. The OS will drop the extra channels instead of
downmixing it.

When I first tested it, the apple TV was configured to always accept
surround even with a stereo output (Change Format = Off) but this is not
necessarily the case.
Thomas Guillem 4 years ago
committed by Alexandre Janniaux
parent
commit
d6f69079de
  1. 8
      modules/audio_output/audiounit_ios.m

8
modules/audio_output/audiounit_ios.m

@ -630,6 +630,14 @@ Start(audio_output_t *p_aout, audio_sample_format_t *restrict fmt)
(long) [p_sys->avInstance outputNumberOfChannels],
p_sys->b_spatial_audio_supported);
if (!p_sys->b_preferred_channels_set && fmt->i_channels > 2)
{
/* Ask the core to downmix to stereo if the preferred number of
* channels can't be set. */
fmt->i_physical_channels = AOUT_CHANS_STEREO;
aout_FormatPrepare(fmt);
}
p_aout->current_sink_info.headphones = port_type == PORT_TYPE_HEADPHONES;
p_sys->au_unit = au_NewOutputInstance(p_aout, kAudioUnitSubType_RemoteIO);

Loading…
Cancel
Save