a2dp: add aac encoder
This adds a basic AAC encoder for A2DP using the FDK-AAC library. Tested using Samsung Galaxy Buds+ over an Intel AX200 adapter.
I hope I understood the get_block_size
and get_num_blocks
values right: get_block_size
is the number of input PCM bytes encoded in a single frame, and get_num_blocks
is the number of encoded output bytes input blocks of size get_block_size
that fit in a single bluetooth packet, right?
The reduce_bitpool
and increase_bitpool
functions are implemented and adjust the bitrate. This works fine, but in my limited testing the bluetooth connection either has sufficient bandwith or it drops out completely. Adjusting the bitrate doesn't help in this case.
Todo (in future MRs):
- Fragmentation. Currently, the encoder fits every AAC frame into a single RTP packet (whose size is bounded by the bluetooth MTU). This limits the possible bitrate (for the Buds+ to 250kbs). Is there a built-in way to do this, or should I just allocate a buffer in the AAC codec and do the fragmentation in
codec_encode
? - Variable bit rate. (Not sure how useful this is.)
- Decoder.