Skip to content

Commit

Permalink
cadence: disable deep buffering of encoder output
Browse files Browse the repository at this point in the history
Suppress the existing 'deep buffering' feature in the case of Cadence
encoders. This prevents the encoder output stream from being expanded
with (inappropriate) all-zeros leading data.

Signed-off-by: Tomasz Lissowski <tomasz.lissowski@intel.com>
  • Loading branch information
tlissows authored and lgirdwood committed May 9, 2024
1 parent 4f3e4f9 commit 7f6d1c6
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/audio/module_adapter/module/cadence.c
Original file line number Diff line number Diff line change
Expand Up @@ -600,6 +600,18 @@ static int cadence_codec_get_samples(struct processing_module *mod)
return 0;
}

static int cadence_codec_deep_buff_allowed(struct processing_module *mod)
{
struct cadence_codec_data *cd = module_get_private_data(mod);

switch (cd->api_id) {
case CADENCE_CODEC_MP3_ENC_ID:
return 0;
default:
return 1;
}
}

static int cadence_codec_init_process(struct processing_module *mod)
{
int ret;
Expand Down Expand Up @@ -744,6 +756,10 @@ cadence_codec_process(struct processing_module *mod,
uint32_t remaining = input_buffers[0].size;
int ret;

if (!cadence_codec_deep_buff_allowed(mod)) {
mod->deep_buff_bytes = 0;
}

/* Proceed only if we have enough data to fill the module buffer completely */
if (input_buffers[0].size < codec->mpd.in_buff_size) {
comp_dbg(dev, "cadence_codec_process(): not enough data to process");
Expand Down

0 comments on commit 7f6d1c6

Please sign in to comment.