libldac-dec: fix decoder initialization failure

`ldacBT_init_handle_decode` passes `hLdacBT->cci`, `hLdacBT->frmlen`,
and `hLdacBT->frm_status` to `ldaclib_set_config_info()` before they
are assigned, causing `LDACBT_ERR_FATAL` on every decode init.

This breaks PipeWire 1.6+'s LDAC codec entirely, since the SPA plugin
treats decoder init failure as fatal and refuses to initialize the
encoder too.

Move the struct member assignments before the function call that uses
them.
This commit is contained in:
Aliaksandr
2026-03-23 17:54:52 +02:00
parent 460a6e5401
commit 392ecf3352
2 changed files with 29 additions and 0 deletions
@@ -0,0 +1,24 @@
--- a/src/ldacBT_api.o.c
+++ b/src/ldacBT_api.o.c
@@ -165,6 +165,10 @@
// tbl_ldacbt_config[0].frmlen_1ch;
// frmlen = 165 * channel - LDACBT_FRMHDRBYTES;
frmlen = tbl_ldacbt_config[0].frmlen_1ch * channel - LDACBT_FRMHDRBYTES;
+ hLdacBT->frmlen = frmlen;
+ hLdacBT->cm = cm;
+ hLdacBT->cci = cci;
+ hLdacBT->frm_status = 0;
/* Set Configuration Information */
result = ldaclib_set_config_info(
hLdacBT->hLDAC, hLdacBT->sfid, hLdacBT->cci, hLdacBT->frmlen, hLdacBT->frm_status);
@@ -174,10 +178,6 @@
} else if (result != LDAC_S_OK) {
hLdacBT->error_code_api = LDACBT_GET_LDACLIB_ERROR_CODE;
}
- hLdacBT->frmlen = frmlen;
- hLdacBT->cm = cm;
- hLdacBT->cci = cci;
- hLdacBT->frm_status = 0;
hLdacBT->sfid = sfid;
result = ldaclib_init_decode(hLdacBT->hLDAC, nshift);
if (LDAC_FAILED(result)) {
+5
View File
@@ -17,6 +17,11 @@ stdenv.mkDerivation {
hash = "sha256-pdeEtQXxL2pd9qTfLOEmPDn3POgo5qxRqbK807WN98s=";
};
patches = [
# Fix uninitialized struct members passed to ldaclib_set_config_info in decode init
./fix-decode-init.patch
];
nativeBuildInputs = [ cmake ];
# Upstream CMakeLists.txt doesn't have install rules