Skip to content

module: cadence: Implement complete process flow with INPUT_OVER+QUER…#10553

Open
ujfalusi wants to merge 1 commit intothesofproject:mainfrom
ujfalusi:peter/pr/ipc4_cadence_eos_done_update
Open

module: cadence: Implement complete process flow with INPUT_OVER+QUER…#10553
ujfalusi wants to merge 1 commit intothesofproject:mainfrom
ujfalusi:peter/pr/ipc4_cadence_eos_done_update

Conversation

@ujfalusi
Copy link
Contributor

…Y_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.
This does not work in the FLAC library for some reason, but it will produce one empty frame at the end of the stream, which we can use to detect EOS completion.

Copilot AI review requested due to automatic review settings February 17, 2026 14:48
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR implements a complete Cadence codec process flow by adding support for the INPUT_OVER and DONE_QUERY commands to properly handle End of Stream (EOS) detection. The implementation adds the INPUT_OVER signal when EOS is expected, queries the DONE status after each DO_EXECUTE operation, and includes special handling for the FLAC decoder which cannot properly signal completion.

Changes:

  • Added INPUT_OVER command to signal impending stream end when expect_eos is true
  • Added DONE_QUERY command after DO_EXECUTE to check if decoding has completed
  • Implemented FLAC-specific workaround that detects EOS by checking if the decoder stopped producing output

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

struct cadence_codec_data *cd = module_get_private_data(mod);
struct module_data *codec = &mod->priv;
struct comp_dev *dev = mod->dev;
uint32_t done = false;
Copy link

Copilot AI Feb 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Initialize uint32_t variable with 0 instead of false for consistency. While false evaluates to 0 and works correctly, using false to initialize an integer type is unconventional. This should be: uint32_t done = 0;

Suggested change
uint32_t done = false;
uint32_t done = 0;

Copilot uses AI. Check for mistakes.
Comment on lines 542 to 544
*/
if (cd->api_id == CADENCE_CODEC_FLAC_DEC_ID && !codec->mpd.produced)
done = true;
Copy link

Copilot AI Feb 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The constant CADENCE_CODEC_FLAC_DEC_ID is not defined anywhere in the codebase. This will cause a compilation error. The enum cadence_api_id in src/include/sof/audio/module_adapter/module/cadence.h does not include a FLAC decoder entry. You need to either:

  1. Add CADENCE_CODEC_FLAC_DEC_ID to the enum in cadence.h
  2. Add the corresponding FLAC decoder entry in the cadence_api_table in cadence.c
  3. Add the necessary CONFIG_CADENCE_CODEC_FLAC_DEC configuration
  4. Declare the xa_flac_dec function if it exists
    If FLAC support is not yet implemented, this code should be removed or the comparison should check against a valid codec ID.
Suggested change
*/
if (cd->api_id == CADENCE_CODEC_FLAC_DEC_ID && !codec->mpd.produced)
done = true;
*/
#ifdef CADENCE_CODEC_FLAC_DEC_ID
if (cd->api_id == CADENCE_CODEC_FLAC_DEC_ID && !codec->mpd.produced)
done = true;
#endif

Copilot uses AI. Check for mistakes.
Comment on lines +489 to +499
if (dev->pipeline->expect_eos) {
/* Signal that the stream is expected to end anytime soon */
API_CALL(cd, XA_API_CMD_INPUT_OVER, 0, NULL, ret);
if (ret != LIB_NO_ERROR) {
if (LIB_IS_FATAL_ERROR(ret)) {
comp_err(dev, "input_over failed with error: %x", ret);
return ret;
}
comp_warn(dev, "input_over failed with nonfatal error: %x", ret);
}
}
Copy link

Copilot AI Feb 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The INPUT_OVER command is called on every invocation of cadence_codec_process_data when expect_eos is true. This means the command will be sent repeatedly to the codec library until EOS is reached. Consider adding a flag (e.g., input_over_sent) in the cadence_codec_data structure to call INPUT_OVER only once when expect_eos transitions to true. This would be more efficient and aligns with typical codec API semantics where INPUT_OVER signals the final input has been provided. However, if the Cadence API is designed to handle repeated INPUT_OVER calls efficiently, this may not be necessary.

Copilot uses AI. Check for mistakes.
@ujfalusi ujfalusi force-pushed the peter/pr/ipc4_cadence_eos_done_update branch from 6e8642b to c899911 Compare February 17, 2026 15:23
@ujfalusi
Copy link
Contributor Author

Changes since v1:

  • remove FLAC support as it is not yet available

…Y_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.
This does not work in the AAC library for some reason, but it will produce
one empty frame at the end of the stream, which we can use to detect EOS
completion.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
@ujfalusi ujfalusi force-pushed the peter/pr/ipc4_cadence_eos_done_update branch from c899911 to f5d3503 Compare February 17, 2026 15:29
@ujfalusi
Copy link
Contributor Author

Changes since v2:

  • sorry, it is AAC that is not signaling DONE

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant