[pulseaudio-discuss] About extra A2DP codecs support in bluetooth module

Qu Wenruo quwenruo.btrfs at gmx.com
Fri Jul 7 12:33:13 UTC 2017

After a quick glance into the code (without much knowledge about 
pulseaudio), I found that pulseaudio is just using sbc library to do the 

 From a2dp_process_render():
     while (PA_LIKELY(to_encode > 0 && to_write > 0)) {
         ssize_t written;
         ssize_t encoded;

         encoded = sbc_encode(&sbc_info->sbc,
                              p, to_encode,
                              d, to_write,

So there is really nothing blocking us to implement other codec.
For AAC codec, just (well, without tons of preparation and setup) call 
faacEncEncode() will be the core part.
Copyright sh*t will only restrict the related library, not the PA module.
(So if we could create a aptX codec library, then it will be possible to 

While the really hard part would be the preparation part, including 
creating a structure for faac encoder to contain a faacEncHandle and 
other needed info from sample rate to profile, just like sbc_info_t.

Although I have a basic idea of what to do, I'm still figuring out how 
to handle all the details.
Like how to create an endpoint for AAC codec (codec 0 is registered at 
register_endpoint, but shouldn't it be A2DP_CODEC_SBC instead of 
intermediate number 0?)

And how pulseaudio is handling the extra latency? Is PA infrastructure 
handling them well
so that we don't need to touch it?

Anyway, it'll take some time for me to get familiar with PA 
infrastructures, from dbus to PA internal helper functions.

On 2017年07月06日 21:32, Tanu Kaskinen wrote:
> On Thu, 2017-07-06 at 07:54 +0800, Qu Wenruo wrote:
>> Hi,
>> I found that even my bluetooth headset support AAC (A2DP_CODEC_MPEG24)
>> codec, when using pulseaudio-bluetooth module, only the basic SBC is
>> used in negotiation.
>> I checked the source of bluetooth module, but only SBC is implemented.
>> Any plan to support extra codec like MP3 (A2DP_CODEC_MPEG12) and ATRAC?
> This topic comes up every once in a while, but nobody has offered to
> implement the feature.

If there is any developer docs, that will help a lot.


> I don't think there are any reasons why more
> codecs couldn't be supported.


More information about the pulseaudio-discuss mailing list