[vlc-commits] [Git][videolan/vlc][master] 2 commits: audiounit: fix swap_rear_surround check

Steve Lhomme (@robUx4) gitlab at videolan.org
Fri Jan 6 10:23:20 UTC 2023



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
a4b715b3 by Thomas Guillem at 2023-01-06T07:43:48+00:00
audiounit: fix swap_rear_surround check

- - - - -
6c08c24b by Thomas Guillem at 2023-01-06T07:43:48+00: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.

- - - - -


2 changed files:

- modules/audio_output/audiounit_ios.m
- modules/audio_output/coreaudio_common.c


Changes:

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


=====================================
modules/audio_output/coreaudio_common.c
=====================================
@@ -708,7 +708,7 @@ MapInputLayout(audio_output_t *p_aout, const audio_sample_format_t *fmt,
     inlayout->mChannelLayoutTag = kAudioChannelLayoutTag_UseChannelDescriptions;
     inlayout->mNumberChannelDescriptions = aout_FormatNbChannels(fmt);
 
-    bool swap_rear_surround = fmt->i_physical_channels & AOUT_CHANS_7_0;
+    bool swap_rear_surround = (fmt->i_physical_channels & AOUT_CHANS_7_0) == AOUT_CHANS_7_0;
     if (swap_rear_surround)
         msg_Dbg(p_aout, "swapping Surround and RearSurround channels "
                 "for 7.1 Rear Surround");



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/9abf0bb2b650ace0d53f0de9feb3ac1fd9146d1c...6c08c24b075157241eaca3543bb77107a1b9b853

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/9abf0bb2b650ace0d53f0de9feb3ac1fd9146d1c...6c08c24b075157241eaca3543bb77107a1b9b853
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