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

Side by Side Diff: content/browser/speech/speech_recognition_manager_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: Introduce SpeechRecognitionAudioReceiver Created 6 years, 2 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_RECOGNITION_MANAGER_IMPL_H_ 5 #ifndef CONTENT_BROWSER_SPEECH_SPEECH_RECOGNITION_MANAGER_IMPL_H_
6 #define CONTENT_BROWSER_SPEECH_SPEECH_RECOGNITION_MANAGER_IMPL_H_ 6 #define CONTENT_BROWSER_SPEECH_SPEECH_RECOGNITION_MANAGER_IMPL_H_
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 10
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "base/callback.h" 12 #include "base/callback.h"
13 #include "base/compiler_specific.h" 13 #include "base/compiler_specific.h"
14 #include "base/memory/weak_ptr.h" 14 #include "base/memory/weak_ptr.h"
15 #include "base/sync_socket.h"
15 #include "content/browser/renderer_host/media/media_stream_requester.h" 16 #include "content/browser/renderer_host/media/media_stream_requester.h"
16 #include "content/public/browser/speech_recognition_event_listener.h" 17 #include "content/public/browser/speech_recognition_event_listener.h"
17 #include "content/public/browser/speech_recognition_manager.h" 18 #include "content/public/browser/speech_recognition_manager.h"
18 #include "content/public/browser/speech_recognition_session_config.h" 19 #include "content/public/browser/speech_recognition_session_config.h"
19 #include "content/public/browser/speech_recognition_session_context.h" 20 #include "content/public/browser/speech_recognition_session_context.h"
20 #include "content/public/common/speech_recognition_error.h" 21 #include "content/public/common/speech_recognition_error.h"
21 22
22 namespace media { 23 namespace media {
23 class AudioManager; 24 class AudioManager;
24 } 25 }
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 virtual void OnSoundStart(int session_id) OVERRIDE; 85 virtual void OnSoundStart(int session_id) OVERRIDE;
85 virtual void OnSoundEnd(int session_id) OVERRIDE; 86 virtual void OnSoundEnd(int session_id) OVERRIDE;
86 virtual void OnAudioEnd(int session_id) OVERRIDE; 87 virtual void OnAudioEnd(int session_id) OVERRIDE;
87 virtual void OnRecognitionEnd(int session_id) OVERRIDE; 88 virtual void OnRecognitionEnd(int session_id) OVERRIDE;
88 virtual void OnRecognitionResults( 89 virtual void OnRecognitionResults(
89 int session_id, const SpeechRecognitionResults& result) OVERRIDE; 90 int session_id, const SpeechRecognitionResults& result) OVERRIDE;
90 virtual void OnRecognitionError( 91 virtual void OnRecognitionError(
91 int session_id, const SpeechRecognitionError& error) OVERRIDE; 92 int session_id, const SpeechRecognitionError& error) OVERRIDE;
92 virtual void OnAudioLevelsChange(int session_id, float volume, 93 virtual void OnAudioLevelsChange(int session_id, float volume,
93 float noise_volume) OVERRIDE; 94 float noise_volume) OVERRIDE;
95 virtual void OnSharedAudioBusReady(
96 int session_id,
97 const media::AudioParameters& params,
98 base::SharedMemoryHandle memory,
99 base::SyncSocket::TransitDescriptor) OVERRIDE;
94 100
95 SpeechRecognitionManagerDelegate* delegate() const { return delegate_.get(); } 101 SpeechRecognitionManagerDelegate* delegate() const { return delegate_.get(); }
96 102
97 protected: 103 protected:
98 // BrowserMainLoop is the only one allowed to istantiate and free us. 104 // BrowserMainLoop is the only one allowed to istantiate and free us.
99 friend class BrowserMainLoop; 105 friend class BrowserMainLoop;
100 // Needed for dtor. 106 // Needed for dtor.
101 friend struct base::DefaultDeleter<SpeechRecognitionManagerImpl>; 107 friend struct base::DefaultDeleter<SpeechRecognitionManagerImpl>;
102 SpeechRecognitionManagerImpl(media::AudioManager* audio_manager, 108 SpeechRecognitionManagerImpl(media::AudioManager* audio_manager,
103 MediaStreamManager* media_stream_manager); 109 MediaStreamManager* media_stream_manager);
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 190
185 // Used for posting asynchronous tasks (on the IO thread) without worrying 191 // Used for posting asynchronous tasks (on the IO thread) without worrying
186 // about this class being destroyed in the meanwhile (due to browser shutdown) 192 // about this class being destroyed in the meanwhile (due to browser shutdown)
187 // since tasks pending on a destroyed WeakPtr are automatically discarded. 193 // since tasks pending on a destroyed WeakPtr are automatically discarded.
188 base::WeakPtrFactory<SpeechRecognitionManagerImpl> weak_factory_; 194 base::WeakPtrFactory<SpeechRecognitionManagerImpl> weak_factory_;
189 }; 195 };
190 196
191 } // namespace content 197 } // namespace content
192 198
193 #endif // CONTENT_BROWSER_SPEECH_SPEECH_RECOGNITION_MANAGER_IMPL_H_ 199 #endif // CONTENT_BROWSER_SPEECH_SPEECH_RECOGNITION_MANAGER_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698