Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(13)

Side by Side Diff: content/browser/speech/speech_recognizer_impl.h

Issue 2785463005: Removing AudioSystem::GetAudioManager() usage from speech recognition (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 #ifndef CONTENT_BROWSER_SPEECH_SPEECH_RECOGNIZER_IMPL_H_ 5 #ifndef CONTENT_BROWSER_SPEECH_SPEECH_RECOGNIZER_IMPL_H_
6 #define CONTENT_BROWSER_SPEECH_SPEECH_RECOGNIZER_IMPL_H_ 6 #define CONTENT_BROWSER_SPEECH_SPEECH_RECOGNIZER_IMPL_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 10
(...skipping 25 matching lines...) Expand all
36 public media::AudioInputController::EventHandler, 36 public media::AudioInputController::EventHandler,
37 public media::AudioInputController::SyncWriter, 37 public media::AudioInputController::SyncWriter,
38 public NON_EXPORTED_BASE(SpeechRecognitionEngine::Delegate) { 38 public NON_EXPORTED_BASE(SpeechRecognitionEngine::Delegate) {
39 public: 39 public:
40 static const int kAudioSampleRate; 40 static const int kAudioSampleRate;
41 static const media::ChannelLayout kChannelLayout; 41 static const media::ChannelLayout kChannelLayout;
42 static const int kNumBitsPerAudioSample; 42 static const int kNumBitsPerAudioSample;
43 static const int kNoSpeechTimeoutMs; 43 static const int kNoSpeechTimeoutMs;
44 static const int kEndpointerEstimationTimeMs; 44 static const int kEndpointerEstimationTimeMs;
45 45
46 static void SetAudioSystemForTesting(media::AudioSystem* audio_system); 46 static void SetAudioEnvironmentForTesting(media::AudioSystem* audio_system,
47 media::AudioManager* audio_manager);
47 48
48 SpeechRecognizerImpl(SpeechRecognitionEventListener* listener, 49 SpeechRecognizerImpl(SpeechRecognitionEventListener* listener,
49 media::AudioSystem* audio_system, 50 media::AudioSystem* audio_system,
51 media::AudioManager* audio_manager,
50 int session_id, 52 int session_id,
51 bool continuous, 53 bool continuous,
52 bool provisional_results, 54 bool provisional_results,
53 SpeechRecognitionEngine* engine); 55 SpeechRecognitionEngine* engine);
54 56
55 void StartRecognition(const std::string& device_id) override; 57 void StartRecognition(const std::string& device_id) override;
56 void AbortRecognition() override; 58 void AbortRecognition() override;
57 void StopAudioCapture() override; 59 void StopAudioCapture() override;
58 bool IsActive() const override; 60 bool IsActive() const override;
59 bool IsCapturingAudio() const override; 61 bool IsCapturingAudio() const override;
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 void Close() override; 157 void Close() override;
156 158
157 // SpeechRecognitionEngineDelegate methods. 159 // SpeechRecognitionEngineDelegate methods.
158 void OnSpeechRecognitionEngineResults( 160 void OnSpeechRecognitionEngineResults(
159 const SpeechRecognitionResults& results) override; 161 const SpeechRecognitionResults& results) override;
160 void OnSpeechRecognitionEngineEndOfUtterance() override; 162 void OnSpeechRecognitionEngineEndOfUtterance() override;
161 void OnSpeechRecognitionEngineError( 163 void OnSpeechRecognitionEngineError(
162 const SpeechRecognitionError& error) override; 164 const SpeechRecognitionError& error) override;
163 165
164 media::AudioSystem* GetAudioSystem(); 166 media::AudioSystem* GetAudioSystem();
167 media::AudioManager* GetAudioManager();
165 168
166 // Substitutes the real audio system in browser tests. 169 // Substitutes the real audio system in browser tests.
167 static media::AudioSystem* audio_system_for_tests_; 170 static media::AudioSystem* audio_system_for_tests_;
171 static media::AudioManager* audio_manager_for_tests_;
168 media::AudioSystem* audio_system_; 172 media::AudioSystem* audio_system_;
173 media::AudioManager* audio_manager_;
169 std::unique_ptr<SpeechRecognitionEngine> recognition_engine_; 174 std::unique_ptr<SpeechRecognitionEngine> recognition_engine_;
170 Endpointer endpointer_; 175 Endpointer endpointer_;
171 scoped_refptr<media::AudioInputController> audio_controller_; 176 scoped_refptr<media::AudioInputController> audio_controller_;
172 std::unique_ptr<media::AudioLog> audio_log_; 177 std::unique_ptr<media::AudioLog> audio_log_;
173 int num_samples_recorded_; 178 int num_samples_recorded_;
174 float audio_level_; 179 float audio_level_;
175 bool is_dispatching_event_; 180 bool is_dispatching_event_;
176 bool provisional_results_; 181 bool provisional_results_;
177 bool end_of_utterance_; 182 bool end_of_utterance_;
178 FSMState state_; 183 FSMState state_;
179 std::string device_id_; 184 std::string device_id_;
180 media::AudioParameters device_params_; 185 media::AudioParameters device_params_;
181 186
182 class OnDataConverter; 187 class OnDataConverter;
183 188
184 // Converts data between native input format and a WebSpeech specific 189 // Converts data between native input format and a WebSpeech specific
185 // output format. 190 // output format.
186 std::unique_ptr<SpeechRecognizerImpl::OnDataConverter> audio_converter_; 191 std::unique_ptr<SpeechRecognizerImpl::OnDataConverter> audio_converter_;
187 192
188 base::WeakPtrFactory<SpeechRecognizerImpl> weak_ptr_factory_; 193 base::WeakPtrFactory<SpeechRecognizerImpl> weak_ptr_factory_;
189 DISALLOW_COPY_AND_ASSIGN(SpeechRecognizerImpl); 194 DISALLOW_COPY_AND_ASSIGN(SpeechRecognizerImpl);
190 }; 195 };
191 196
192 } // namespace content 197 } // namespace content
193 198
194 #endif // CONTENT_BROWSER_SPEECH_SPEECH_RECOGNIZER_IMPL_H_ 199 #endif // CONTENT_BROWSER_SPEECH_SPEECH_RECOGNIZER_IMPL_H_
OLDNEW
« no previous file with comments | « content/browser/speech/speech_recognition_manager_impl.cc ('k') | content/browser/speech/speech_recognizer_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698