OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #ifndef CONTENT_BROWSER_SPEECH_SPEECH_RECOGNIZER_H_ | 5 #ifndef CONTENT_BROWSER_SPEECH_SPEECH_RECOGNIZER_H_ |
6 #define CONTENT_BROWSER_SPEECH_SPEECH_RECOGNIZER_H_ | 6 #define CONTENT_BROWSER_SPEECH_SPEECH_RECOGNIZER_H_ |
7 | 7 |
8 #include <list> | 8 #include <list> |
9 #include <string> | 9 #include <string> |
10 #include <utility> | 10 #include <utility> |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 const SpeechInputResultArray& result); | 107 const SpeechInputResultArray& result); |
108 | 108 |
109 static const int kAudioSampleRate; | 109 static const int kAudioSampleRate; |
110 static const int kAudioPacketIntervalMs; // Duration of each audio packet. | 110 static const int kAudioPacketIntervalMs; // Duration of each audio packet. |
111 static const int kNumAudioChannels; | 111 static const int kNumAudioChannels; |
112 static const int kNumBitsPerAudioSample; | 112 static const int kNumBitsPerAudioSample; |
113 static const int kNoSpeechTimeoutSec; | 113 static const int kNoSpeechTimeoutSec; |
114 static const int kEndpointerEstimationTimeMs; | 114 static const int kEndpointerEstimationTimeMs; |
115 | 115 |
116 private: | 116 private: |
117 void ReleaseAudioBuffers(); | |
118 void InformErrorAndCancelRecognition(ErrorCode error); | 117 void InformErrorAndCancelRecognition(ErrorCode error); |
119 void SendRecordedAudioToServer(); | 118 void SendRecordedAudioToServer(); |
120 | 119 |
121 void HandleOnError(int error_code); // Handles OnError in the IO thread. | 120 void HandleOnError(int error_code); // Handles OnError in the IO thread. |
122 | 121 |
123 // Handles OnData in the IO thread. Takes ownership of |data|. | 122 // Handles OnData in the IO thread. Takes ownership of |data|. |
124 void HandleOnData(std::string* data); | 123 void HandleOnData(std::string* data); |
125 | 124 |
126 Delegate* delegate_; | 125 Delegate* delegate_; |
127 int caller_id_; | 126 int caller_id_; |
(...skipping 15 matching lines...) Expand all Loading... |
143 | 142 |
144 // This typedef is to workaround the issue with certain versions of | 143 // This typedef is to workaround the issue with certain versions of |
145 // Visual Studio where it gets confused between multiple Delegate | 144 // Visual Studio where it gets confused between multiple Delegate |
146 // classes and gives a C2500 error. (I saw this error on the try bots - | 145 // classes and gives a C2500 error. (I saw this error on the try bots - |
147 // the workaround was not needed for my machine). | 146 // the workaround was not needed for my machine). |
148 typedef SpeechRecognizer::Delegate SpeechRecognizerDelegate; | 147 typedef SpeechRecognizer::Delegate SpeechRecognizerDelegate; |
149 | 148 |
150 } // namespace speech_input | 149 } // namespace speech_input |
151 | 150 |
152 #endif // CONTENT_BROWSER_SPEECH_SPEECH_RECOGNIZER_H_ | 151 #endif // CONTENT_BROWSER_SPEECH_SPEECH_RECOGNIZER_H_ |
OLD | NEW |