| 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..1e3061a6e1d64ec545c4523b2b540a0b884a3313 100644
|
| --- a/content/browser/speech/speech_recognizer.h
|
| +++ b/content/browser/speech/speech_recognizer.h
|
| @@ -30,21 +30,12 @@ class CONTENT_EXPORT SpeechRecognizer
|
| public media::AudioInputController::EventHandler,
|
| public SpeechRecognitionRequestDelegate {
|
| public:
|
| - enum ErrorCode {
|
| - RECOGNIZER_NO_ERROR,
|
| - RECOGNIZER_ERROR_CAPTURE,
|
| - RECOGNIZER_ERROR_NO_SPEECH,
|
| - RECOGNIZER_ERROR_NO_RESULTS,
|
| - RECOGNIZER_ERROR_NETWORK,
|
| - };
|
| -
|
| // Implemented by the caller to receive recognition events.
|
| class CONTENT_EXPORT Delegate {
|
| public:
|
| 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,12 +51,18 @@ 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 speech.
|
| + virtual void DidStartReceivingSpeech(int caller_id) = 0;
|
| +
|
| + // Informs that the end pointer has stopped detecting speech.
|
| + virtual void DidStopReceivingSpeech(int caller_id) = 0;
|
| +
|
| // 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
|
| // |SpeechRecognizer| object while processing this call.
|
| virtual void OnRecognizerError(int caller_id,
|
| - SpeechRecognizer::ErrorCode error) = 0;
|
| + SpeechInputError error) = 0;
|
|
|
| // At the start of recognition, a short amount of audio is recorded to
|
| // estimate the environment/background noise and this callback is issued
|
| @@ -91,6 +88,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
|
| @@ -115,8 +113,7 @@ class CONTENT_EXPORT SpeechRecognizer
|
| uint32 size);
|
|
|
| // SpeechRecognitionRequest::Delegate methods.
|
| - virtual void SetRecognitionResult(bool error,
|
| - const SpeechInputResultArray& result);
|
| + virtual void SetRecognitionResult(const SpeechInputResult& result);
|
|
|
| static const int kAudioSampleRate;
|
| static const int kAudioPacketIntervalMs; // Duration of each audio packet.
|
| @@ -126,7 +123,7 @@ class CONTENT_EXPORT SpeechRecognizer
|
| static const int kEndpointerEstimationTimeMs;
|
|
|
| private:
|
| - void InformErrorAndCancelRecognition(ErrorCode error);
|
| + void InformErrorAndCancelRecognition(SpeechInputError error);
|
| void SendRecordedAudioToServer();
|
|
|
| void HandleOnError(int error_code); // Handles OnError in the IO thread.
|
|
|