OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/browser/speech/speech_recognizer_impl.h" | 5 #include "content/browser/speech/speech_recognizer_impl.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/time.h" | 9 #include "base/time.h" |
10 #include "content/browser/browser_main_loop.h" | 10 #include "content/browser/browser_main_loop.h" |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 SpeechRecognitionEventListener* listener, | 74 SpeechRecognitionEventListener* listener, |
75 int session_id, | 75 int session_id, |
76 bool is_single_shot, | 76 bool is_single_shot, |
77 SpeechRecognitionEngine* engine) | 77 SpeechRecognitionEngine* engine) |
78 : SpeechRecognizer(listener, session_id), | 78 : SpeechRecognizer(listener, session_id), |
79 recognition_engine_(engine), | 79 recognition_engine_(engine), |
80 endpointer_(kAudioSampleRate), | 80 endpointer_(kAudioSampleRate), |
81 is_dispatching_event_(false), | 81 is_dispatching_event_(false), |
82 is_single_shot_(is_single_shot), | 82 is_single_shot_(is_single_shot), |
83 state_(STATE_IDLE) { | 83 state_(STATE_IDLE) { |
84 DCHECK(this->listener() != NULL); | |
85 DCHECK(recognition_engine_ != NULL); | 84 DCHECK(recognition_engine_ != NULL); |
86 if (is_single_shot) { | 85 if (is_single_shot) { |
87 // In single shot recognition, the session is automatically ended after: | 86 // In single shot recognition, the session is automatically ended after: |
88 // - 0.5 seconds of silence if time < 3 seconds | 87 // - 0.5 seconds of silence if time < 3 seconds |
89 // - 1 seconds of silence if time >= 3 seconds | 88 // - 1 seconds of silence if time >= 3 seconds |
90 endpointer_.set_speech_input_complete_silence_length( | 89 endpointer_.set_speech_input_complete_silence_length( |
91 base::Time::kMicrosecondsPerSecond / 2); | 90 base::Time::kMicrosecondsPerSecond / 2); |
92 endpointer_.set_long_speech_input_complete_silence_length( | 91 endpointer_.set_long_speech_input_complete_silence_length( |
93 base::Time::kMicrosecondsPerSecond); | 92 base::Time::kMicrosecondsPerSecond); |
94 endpointer_.set_long_speech_length(3 * base::Time::kMicrosecondsPerSecond); | 93 endpointer_.set_long_speech_length(3 * base::Time::kMicrosecondsPerSecond); |
(...skipping 559 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
654 SpeechRecognizerImpl::FSMEventArgs::FSMEventArgs(FSMEvent event_value) | 653 SpeechRecognizerImpl::FSMEventArgs::FSMEventArgs(FSMEvent event_value) |
655 : event(event_value), | 654 : event(event_value), |
656 audio_data(NULL), | 655 audio_data(NULL), |
657 engine_error(SPEECH_RECOGNITION_ERROR_NONE) { | 656 engine_error(SPEECH_RECOGNITION_ERROR_NONE) { |
658 } | 657 } |
659 | 658 |
660 SpeechRecognizerImpl::FSMEventArgs::~FSMEventArgs() { | 659 SpeechRecognizerImpl::FSMEventArgs::~FSMEventArgs() { |
661 } | 660 } |
662 | 661 |
663 } // namespace content | 662 } // namespace content |
OLD | NEW |