summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorprimiano@chromium.org <primiano@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-27 12:11:14 +0000
committerprimiano@chromium.org <primiano@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-27 12:11:14 +0000
commite08b22179f8274c4f9674831a46617177282090a (patch)
tree426b2979c65ac968ad5f738fd47daf5972b34563
parent236ead5e35b93ff9c1e48d61d5545124af9fe83b (diff)
downloadchromium_src-e08b22179f8274c4f9674831a46617177282090a.zip
chromium_src-e08b22179f8274c4f9674831a46617177282090a.tar.gz
chromium_src-e08b22179f8274c4f9674831a46617177282090a.tar.bz2
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
-rw-r--r--content/browser/speech/speech_recognizer.cc18
1 files changed, 17 insertions, 1 deletions
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