Skip to content

Commit

Permalink
[M115 merge] libassistan-v2: Temporary fix speaker id enrollment
Browse files Browse the repository at this point in the history
In LibAssistant V2, the `kProcessState` is not received by the gRPC
client. As a temporary fix, we can use `kRecognizeState` to indicate
that the utterance is recognized and will be collected. During my tests,
the `kRecognizeState` is always followed by `kProcessState`, but cannot
rule out the possibility the utterance is not collected. But I think it
is reasonable to use `kRecognizeState` as a backup.
We will continue investigating why the `kProcessState` is not sent to
the client in b/284987346.

(cherry picked from commit df71c2d)

Bug: b:284110354
Test: manual test on DUT.
Change-Id: I3775e2f0d42734cb2b6a0970fc5e3c3e0b0c3f04
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4569094
Reviewed-by: Eric Sum <esum@google.com>
Reviewed-by: Xiaohui Chen <xiaohuic@chromium.org>
Commit-Queue: Tao Wu <wutao@chromium.org>
Cr-Original-Commit-Position: refs/heads/main@{#1150909}
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4582624
Cr-Commit-Position: refs/branch-heads/5790@{#283}
Cr-Branched-From: 1d71a33-refs/heads/main@{#1148114}
  • Loading branch information
Tao Wu authored and Chromium LUCI CQ committed Jun 2, 2023
1 parent 3b985e5 commit 446efdc
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
Expand Up @@ -6,6 +6,7 @@

#include "base/memory/raw_ptr.h"
#include "base/scoped_observation.h"
#include "chromeos/ash/services/assistant/public/cpp/features.h"
#include "chromeos/ash/services/libassistant/grpc/assistant_client.h"
#include "chromeos/ash/services/libassistant/grpc/external_services/grpc_services_observer.h"
#include "chromeos/ash/services/libassistant/public/mojom/audio_input_controller.mojom.h"
Expand Down Expand Up @@ -109,9 +110,20 @@ class SpeakerIdEnrollmentController::EnrollmentSession
VLOG(1) << "Assistant: Speaker id enrollment is listening";
client_->OnListeningHotword();
break;
case SpeakerIdEnrollmentEvent::kRecognizeState:
VLOG(1) << "Assistant: Speaker id enrollment is recognized";
// TODO(b/284987346): This is a workaround for LibAssistant V2, the
// `kProcessState` event is not received. Here we use `kRecognizeState`
// as an indicator.
if (assistant::features::IsLibAssistantV2Enabled()) {
client_->OnProcessingHotword();
}
break;
case SpeakerIdEnrollmentEvent::kProcessState:
VLOG(1) << "Assistant: Speaker id enrollment is processing";
client_->OnProcessingHotword();
if (!assistant::features::IsLibAssistantV2Enabled()) {
client_->OnProcessingHotword();
}
break;
case SpeakerIdEnrollmentEvent::kDoneState:
VLOG(1) << "Assistant: Speaker id enrollment is done";
Expand All @@ -125,7 +137,6 @@ class SpeakerIdEnrollmentController::EnrollmentSession
break;
case SpeakerIdEnrollmentEvent::kInitState:
case SpeakerIdEnrollmentEvent::kCheckState:
case SpeakerIdEnrollmentEvent::kRecognizeState:
case SpeakerIdEnrollmentEvent::kUploadState:
case SpeakerIdEnrollmentEvent::kFetchState:
case SpeakerIdEnrollmentEvent::TYPE_NOT_SET:
Expand Down
Expand Up @@ -110,7 +110,11 @@ class AssistantSpeakerIdEnrollmentControllerTest : public ::testing::Test {
break;
}
case ::assistant_client::SpeakerIdEnrollmentUpdate::State::PROCESS: {
event->mutable_process_state();
if (assistant::features::IsLibAssistantV2Enabled()) {
event->mutable_recognize_state();
} else {
event->mutable_process_state();
}
break;
}
case ::assistant_client::SpeakerIdEnrollmentUpdate::State::UPLOAD: {
Expand Down

0 comments on commit 446efdc

Please sign in to comment.