summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHsin-Yu Chao <hychao@chromium.org>2021-03-17 06:59:29 +0000
committerCommit Bot <commit-bot@chromium.org>2021-03-17 12:56:29 +0000
commit2763f392df683537d71ba7f258009e592647f6d8 (patch)
treed75f929229ffc2bb208f0dc0235060e85bfe873f
parent92556766caa86808b7f60ae2bf7000ffc39c702a (diff)
downloadadhd-2763f392df683537d71ba7f258009e592647f6d8.tar.gz
CRAS: apm_list - Adopt dev/stream gain if no tuned settings provided
When deploying generic APM to models without tuned settings given, we should still apply the gain configured by intrinsic sensitivity and stream gain. BUG=b:181818480 TEST=Test online voice recorder on 'barla' device. Verify the recorded volume is higher as usual. Change-Id: Ib4ddbce3dc23b9dbc8238c5969970a238c37d232 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/adhd/+/2766563 Reviewed-by: Cheng-Yi Chiang <cychiang@chromium.org> Commit-Queue: Hsinyu Chao <hychao@chromium.org> Tested-by: Hsinyu Chao <hychao@chromium.org>
-rw-r--r--cras/src/server/cras_apm_list.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/cras/src/server/cras_apm_list.c b/cras/src/server/cras_apm_list.c
index 264bc85e..ab891137 100644
--- a/cras/src/server/cras_apm_list.c
+++ b/cras/src/server/cras_apm_list.c
@@ -61,9 +61,10 @@
* stream.
* work_queue - A task queue instance created and destroyed by
* libwebrtc_apm.
- * use_tuned_settings - True if this APM uses settings tuned specifically
- * for this hardware in AEC use case. Otherwise it uses the generic
- * settings like run inside browser.
+ * is_aec_use_case - True if the input and output devices pair is in the
+ * typical AEC use case. This flag decides whether to use settings
+ * tuned specifically for this hardware if exists. Otherwise it uses
+ * the generic settings like run inside browser.
*/
struct cras_apm {
webrtc_apm apm_ptr;
@@ -74,7 +75,7 @@ struct cras_apm {
struct cras_audio_format fmt;
struct cras_audio_area *area;
void *work_queue;
- bool use_tuned_settings;
+ bool is_aec_use_case;
struct cras_apm *prev, *next;
};
@@ -289,16 +290,16 @@ struct cras_apm *cras_apm_list_add_apm(struct cras_apm_list *list,
/* Use tuned settings only when the forward dev(capture) and reverse
* dev(playback) both are in typical AEC use case. */
- apm->use_tuned_settings = is_aec_use_case;
+ apm->is_aec_use_case = is_aec_use_case;
if (rmodule->odev) {
- apm->use_tuned_settings &=
+ apm->is_aec_use_case &=
cras_iodev_is_aec_use_case(rmodule->odev->active_node);
}
/* Use the configs tuned specifically for internal device. Otherwise
* just pass NULL so every other settings will be default. */
apm->apm_ptr =
- apm->use_tuned_settings ?
+ apm->is_aec_use_case ?
webrtc_apm_create(apm->fmt.num_channels,
apm->fmt.frame_rate, aec_ini,
apm_ini) :
@@ -690,7 +691,9 @@ struct cras_audio_format *cras_apm_list_get_format(struct cras_apm *apm)
bool cras_apm_list_get_use_tuned_settings(struct cras_apm *apm)
{
- return apm->use_tuned_settings;
+ /* If input and output devices in AEC use case, plus that a
+ * tuned setting is provided. */
+ return apm->is_aec_use_case && (aec_ini || apm_ini);
}
void cras_apm_list_set_aec_dump(struct cras_apm_list *list, void *dev_ptr,