[vlc-commits] [Git][videolan/vlc][3.0.x] audiounit: fix surround input on stereo output

Steve Lhomme (@robUx4) gitlab at videolan.org
Fri Apr 7 07:48:56 UTC 2023



Steve Lhomme pushed to branch 3.0.x at VideoLAN / VLC


Commits:
fb75641b by Thomas Guillem at 2023-04-06T08:47:17+02:00
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.

(cherry picked from commit 6c08c24b075157241eaca3543bb77107a1b9b853)
Signed-off-by: Thomas Guillem <thomas at gllm.fr>

- - - - -


1 changed file:

- modules/audio_output/audiounit_ios.m


Changes:

=====================================
modules/audio_output/audiounit_ios.m
=====================================
@@ -612,6 +612,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);



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/fb75641be04c01856e5d190e741e515909f1e49b

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/fb75641be04c01856e5d190e741e515909f1e49b
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list