[v8,06/12] bluetooth: Set correct endianity of audio samples for SBC codec

Submitted by Pali Rohár on April 6, 2019, 9:16 a.m.

Details

Message ID 20190406091607.29092-7-pali.rohar@gmail.com
State Accepted
Commit 1b6e5b8554c46c7a228a9c0d65d287ac0e823b83
Headers show
Series "New API for Bluetooth A2DP codecs" ( rev: 56 55 54 53 52 51 50 49 48 47 46 45 ) in PulseAudio

Not browsing as part of any series.

Commit Message

Pali Rohár April 6, 2019, 9:16 a.m.
Pulseaudio SBC codec defines that audio samples are in PA_SAMPLE_S16LE
format which is little endian. But libsbc library expects audio samples by
default in host endianity which is big endian on big endian system. So SBC
support on big endian system is broken. To fix this problem tell libsbc
library that audio samples are in little endian to match PA_SIMPLE_S16LE
sample format.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=91359
---
 src/modules/bluetooth/a2dp-codec-sbc.c | 1 +
 1 file changed, 1 insertion(+)

Patch hide | download patch | download mbox

diff --git a/src/modules/bluetooth/a2dp-codec-sbc.c b/src/modules/bluetooth/a2dp-codec-sbc.c
index 523350b6d..98d1888ca 100644
--- a/src/modules/bluetooth/a2dp-codec-sbc.c
+++ b/src/modules/bluetooth/a2dp-codec-sbc.c
@@ -314,6 +314,7 @@  static void set_params(struct sbc_info *sbc_info) {
     sbc_info->sbc.mode = sbc_info->mode;
     sbc_info->sbc.allocation = sbc_info->allocation;
     sbc_info->sbc.bitpool = sbc_info->initial_bitpool;
+    sbc_info->sbc.endian = SBC_LE;
 
     sbc_info->codesize = sbc_get_codesize(&sbc_info->sbc);
     sbc_info->frame_length = sbc_get_frame_length(&sbc_info->sbc);