Bug 91359 - [bluetooth] wrong SBC configuration on big endian platforms
Summary: [bluetooth] wrong SBC configuration on big endian platforms
Status: RESOLVED MOVED
Alias: None
Product: PulseAudio
Classification: Unclassified
Component: modules (show other bugs)
Version: unspecified
Hardware: Other Linux (All)
: medium normal
Assignee: pulseaudio-bugs
QA Contact: pulseaudio-bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-07-16 12:16 UTC by pisak
Modified: 2018-07-30 10:31 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description pisak 2015-07-16 12:16:31 UTC
PLATFORM:
AR9311 MIPS 24K SoC
OpenWRT Chaos Calmer 15.05
BlueZ 5.32
PulseAudio 6.0

PROBLEM:
White noise when streaming audio over A2DP from bluetooth device to PA server running on big endian platforms.

CAUSE:
method bt_transport_config_a2dp() in src/modules/bluetooth/module-bluez4-device.c  
method transport_config() in src/modules/bluetooth/module-bluez5-device.c

The current code assumes that endianness of the data returned by SBC is always little endian and configure the transport in this way:

module-bluez4-device.c
1707|    u->sample_spec.format = PA_SAMPLE_S16LE;

module-bluez5-device.c
1159|    u->sample_spec.format = PA_SAMPLE_S16LE;

However an endianness in default settings returned by SBC is set according to endianness of target platform:
 
1025|    	sbc->blocks = SBC_BLK_16;
1026|    	sbc->bitpool = 32;
1027|    #if __BYTE_ORDER == __LITTLE_ENDIAN
1028|    	sbc->endian = SBC_LE;
1029|    #elif __BYTE_ORDER == __BIG_ENDIAN
1030|    	sbc->endian = SBC_BE;
1031|    #else
1032|    #error "Unknown byte order"
1033|    #endif

see:
http://git.kernel.org/cgit/bluetooth/sbc.git/tree/sbc/sbc.c#n1027

Thus on big endian platforms SBC returns data in big endian format but PA treats it as little endian, which results with white noise.

SOLUTION:

Explicitly set SBC configuration to produce little endian data by adding:

module-bluez4-device.c
1714|    sbc_info->sbc.endian = SBC_LE;

module-bluez5-device.c
1167|    sbc_info->sbc.endian = SBC_LE;

WORKAROUND:
not known.
Comment 1 GitLab Migration User 2018-07-30 10:31:38 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/issues/486.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.