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

Unified Diff: content/browser/speech/speech_recognizer_impl.h

Issue 549373003: Binding media stream audio track to speech recognition [browser] Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Wait with no timeout Created 6 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/speech/speech_recognizer.h ('k') | content/browser/speech/speech_recognizer_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 3a26d335cacdfc66d5322e8fe2c55e1b5cafe10e..ccbba4519c5dbee9bef1176958fc1e50c19d9efb 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;
+}
+
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);
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);
};
« no previous file with comments | « content/browser/speech/speech_recognizer.h ('k') | content/browser/speech/speech_recognizer_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698