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

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: Move thread to recognizer_impl. Use PostDelayedTask. 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 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 config.language = params.language; 156 config.language = params.language;
157 config.grammars = params.grammars; 157 config.grammars = params.grammars;
158 config.max_hypotheses = params.max_hypotheses; 158 config.max_hypotheses = params.max_hypotheses;
159 config.origin_url = params.origin_url; 159 config.origin_url = params.origin_url;
160 config.initial_context = context; 160 config.initial_context = context;
161 config.url_request_context_getter = context_getter_.get(); 161 config.url_request_context_getter = context_getter_.get();
162 config.filter_profanities = filter_profanities; 162 config.filter_profanities = filter_profanities;
163 config.continuous = params.continuous; 163 config.continuous = params.continuous;
164 config.interim_results = params.interim_results; 164 config.interim_results = params.interim_results;
165 config.event_listener = AsWeakPtr(); 165 config.event_listener = AsWeakPtr();
166 config.using_audio_track = params.using_audio_track;
167 // TODO(burnik): This needs to be tested on Windows.
168 config.peer_process_handle = PeerHandle();
166 169
167 int session_id = SpeechRecognitionManager::GetInstance()->CreateSession( 170 int session_id = SpeechRecognitionManager::GetInstance()->CreateSession(
168 config); 171 config);
169 DCHECK_NE(session_id, SpeechRecognitionManager::kSessionIDInvalid); 172 DCHECK_NE(session_id, SpeechRecognitionManager::kSessionIDInvalid);
170 SpeechRecognitionManager::GetInstance()->StartSession(session_id); 173 SpeechRecognitionManager::GetInstance()->StartSession(session_id);
171 } 174 }
172 175
173 void SpeechRecognitionDispatcherHost::OnAbortRequest(int render_view_id, 176 void SpeechRecognitionDispatcherHost::OnAbortRequest(int render_view_id,
174 int request_id) { 177 int request_id) {
175 int session_id = SpeechRecognitionManager::GetInstance()->GetSession( 178 int session_id = SpeechRecognitionManager::GetInstance()->GetSession(
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 // The events below are currently not used by speech JS APIs implementation. 269 // The events below are currently not used by speech JS APIs implementation.
267 void SpeechRecognitionDispatcherHost::OnAudioLevelsChange(int session_id, 270 void SpeechRecognitionDispatcherHost::OnAudioLevelsChange(int session_id,
268 float volume, 271 float volume,
269 float noise_volume) { 272 float noise_volume) {
270 } 273 }
271 274
272 void SpeechRecognitionDispatcherHost::OnEnvironmentEstimationComplete( 275 void SpeechRecognitionDispatcherHost::OnEnvironmentEstimationComplete(
273 int session_id) { 276 int session_id) {
274 } 277 }
275 278
279 void SpeechRecognitionDispatcherHost::OnAudioReceiverReady(
280 int session_id,
281 const media::AudioParameters& params,
282 const base::SharedMemoryHandle memory,
283 const base::SyncSocket::TransitDescriptor socket) {
284 const SpeechRecognitionSessionContext& context =
285 SpeechRecognitionManager::GetInstance()->GetSessionContext(session_id);
286 Send(new SpeechRecognitionMsg_AudioReceiverReady(context.render_view_id,
287 context.request_id,
288 params,
289 memory,
290 socket));
291 }
292
276 } // namespace content 293 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698