summaryrefslogtreecommitdiffstats
path: root/content/browser/speech/speech_recognizer_impl.cc
diff options
context:
space:
mode:
authorprimiano@chromium.org <primiano@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-07 11:01:02 +0000
committerprimiano@chromium.org <primiano@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-07 11:01:02 +0000
commitc52b28964090204b87634b396823c3709855079c (patch)
tree1e8e20c58dd735baa7f8312dc115fff224e4e5cd /content/browser/speech/speech_recognizer_impl.cc
parent9104f7e80f0bd0c2353254ec5c354199d965f44d (diff)
downloadchromium_src-c52b28964090204b87634b396823c3709855079c.zip
chromium_src-c52b28964090204b87634b396823c3709855079c.tar.gz
chromium_src-c52b28964090204b87634b396823c3709855079c.tar.bz2
Renamed speech recognition code in preparation for introducing a new speech implementation.
- The general-purpose speech recognition classes (that will be needed also by future code) have been renamed to SpeechRecognition*; - The IPC Messages and dispatcher(host) classes that are only related to the current input tag (x-webkit-speech) support have been renamed to InputTagSpeech*; - The namespace has been renamed from speech_input to speech; BUG=116954 TEST= Review URL: https://chromiumcodereview.appspot.com/9568002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@125378 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser/speech/speech_recognizer_impl.cc')
-rw-r--r--content/browser/speech/speech_recognizer_impl.cc21
1 files changed, 11 insertions, 10 deletions
diff --git a/content/browser/speech/speech_recognizer_impl.cc b/content/browser/speech/speech_recognizer_impl.cc
index 9d4ed1c..bbcfbd2 100644
--- a/content/browser/speech/speech_recognizer_impl.cc
+++ b/content/browser/speech/speech_recognizer_impl.cc
@@ -9,7 +9,7 @@
#include "content/browser/browser_main_loop.h"
#include "content/public/browser/speech_recognizer_delegate.h"
#include "content/public/browser/browser_thread.h"
-#include "content/public/common/speech_input_result.h"
+#include "content/public/common/speech_recognition_result.h"
#include "net/url_request/url_request_context_getter.h"
using content::BrowserMainLoop;
@@ -61,12 +61,12 @@ SpeechRecognizer* SpeechRecognizer::Create(
bool filter_profanities,
const std::string& hardware_info,
const std::string& origin_url) {
- return new speech_input::SpeechRecognizerImpl(
+ return new speech::SpeechRecognizerImpl(
delegate, caller_id, language, grammar, context_getter,
filter_profanities, hardware_info, origin_url);
}
-namespace speech_input {
+namespace speech {
const int SpeechRecognizerImpl::kAudioSampleRate = 16000;
const int SpeechRecognizerImpl::kAudioPacketIntervalMs = 100;
@@ -208,7 +208,7 @@ void SpeechRecognizerImpl::HandleOnError(int error_code) {
if (!audio_controller_.get())
return;
- InformErrorAndCancelRecognition(content::SPEECH_INPUT_ERROR_AUDIO);
+ InformErrorAndCancelRecognition(content::SPEECH_RECOGNITION_ERROR_AUDIO);
}
void SpeechRecognizerImpl::OnData(AudioInputController* controller,
@@ -272,7 +272,8 @@ void SpeechRecognizerImpl::HandleOnData(string* data) {
bool speech_was_heard_after_packet = endpointer_.DidStartReceivingSpeech();
if (!speech_was_heard_after_packet &&
num_samples_recorded_ >= kNoSpeechTimeoutSec * kAudioSampleRate) {
- InformErrorAndCancelRecognition(content::SPEECH_INPUT_ERROR_NO_SPEECH);
+ InformErrorAndCancelRecognition(
+ content::SPEECH_RECOGNITION_ERROR_NO_SPEECH);
return;
}
@@ -303,8 +304,8 @@ void SpeechRecognizerImpl::HandleOnData(string* data) {
}
void SpeechRecognizerImpl::SetRecognitionResult(
- const content::SpeechInputResult& result) {
- if (result.error != content::SPEECH_INPUT_ERROR_NONE) {
+ const content::SpeechRecognitionResult& result) {
+ if (result.error != content::SPEECH_RECOGNITION_ERROR_NONE) {
InformErrorAndCancelRecognition(result.error);
return;
}
@@ -316,8 +317,8 @@ void SpeechRecognizerImpl::SetRecognitionResult(
}
void SpeechRecognizerImpl::InformErrorAndCancelRecognition(
- content::SpeechInputError error) {
- DCHECK_NE(error, content::SPEECH_INPUT_ERROR_NONE);
+ content::SpeechRecognitionErrorCode error) {
+ DCHECK_NE(error, content::SPEECH_RECOGNITION_ERROR_NONE);
CancelRecognition();
// Guard against the delegate freeing us until we finish our job.
@@ -343,4 +344,4 @@ void SpeechRecognizerImpl::SetAudioManagerForTesting(
audio_manager_ = audio_manager;
}
-} // namespace speech_input
+} // namespace speech