From c3b4382c4b4a62c28e576b97221a56e9bf66575d Mon Sep 17 00:00:00 2001 From: Daniel Baluta Date: Tue, 2 Mar 2021 18:31:58 +0200 Subject: [PATCH] codec_adapter: cadence: Fix init process function Init process function searches for valid header, does header decoding to get the parameters and initializes state and configuration structures. In order for this to work we need to set the input bytes and also update consumed bytes. Signed-off-by: Daniel Baluta --- src/audio/codec_adapter/codec/cadence.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/audio/codec_adapter/codec/cadence.c b/src/audio/codec_adapter/codec/cadence.c index d8c0f4836..253a6174b 100644 --- a/src/audio/codec_adapter/codec/cadence.c +++ b/src/audio/codec_adapter/codec/cadence.c @@ -298,6 +298,13 @@ int cadence_codec_init_process(struct comp_dev *dev) struct codec_data *codec = comp_get_codec(dev); struct cadence_codec_data *cd = codec->private; + API_CALL(cd, XA_API_CMD_SET_INPUT_BYTES, 0, &codec->cpd.avail, ret); + if (ret != LIB_NO_ERROR) { + comp_err(dev, "cadence_codec_init_process() error %x: failed to set size of input data", + ret); + return ret; + } + API_CALL(cd, XA_API_CMD_INIT, XA_CMD_TYPE_INIT_PROCESS, NULL, ret); if (ret != LIB_NO_ERROR) { comp_err(dev, "cadence_codec_init_process() error %x: failed to initialize codec", @@ -311,12 +318,13 @@ int cadence_codec_init_process(struct comp_dev *dev) comp_err(dev, "cadence_codec_init_process() error %x: failed to get lib init status", ret); return ret; - } else if (!lib_init_status) { - comp_err(dev, "cadence_codec_init_process() error: lib has not been initiated properly"); - ret = -EINVAL; + } + + API_CALL(cd, XA_API_CMD_GET_CURIDX_INPUT_BUF, 0, &codec->cpd.consumed, ret); + if (ret != LIB_NO_ERROR) { + comp_err(dev, "cadence_codec_init_process() error %x: could not get consumed bytes", + ret); return ret; - } else { - comp_dbg(dev, "cadence_codec_init_process(): lib has been initialized properly"); } return 0;