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

Side by Side Diff: content/browser/speech/speech_recognition_dispatcher_host.cc

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 #include "content/browser/speech/speech_recognition_dispatcher_host.h" 5 #include "content/browser/speech/speech_recognition_dispatcher_host.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/lazy_instance.h" 9 #include "base/lazy_instance.h"
10 #include "content/browser/browser_plugin/browser_plugin_guest.h" 10 #include "content/browser/browser_plugin/browser_plugin_guest.h"
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 config.language = params.language; 150 config.language = params.language;
151 config.grammars = params.grammars; 151 config.grammars = params.grammars;
152 config.max_hypotheses = params.max_hypotheses; 152 config.max_hypotheses = params.max_hypotheses;
153 config.origin_url = params.origin_url; 153 config.origin_url = params.origin_url;
154 config.initial_context = context; 154 config.initial_context = context;
155 config.url_request_context_getter = context_getter_.get(); 155 config.url_request_context_getter = context_getter_.get();
156 config.filter_profanities = filter_profanities; 156 config.filter_profanities = filter_profanities;
157 config.continuous = params.continuous; 157 config.continuous = params.continuous;
158 config.interim_results = params.interim_results; 158 config.interim_results = params.interim_results;
159 config.event_listener = AsWeakPtr(); 159 config.event_listener = AsWeakPtr();
160 config.using_audio_track = params.using_audio_track;
161 // TODO(burnik): This needs to be tested on Windows.
162 config.peer_process_handle = PeerHandle();
160 163
161 int session_id = SpeechRecognitionManager::GetInstance()->CreateSession( 164 int session_id = SpeechRecognitionManager::GetInstance()->CreateSession(
162 config); 165 config);
163 DCHECK_NE(session_id, SpeechRecognitionManager::kSessionIDInvalid); 166 DCHECK_NE(session_id, SpeechRecognitionManager::kSessionIDInvalid);
164 SpeechRecognitionManager::GetInstance()->StartSession(session_id); 167 SpeechRecognitionManager::GetInstance()->StartSession(session_id);
165 } 168 }
166 169
167 void SpeechRecognitionDispatcherHost::OnAbortRequest(int render_view_id, 170 void SpeechRecognitionDispatcherHost::OnAbortRequest(int render_view_id,
168 int request_id) { 171 int request_id) {
169 int session_id = SpeechRecognitionManager::GetInstance()->GetSession( 172 int session_id = SpeechRecognitionManager::GetInstance()->GetSession(
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 // The events below are currently not used by speech JS APIs implementation. 263 // The events below are currently not used by speech JS APIs implementation.
261 void SpeechRecognitionDispatcherHost::OnAudioLevelsChange(int session_id, 264 void SpeechRecognitionDispatcherHost::OnAudioLevelsChange(int session_id,
262 float volume, 265 float volume,
263 float noise_volume) { 266 float noise_volume) {
264 } 267 }
265 268
266 void SpeechRecognitionDispatcherHost::OnEnvironmentEstimationComplete( 269 void SpeechRecognitionDispatcherHost::OnEnvironmentEstimationComplete(
267 int session_id) { 270 int session_id) {
268 } 271 }
269 272
273 void SpeechRecognitionDispatcherHost::OnSharedAudioBusReady(
274 int session_id,
275 const media::AudioParameters& params,
276 base::SharedMemoryHandle memory,
277 base::SyncSocket::TransitDescriptor socket) {
278 const SpeechRecognitionSessionContext& context =
279 SpeechRecognitionManager::GetInstance()->GetSessionContext(session_id);
280 Send(new SpeechRecognitionMsg_SharedAudioBusReady(context.render_view_id,
281 context.request_id,
282 params,
283 memory,
284 socket));
285 }
286
270 } // namespace content 287 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698