Skip to content

Commit

Permalink
detect_test: Do not overwrite supplied threshold
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
serhiy-katsyuba-intel authored and kv2019i committed Apr 17, 2024
1 parent c77a4fe commit 784da54
Showing 1 changed file with 13 additions and 7 deletions.
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

0 comments on commit 784da54

Please sign in to comment.