[FFmpeg-devel] avcodec/aacenc: Compatibility with Bluetooth A2DP headsets
Andrey Semashev
andrey.semashev at gmail.com
Tue Dec 24 00:57:00 EET 2019
Hi,
I'm trying to add support for AAC to PulseAudio with regard to Bluetooth
A2DP. I'm using libavcodec to encode AAC content and then packetize it
into RTP MP4-LATM packets, as required by A2DP spec. My current
implementation allows to switch between libfdk-aac and built-in AAC
encoder backends.
With libfdk-aac, everything's working well, the encoded audio is
correctly played by the BT headset (EOZ Air). But with the built-in
encoder I can hear occasional audio drop outs and artefacts like clicks
and weird stereo effects. I'm assuming this is because some decoding
errors on the headset, but obviously I don't have any kind of debug info
from it. When the same content is played (e.g. the same song) on
different runs, the artefacts appear at roughly the same places, so I'm
assuming that the problem is input content-related.
Given that libfdk-aac output is played without artefacts by the device,
I'm assuming my packetization code is correct. I also tried to debug and
analyze its output and didn't find anything out of order. This makes me
believe the problem is in the built-in encoder.
How should I proceed about this problem? What kind of information would
be useful to the aacenc developer(s) to debug this? Is there any
information as to how conforming aacenc is to the AAC spec and other,
especially hardware implementations?
For a start, here is my code:
https://gitlab.freedesktop.org/andrey.semashev/pulseaudio/blob/a2dp-codecs-aac/src/modules/bluetooth/a2dp-codec-aac.c
libavcodec encoder context initialization is at:
https://gitlab.freedesktop.org/andrey.semashev/pulseaudio/blob/a2dp-codecs-aac/src/modules/bluetooth/a2dp-codec-aac.c#L685
Thanks.
More information about the ffmpeg-devel
mailing list