Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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. | |
|
tommi (sloooow) - chröme
2014/10/02 11:23:19
has this been done?
is there a unit test?
burnik
2014/10/02 16:04:11
Almost ready with recognizer impl unit test and th
| |
| 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 Loading... | |
| 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::OnAudioTrackReady( | |
| 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_AudioTrackReady(context.render_view_id, | |
| 281 context.request_id, params, | |
| 282 memory, socket)); | |
| 283 } | |
| 284 | |
| 270 } // namespace content | 285 } // namespace content |
| OLD | NEW |