Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(257)

Unified Diff: content/browser/speech/speech_recognizer_impl.cc

Issue 137853010: Speech recognition: Fixing erroneous DCHECK usage (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed review comments Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/browser/speech/speech_recognizer_impl.cc
diff --git a/content/browser/speech/speech_recognizer_impl.cc b/content/browser/speech/speech_recognizer_impl.cc
index ecd24ab9d87ebb4787a37f0256832c6e4e86ce8f..af28c46331f50cca2a81780bcf162c88fd438234 100644
--- a/content/browser/speech/speech_recognizer_impl.cc
+++ b/content/browser/speech/speech_recognizer_impl.cc
@@ -173,17 +173,19 @@ double SpeechRecognizerImpl::OnDataConverter::ProvideInput(
SpeechRecognizerImpl::SpeechRecognizerImpl(
SpeechRecognitionEventListener* listener,
int session_id,
- bool is_single_shot,
+ bool continuous,
+ bool provisional_results,
SpeechRecognitionEngine* engine)
: SpeechRecognizer(listener, session_id),
recognition_engine_(engine),
endpointer_(kAudioSampleRate),
is_dispatching_event_(false),
- is_single_shot_(is_single_shot),
+ provisional_results_(provisional_results),
state_(STATE_IDLE) {
DCHECK(recognition_engine_ != NULL);
- if (is_single_shot) {
- // In single shot recognition, the session is automatically ended after:
+ if (!continuous) {
+ // In single shot (non-continous) recognition,
+ // the session is automatically ended after:
// - 0.5 seconds of silence if time < 3 seconds
// - 1 seconds of silence if time >= 3 seconds
endpointer_.set_speech_input_complete_silence_length(
@@ -685,10 +687,8 @@ SpeechRecognizerImpl::FSMState SpeechRecognizerImpl::Abort(
SpeechRecognizerImpl::FSMState SpeechRecognizerImpl::ProcessIntermediateResult(
const FSMEventArgs& event_args) {
- // Provisional results can occur only during continuous (non one-shot) mode.
- // 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_);
+ // Provisional results can occur only if explicitly enabled in the JS API.
+ DCHECK(provisional_results_);
// In continuous recognition, intermediate results can occur even when we are
// in the ESTIMATING_ENVIRONMENT or WAITING_FOR_SPEECH states (if the
@@ -718,8 +718,8 @@ SpeechRecognizerImpl::ProcessFinalResult(const FSMEventArgs& event_args) {
for (; i != results.end(); ++i) {
const SpeechRecognitionResult& result = *i;
if (result.is_provisional) {
+ DCHECK(provisional_results_);
provisional_results_pending = true;
- DCHECK(!is_single_shot_);
} else if (results_are_empty) {
results_are_empty = result.hypotheses.empty();
}
« no previous file with comments | « content/browser/speech/speech_recognizer_impl.h ('k') | content/browser/speech/speech_recognizer_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698