mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-29 05:40:27 -04:00
bluez5: aac: work around devices setting multiple bits in caps
Airpods don't follow the specification and set multiple bits in AAC object type, including the ELD bit, but actually want AAC-LC. So check the AOT in the right order.
This commit is contained in:
parent
1f5c31dbc4
commit
c5e57a062d
1 changed files with 9 additions and 6 deletions
|
|
@ -364,7 +364,15 @@ static void *codec_init(const struct media_codec *codec, uint32_t flags,
|
|||
if (res != AACENC_OK)
|
||||
goto error;
|
||||
|
||||
if (conf->object_type & AAC_OBJECT_TYPE_MPEG4_AAC_ELD) {
|
||||
/* 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)) {
|
||||
res = aacEncoder_SetParam(this->aacenc, AACENC_AOT, AOT_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)
|
||||
goto error;
|
||||
|
|
@ -372,11 +380,6 @@ static void *codec_init(const struct media_codec *codec, uint32_t flags,
|
|||
res = aacEncoder_SetParam(this->aacenc, AACENC_SBR_MODE, 1);
|
||||
if (res != AACENC_OK)
|
||||
goto error;
|
||||
} else if (conf->object_type & (AAC_OBJECT_TYPE_MPEG2_AAC_LC |
|
||||
AAC_OBJECT_TYPE_MPEG4_AAC_LC)) {
|
||||
res = aacEncoder_SetParam(this->aacenc, AACENC_AOT, AOT_AAC_LC);
|
||||
if (res != AACENC_OK)
|
||||
goto error;
|
||||
} else {
|
||||
res = -EINVAL;
|
||||
goto error;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue