From e08b22179f8274c4f9674831a46617177282090a Mon Sep 17 00:00:00 2001 From: "primiano@chromium.org" Date: Wed, 27 Jun 2012 12:11:14 +0000 Subject: Fast-forwarding the endpointer when a result is received in continuous recognition. (Speech CL2.4) This is done in order to avoid NO_SPEECH errors in the (very rare) case in which the endpointer did not pass the noise threshold but the recognition engine (that always receives audio, regardless the state of the endpointer) provides an intermedia result. BUG=116954 TEST=none Review URL: https://chromiumcodereview.appspot.com/10537142 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@144440 0039d316-1c4b-4281-b951-d872f2087c98 --- content/browser/speech/speech_recognizer.cc | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/content/browser/speech/speech_recognizer.cc b/content/browser/speech/speech_recognizer.cc index 69f22ab..806aa7b 100644 --- a/content/browser/speech/speech_recognizer.cc +++ b/content/browser/speech/speech_recognizer.cc @@ -541,9 +541,25 @@ SpeechRecognizer::FSMState SpeechRecognizer::ProcessIntermediateResult( // If this check is reached it means that a continuous speech recognition // engine is being used for a one shot recognition. DCHECK_EQ(false, is_single_shot_); + + // In continuous recognition, intermediate results can occur even when we are + // in the ESTIMATING_ENVIRONMENT or WAITING_FOR_SPEECH states (if the + // recognition engine is "faster" than our endpointer). In these cases we + // skip the endpointer and fast-forward to the RECOGNIZING state, with respect + // of the events triggering order. + if (state_ == STATE_ESTIMATING_ENVIRONMENT) { + DCHECK(endpointer_.IsEstimatingEnvironment()); + endpointer_.SetUserInputMode(); + listener_->OnEnvironmentEstimationComplete(session_id_); + } else if (state_ == STATE_WAITING_FOR_SPEECH) { + listener_->OnSoundStart(session_id_); + } else { + DCHECK_EQ(STATE_RECOGNIZING, state_); + } + const SpeechRecognitionResult& result = event_args.engine_result; listener_->OnRecognitionResult(session_id_, result); - return state_; + return STATE_RECOGNIZING; } SpeechRecognizer::FSMState -- cgit v1.1