[pulseaudio-commits] [Git][pulseaudio/pulseaudio][master] resampler: Fix confusion between rear and side channels for 5.1 layouts

Tanu Kaskinen gitlab at gitlab.freedesktop.org
Thu Nov 15 07:55:25 UTC 2018


Tanu Kaskinen pushed to branch master at PulseAudio / pulseaudio


Commits:
73156649 by Alexander E. Patrakov at 2018-11-15T07:48:14Z
resampler: Fix confusion between rear and side channels for 5.1 layouts

mpv and vlc play "normal" 5.1 AC3 and DTS files as if they had a
"5.1 (Side)" layout. Which is fine and consistent with ITU
recommendations if the user has a proper 7.1 system. But if the user
actually has a 5.1 system, PulseAudio will try to remap, poorly, between
the "5.1 (Side)" and "5.1" layouts, sending either an average between
front and rear channels, or an attenuated version of that average,
depending on the remixing-use-all-sink-channels setting.

This is not desired, the "Side" channels should be sent to "Rear", it is
only an unfortunate nomenclature confusion.

This patch does not fix 5.1 <-> 7.1 remixing.

Signed-off-by: Alexander E. Patrakov <patrakov at gmail.com>

- - - - -


1 changed file:

- src/pulsecore/resampler.c


Changes:

=====================================
src/pulsecore/resampler.c
=====================================
@@ -914,6 +914,8 @@ static void setup_remap(const pa_resampler *r, pa_remap_t *m, bool *lfe_remixed)
          * The algorithm works basically like this:
          *
          * 1) Connect all channels with matching names.
+         *    This also includes fixing confusion between "5.1" and
+         *    "5.1 (Side)" layouts, done by mpv.
          *
          * 2) Mono Handling:
          *    S:Mono: See setup_oc_mono_map().
@@ -1006,6 +1008,26 @@ static void setup_remap(const pa_resampler *r, pa_remap_t *m, bool *lfe_remixed)
                 }
             }
 
+            if (!oc_connected) {
+                /* Maybe it is due to 5.1 rear/side confustion? */
+                for (ic = 0; ic < n_ic; ic++) {
+                    pa_channel_position_t a = r->i_cm.map[ic];
+                    if (ic_connected[ic])
+                        continue;
+
+                    if ((a == PA_CHANNEL_POSITION_REAR_LEFT && b == PA_CHANNEL_POSITION_SIDE_LEFT) ||
+                        (a == PA_CHANNEL_POSITION_SIDE_LEFT && b == PA_CHANNEL_POSITION_REAR_LEFT) ||
+                        (a == PA_CHANNEL_POSITION_REAR_RIGHT && b == PA_CHANNEL_POSITION_SIDE_RIGHT) ||
+                        (a == PA_CHANNEL_POSITION_SIDE_RIGHT && b == PA_CHANNEL_POSITION_REAR_RIGHT)) {
+
+                        m->map_table_f[oc][ic] = 1.0f;
+
+                        oc_connected = true;
+                        ic_connected[ic] = true;
+                    }
+                }
+            }
+
             if (!oc_connected) {
                 /* Try to find matching input ports for this output port */
 



View it on GitLab: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/commit/73156649e76ac4000931990edcdcb3be31aade7b

-- 
View it on GitLab: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/commit/73156649e76ac4000931990edcdcb3be31aade7b
You're receiving this email because of your account on gitlab.freedesktop.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/pulseaudio-commits/attachments/20181115/2c40c7ff/attachment-0001.html>


More information about the pulseaudio-commits mailing list