Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 26 additions & 11 deletions src/audio/asrc/asrc.c
Original file line number Diff line number Diff line change
Expand Up @@ -315,15 +315,25 @@ static void asrc_release_buffers(struct processing_module *mod, struct asrc_farr
static int asrc_free(struct processing_module *mod)
{
struct comp_data *cd = module_get_private_data(mod);
struct comp_dev *dev = mod->dev;

comp_dbg(dev, "entry");
comp_info(mod->dev, "asrc_free() entry");
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

we have removed all function names from all logging on purpose, let's not start re-adding them. Function names are printed automatically by Zephyr.


if (!cd)
return 0;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

can it be called with cd == NULL? Don't think so, .free() is probably only called when .init() was successful


mod_free(mod, cd->buf);
asrc_release_buffers(mod, cd->asrc_obj);
asrc_free_polyphase_filter(mod, cd->asrc_obj);
mod_free(mod, cd->asrc_obj);
cd->buf = NULL;

if (cd->asrc_obj) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

same, can it be NULL here?

asrc_release_buffers(mod, cd->asrc_obj);
asrc_free_polyphase_filter(mod, cd->asrc_obj);
mod_free(mod, cd->asrc_obj);
cd->asrc_obj = NULL;
}

mod_free(mod, cd);
module_set_private_data(mod, NULL);

return 0;
}

Expand Down Expand Up @@ -862,12 +872,17 @@ static int asrc_reset(struct processing_module *mod)
asrc_dai_stop_timestamp(cd);

/* Free the allocations those were done in prepare() */
asrc_release_buffers(mod, cd->asrc_obj);
asrc_free_polyphase_filter(mod, cd->asrc_obj);
mod_free(mod, cd->asrc_obj);
mod_free(mod, cd->buf);
cd->asrc_obj = NULL;
cd->buf = NULL;
if (cd->asrc_obj) {
asrc_release_buffers(mod, cd->asrc_obj);
asrc_free_polyphase_filter(mod, cd->asrc_obj);
mod_free(mod, cd->asrc_obj);
cd->asrc_obj = NULL;
}

if (cd->buf) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

same for the above 2 added checks

mod_free(mod, cd->buf);
cd->buf = NULL;
}

return 0;
}
Expand Down
4 changes: 4 additions & 0 deletions src/audio/mfcc/mfcc_setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,10 @@ int mfcc_setup(struct processing_module *mod, int max_frames, int sample_rate, i
state->emph.coef = -config->preemphasis_coefficient; /* Negate config parameter */
fft->fft_size = config->frame_length;
fft->fft_padded_size = 1 << (31 - norm_int32(fft->fft_size)); /* Round up to nearest 2^N */
if (config->frame_shift <= 0) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

can this be hit in real pipelines or only in ztests?

comp_err(dev, "frame_shift must be positive");
return -EINVAL;
}
Comment on lines 156 to +161
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@singalsu fyi - these came up as crashes during the ztest UT as it was passing in zeros for stuff it did not know about. Will get this fixed.

fft->fft_hop_size = config->frame_shift;
fft->half_fft_size = (fft->fft_padded_size >> 1) + 1;

Expand Down
8 changes: 8 additions & 0 deletions src/audio/mic_privacy_manager/mic_privacy_manager_intel.c
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,11 @@ int mic_privacy_manager_init(void)
if (!mic_priv_dev)
return -EINVAL;

if (!device_is_ready(mic_priv_dev)) {
LOG_ERR("mic_privacy device not ready");
return -ENODEV;
}
Comment on lines +98 to +101
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This is a valid concern. Maybe alternative is to drop mic privacy when running the ztest?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

probably want to drop it for native_sim, but for qemu ACE its a doable test - the funny thing is copilot is reviewing itself here for this change.


mic_privacy_api = (struct mic_privacy_api_funcs *)mic_priv_dev->api;
mic_privacy_policy = mic_privacy_api->get_policy();

Expand All @@ -109,6 +114,9 @@ int mic_privacy_manager_init(void)

int mic_privacy_manager_get_policy(void)
{
if (!mic_priv_dev)
return MIC_PRIVACY_HW_MANAGED;

mic_privacy_api = (struct mic_privacy_api_funcs *)mic_priv_dev->api;

return mic_privacy_api->get_policy();
Expand Down
Loading