detect_test: Do not overwrite supplied threshold

Default threshold should be applied only if it was not already set
via IPC4_DETECT_TEST_SET_CONFIG call.

Signed-off-by: Serhiy Katsyuba <serhiy.katsyuba@intel.com>
This commit is contained in:
Serhiy Katsyuba 2024-04-16 17:03:02 +02:00 committed by Kai Vehmanen
parent c77a4feb2f
commit 784da5468e
1 changed files with 13 additions and 7 deletions

View File

@ -836,6 +836,11 @@ static int test_keyword_params(struct comp_dev *dev,
cd->keyphrase_samples = KEYPHRASE_DEFAULT_PREAMBLE_LENGTH; cd->keyphrase_samples = KEYPHRASE_DEFAULT_PREAMBLE_LENGTH;
} }
/*
* 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); err = test_keyword_get_threshold(dev, params->sample_valid_bytes * 8);
if (err < 0) { if (err < 0) {
comp_err(dev, "test_keyword_params(): unsupported sample width %u", comp_err(dev, "test_keyword_params(): unsupported sample width %u",
@ -843,12 +848,13 @@ static int test_keyword_params(struct comp_dev *dev,
return err; return err;
} }
cd->config.activation_threshold = err;
}
#if CONFIG_AMS #if CONFIG_AMS
cd->kpd_uuid_id = AMS_INVALID_MSG_TYPE; cd->kpd_uuid_id = AMS_INVALID_MSG_TYPE;
#endif /* CONFIG_AMS */ #endif /* CONFIG_AMS */
cd->config.activation_threshold = err;
return 0; return 0;
} }