Chromium Code Reviews| Index: content/browser/speech/speech_recognizer.h |
| diff --git a/content/browser/speech/speech_recognizer.h b/content/browser/speech/speech_recognizer.h |
| index bd1c8e4112038c073c55ebfe6da42d92b8d2acfb..72196d7e08780513799ef0793702be17a0a16ea3 100644 |
| --- a/content/browser/speech/speech_recognizer.h |
| +++ b/content/browser/speech/speech_recognizer.h |
| @@ -36,6 +36,8 @@ class CONTENT_EXPORT SpeechRecognizer |
| RECOGNIZER_ERROR_NO_SPEECH, |
| RECOGNIZER_ERROR_NO_RESULTS, |
| RECOGNIZER_ERROR_NETWORK, |
| + RECOGNIZER_ERROR_INVALID_PARAMS, |
| + RECOGNIZER_ERROR_INTERNAL, |
|
Satish
2011/10/04 20:36:33
since this is related to the protocol/parse error,
Leandro Graciá Gil
2011/10/05 22:09:00
I'll go for network error as it's an un expected v
|
| }; |
| // Implemented by the caller to receive recognition events. |
| @@ -44,7 +46,7 @@ class CONTENT_EXPORT SpeechRecognizer |
| virtual void SetRecognitionResult( |
| int caller_id, |
| bool error, |
| - const SpeechInputResultArray& result) = 0; |
| + const SpeechInputResult& result) = 0; |
| // Invoked when the first audio packet was received from the audio capture |
| // device. |
| @@ -60,6 +62,15 @@ class CONTENT_EXPORT SpeechRecognizer |
| // sequence and the |SpeechRecognizer| object can be freed up if necessary. |
| virtual void DidCompleteRecognition(int caller_id) = 0; |
| + // Informs that the end pointer has started detecting input speech. |
| + virtual void DidSpeechInputStart(int caller_id) = 0; |
|
Satish
2011/10/04 20:36:33
this would be clearer if renamed as DidStartReceiv
Leandro Graciá Gil
2011/10/05 22:09:00
Done.
|
| + |
| + // Informs that the end pointer has stopped detecting input speech. |
| + virtual void DidSpeechInputStop(int caller_id) = 0; |
| + |
| + // Invoked when the recording is actually started. |
| + virtual void OnRecording(int caller_id) = 0; |
|
Satish
2011/10/04 20:36:33
any reason why we need this when we have DidStartR
Leandro Graciá Gil
2011/10/05 22:09:00
Fixed. Now using only DidStartReceivingAudio after
|
| + |
| // Invoked if there was an error while recording or recognizing audio. The |
| // session has already been cancelled when this call is made and the DidXxxx |
| // callbacks will not be issued. It is safe to destroy/release the |
| @@ -91,6 +102,7 @@ class CONTENT_EXPORT SpeechRecognizer |
| bool censor_results, |
| const std::string& hardware_info, |
| const std::string& origin_url); |
| + |
| virtual ~SpeechRecognizer(); |
| // Starts audio recording and does recognition after recording ends. The same |
| @@ -108,7 +120,7 @@ class CONTENT_EXPORT SpeechRecognizer |
| // AudioInputController::EventHandler methods. |
| virtual void OnCreated(media::AudioInputController* controller) { } |
| - virtual void OnRecording(media::AudioInputController* controller) { } |
| + virtual void OnRecording(media::AudioInputController* controller); |
| virtual void OnError(media::AudioInputController* controller, int error_code); |
| virtual void OnData(media::AudioInputController* controller, |
| const uint8* data, |
| @@ -116,7 +128,7 @@ class CONTENT_EXPORT SpeechRecognizer |
| // SpeechRecognitionRequest::Delegate methods. |
| virtual void SetRecognitionResult(bool error, |
| - const SpeechInputResultArray& result); |
| + const SpeechInputResult& result); |
| static const int kAudioSampleRate; |
| static const int kAudioPacketIntervalMs; // Duration of each audio packet. |
| @@ -129,6 +141,7 @@ class CONTENT_EXPORT SpeechRecognizer |
| void InformErrorAndCancelRecognition(ErrorCode error); |
| void SendRecordedAudioToServer(); |
| + void HandleOnRecording(); // Handles OnRecording in the IO thread. |
| void HandleOnError(int error_code); // Handles OnError in the IO thread. |
| // Handles OnData in the IO thread. Takes ownership of |data|. |