[pulseaudio-commits] Branch 'next' - src/pulsecore

Tanu Kaskinen tanuk at kemper.freedesktop.org
Mon May 7 14:11:33 UTC 2018


 src/pulsecore/core-format.c |   22 +++++++++++++++-------
 1 file changed, 15 insertions(+), 7 deletions(-)

New commits:
commit d171a15f91811e083b52a455fc67c79f676fae4b
Author: Tanu Kaskinen <tanuk at iki.fi>
Date:   Sat May 5 16:01:06 2018 +0300

    core-format: fix TrueHD and DTS-HD channel maps
    
    Since these formats use 8 channels, the channel map needs to be
    configured to 8 channels as well.

diff --git a/src/pulsecore/core-format.c b/src/pulsecore/core-format.c
index c3db2678..862a74b5 100644
--- a/src/pulsecore/core-format.c
+++ b/src/pulsecore/core-format.c
@@ -227,13 +227,21 @@ int pa_format_info_to_sample_spec_fake(const pa_format_info *f, pa_sample_spec *
 
     ss->format = PA_SAMPLE_S16LE;
     if ((f->encoding == PA_ENCODING_TRUEHD_IEC61937) ||
-	(f->encoding == PA_ENCODING_DTSHD_IEC61937))
-	ss->channels = 8;
-    else
-	ss->channels = 2;
-
-    if (map)
-        pa_channel_map_init_stereo(map);
+        (f->encoding == PA_ENCODING_DTSHD_IEC61937)) {
+        ss->channels = 8;
+        if (map) {
+            /* We use the ALSA mapping, because most likely we will be using an
+             * ALSA sink. This doesn't really matter anyway, though, because
+             * the channel map doesn't affect anything with passthrough
+             * streams. The channel map just needs to be consistent with the
+             * sample spec's channel count. */
+            pa_channel_map_init_auto(map, 8, PA_CHANNEL_MAP_ALSA);
+        }
+    } else {
+        ss->channels = 2;
+        if (map)
+            pa_channel_map_init_stereo(map);
+    }
 
     pa_return_val_if_fail(pa_format_info_get_prop_int(f, PA_PROP_FORMAT_RATE, &rate) == 0, -PA_ERR_INVALID);
     ss->rate = (uint32_t) rate;



More information about the pulseaudio-commits mailing list