Chromium Code Reviews| Index: content/browser/speech/speech_recognizer_impl.h |
| diff --git a/content/browser/speech/speech_recognizer_impl.h b/content/browser/speech/speech_recognizer_impl.h |
| index b047174401685c7e57d44c33d30335fa4f3d880a..86fa152b129950486e23440cf53930f47acc2f8a 100644 |
| --- a/content/browser/speech/speech_recognizer_impl.h |
| +++ b/content/browser/speech/speech_recognizer_impl.h |
| @@ -7,6 +7,7 @@ |
| #include "base/basictypes.h" |
| #include "base/memory/scoped_ptr.h" |
| +#include "base/process/process_handle.h" |
| #include "content/browser/speech/endpointer/endpointer.h" |
| #include "content/browser/speech/speech_recognition_engine.h" |
| #include "content/browser/speech/speech_recognizer.h" |
| @@ -16,13 +17,19 @@ |
| #include "media/audio/audio_logging.h" |
| #include "net/url_request/url_request_context_getter.h" |
| +namespace base { |
| + class Thread; |
|
tommi (sloooow) - chröme
2014/10/16 21:20:23
no indent
burnik
2014/10/17 10:48:02
Done.
|
| +} |
| + |
| namespace media { |
| class AudioBus; |
| class AudioManager; |
| +class AudioParameters; |
| } |
| namespace content { |
| +class SpeechRecognitionAudioReceiver; |
| class SpeechRecognitionEventListener; |
| // Handles speech recognition for a session (identified by |session_id|), taking |
| @@ -45,6 +52,8 @@ class CONTENT_EXPORT SpeechRecognizerImpl |
| int session_id, |
| bool continuous, |
| bool provisional_results, |
| + bool using_audio_receiver, |
| + const base::ProcessHandle process_handle, |
| SpeechRecognitionEngine* engine); |
| virtual void StartRecognition(const std::string& device_id) override; |
| @@ -116,6 +125,12 @@ class CONTENT_EXPORT SpeechRecognizerImpl |
| FSMState DoNothing(const FSMEventArgs& event_args) const; |
| FSMState NotFeasible(const FSMEventArgs& event_args); |
| + // Called from |StartRecording()| when using |audio_receiver_|. |
| + bool StartRecordingUsingAudioReceiver(const media::AudioParameters& params); |
| + |
| + // Called when the session ends due to error or when being stopped. |
| + void ResetAudioReceiver(); |
| + |
| // Returns the time span of captured audio samples since the start of capture. |
| int GetElapsedTimeMs() const; |
| @@ -154,6 +169,8 @@ class CONTENT_EXPORT SpeechRecognizerImpl |
| float audio_level_; |
| bool is_dispatching_event_; |
| bool provisional_results_; |
| + bool using_audio_receiver_; |
| + base::ProcessHandle peer_process_handle_; |
| FSMState state_; |
| std::string device_id_; |
| @@ -163,6 +180,10 @@ class CONTENT_EXPORT SpeechRecognizerImpl |
| // output format. |
| scoped_ptr<SpeechRecognizerImpl::OnDataConverter> audio_converter_; |
| + // Used when getting audio data from the renderer. |
| + scoped_ptr<base::Thread> audio_thread_; |
| + scoped_ptr<SpeechRecognitionAudioReceiver> audio_receiver_; |
| + |
| DISALLOW_COPY_AND_ASSIGN(SpeechRecognizerImpl); |
| }; |