Skip to content

Commit c899911

Browse files
committed
module: cadence: Implement complete process flow with INPUT_OVER+QUERY_DONE
The full processing command flow should start with the INPUT_OVER command when EOS is expected and after the DO_EXECUTE the DONE needs to be checked to see if the decoding has completed. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
1 parent d37f42b commit c899911

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

src/audio/module_adapter/module/cadence.c

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -476,6 +476,7 @@ int cadence_codec_process_data(struct processing_module *mod)
476476
struct cadence_codec_data *cd = module_get_private_data(mod);
477477
struct module_data *codec = &mod->priv;
478478
struct comp_dev *dev = mod->dev;
479+
uint32_t done = 0;
479480
int ret;
480481

481482
if (codec->mpd.eos_reached) {
@@ -485,6 +486,18 @@ int cadence_codec_process_data(struct processing_module *mod)
485486
return 0;
486487
}
487488

489+
if (dev->pipeline->expect_eos) {
490+
/* Signal that the stream is expected to end anytime soon */
491+
API_CALL(cd, XA_API_CMD_INPUT_OVER, 0, NULL, ret);
492+
if (ret != LIB_NO_ERROR) {
493+
if (LIB_IS_FATAL_ERROR(ret)) {
494+
comp_err(dev, "input_over failed with error: %x", ret);
495+
return ret;
496+
}
497+
comp_warn(dev, "input_over failed with nonfatal error: %x", ret);
498+
}
499+
}
500+
488501
API_CALL(cd, XA_API_CMD_SET_INPUT_BYTES, 0, &codec->mpd.avail, ret);
489502
if (ret != LIB_NO_ERROR) {
490503
comp_err(dev, "failed to set size of input data with error: %x:", ret);
@@ -500,6 +513,15 @@ int cadence_codec_process_data(struct processing_module *mod)
500513
comp_warn(dev, "processing failed with nonfatal error: %x", ret);
501514
}
502515

516+
API_CALL(cd, XA_API_CMD_EXECUTE, XA_CMD_TYPE_DONE_QUERY, &done, ret);
517+
if (ret != LIB_NO_ERROR) {
518+
if (LIB_IS_FATAL_ERROR(ret)) {
519+
comp_err(dev, "done query failed with error: %x", ret);
520+
return ret;
521+
}
522+
comp_warn(dev, "done query failed with nonfatal error: %x", ret);
523+
}
524+
503525
API_CALL(cd, XA_API_CMD_GET_OUTPUT_BYTES, 0, &codec->mpd.produced, ret);
504526
if (ret != LIB_NO_ERROR) {
505527
comp_err(dev, "could not get produced bytes, error %x:",
@@ -513,7 +535,7 @@ int cadence_codec_process_data(struct processing_module *mod)
513535
return ret;
514536
}
515537

516-
if (!codec->mpd.produced && dev->pipeline->expect_eos)
538+
if (dev->pipeline->expect_eos && done)
517539
codec->mpd.eos_reached = true;
518540

519541
return 0;

0 commit comments

Comments
 (0)