Commit 90097ef0 authored by Meilin Wang's avatar Meilin Wang Committed by Commit Bot

Use "en_all" hotword model for dsp device with locales "en_*".

This change updates the logic for setting DSP model based on different locales.
See the linked bug for more details.

Bug: b/134125220
Test: local compile and manually test.
Change-Id: If4f33cf038f373853e8a9ff3b0fa1b3885320d8c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1648832
Commit-Queue: Meilin Wang <meilinw@chromium.org>
Reviewed-by: default avatarXiaohui Chen <xiaohuic@chromium.org>
Cr-Commit-Position: refs/heads/master@{#681415}
parent e125765a
......@@ -8,6 +8,7 @@
#include "base/logging.h"
#include "base/metrics/histogram_functions.h"
#include "base/stl_util.h"
#include "base/strings/string_util.h"
#include "base/timer/timer.h"
#include "chromeos/audio/cras_audio_handler.h"
#include "chromeos/dbus/power/power_manager_client.h"
......@@ -388,6 +389,13 @@ void AudioInputImpl::SetDspHotwordLocale(std::string pref_locale) {
std::string region_code = pref_locale;
pref_locale.append("_").append(region_code);
}
// For locales with language code "en", use "en_all" hotword model.
std::vector<std::string> code_strings = base::SplitString(
pref_locale, "_", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL);
if (code_strings.size() > 0 && code_strings[0] == "en")
pref_locale = "en_all";
uint64_t dsp_node_id;
base::StringToUint64(hotword_device_id_, &dsp_node_id);
chromeos::CrasAudioHandler::Get()->SetHotwordModel(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment