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 <daniel.baluta@nxp.com>
This commit is contained in:
Daniel Baluta 2021-03-02 18:31:58 +02:00 committed by Daniel Baluta
parent 09ac7f1b72
commit c3b4382c4b
1 changed files with 13 additions and 5 deletions

View File

@ -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;