Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

detect_test: Do not overwrite supplied threshold #9054

Merged
merged 1 commit into from
Apr 17, 2024
Merged
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
20 changes: 13 additions & 7 deletions src/samples/audio/detect_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -836,19 +836,25 @@ static int test_keyword_params(struct comp_dev *dev,
cd->keyphrase_samples = KEYPHRASE_DEFAULT_PREAMBLE_LENGTH;
}

err = test_keyword_get_threshold(dev, params->sample_valid_bytes * 8);
if (err < 0) {
comp_err(dev, "test_keyword_params(): unsupported sample width %u",
params->sample_valid_bytes * 8);
return err;
/*
* Threshold might be already set via IPC4_DETECT_TEST_SET_CONFIG,
* otherwise apply default value.
*/
if (!cd->config.activation_threshold) {
err = test_keyword_get_threshold(dev, params->sample_valid_bytes * 8);
if (err < 0) {
comp_err(dev, "test_keyword_params(): unsupported sample width %u",
params->sample_valid_bytes * 8);
return err;
}

cd->config.activation_threshold = err;
}

#if CONFIG_AMS
cd->kpd_uuid_id = AMS_INVALID_MSG_TYPE;
#endif /* CONFIG_AMS */

cd->config.activation_threshold = err;

return 0;
}

Expand Down