bluez5: aac: disable Perceptual Noise Substitution for MPEG-2 profile

When the Bluetooth earphones claim to support AAC `MPEG-2 AAC LC` type only,
PipeWire encodes audio using MPEG-4 FDK-AAC profile which enables unsupported
Perceptual Noise Substitution (PNS) encoder feature.

Use AOT_MP2_AAC_LC pseudo-profile which is AOT_AAC_LC with PNS disabled.
This commit is contained in:
ValdikSS 2025-06-03 07:28:42 +03:00 committed by Wim Taymans
parent 38a3ebdca1
commit 187df01b5e

View file

@ -370,11 +370,14 @@ static void *codec_init(const struct media_codec *codec, uint32_t flags,
/* If object type has multiple bits set (invalid per spec, see above),
* assume the device usually means AAC-LC.
*/
if (conf->object_type & (AAC_OBJECT_TYPE_MPEG2_AAC_LC |
AAC_OBJECT_TYPE_MPEG4_AAC_LC)) {
if (conf->object_type & AAC_OBJECT_TYPE_MPEG4_AAC_LC) {
res = aacEncoder_SetParam(this->aacenc, AACENC_AOT, AOT_AAC_LC);
if (res != AACENC_OK)
goto error;
} else if (conf->object_type & AAC_OBJECT_TYPE_MPEG2_AAC_LC) {
res = aacEncoder_SetParam(this->aacenc, AACENC_AOT, AOT_MP2_AAC_LC);
if (res != AACENC_OK)
goto error;
} else if (conf->object_type & AAC_OBJECT_TYPE_MPEG4_AAC_ELD) {
res = aacEncoder_SetParam(this->aacenc, AACENC_AOT, AOT_ER_AAC_ELD);
if (res != AACENC_OK)