| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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_recognizer_impl.h" | 5 #include "content/browser/speech/speech_recognizer_impl.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 | 10 |
| (...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 media::AudioInputController::ErrorCode error_code) { | 281 media::AudioInputController::ErrorCode error_code) { |
| 282 FSMEventArgs event_args(EVENT_AUDIO_ERROR); | 282 FSMEventArgs event_args(EVENT_AUDIO_ERROR); |
| 283 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, | 283 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, |
| 284 base::Bind(&SpeechRecognizerImpl::DispatchEvent, | 284 base::Bind(&SpeechRecognizerImpl::DispatchEvent, |
| 285 this, event_args)); | 285 this, event_args)); |
| 286 } | 286 } |
| 287 | 287 |
| 288 void SpeechRecognizerImpl::Write(const AudioBus* data, | 288 void SpeechRecognizerImpl::Write(const AudioBus* data, |
| 289 double volume, | 289 double volume, |
| 290 bool key_pressed, | 290 bool key_pressed, |
| 291 uint32_t hardware_delay_bytes) { | 291 base::TimeDelta delay, |
| 292 base::TimeTicks delay_timestamp) { |
| 292 // Convert audio from native format to fixed format used by WebSpeech. | 293 // Convert audio from native format to fixed format used by WebSpeech. |
| 293 FSMEventArgs event_args(EVENT_AUDIO_DATA); | 294 FSMEventArgs event_args(EVENT_AUDIO_DATA); |
| 294 event_args.audio_data = audio_converter_->Convert(data); | 295 event_args.audio_data = audio_converter_->Convert(data); |
| 295 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, | 296 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, |
| 296 base::Bind(&SpeechRecognizerImpl::DispatchEvent, | 297 base::Bind(&SpeechRecognizerImpl::DispatchEvent, |
| 297 this, event_args)); | 298 this, event_args)); |
| 298 // See http://crbug.com/506051 regarding why one extra convert call can | 299 // See http://crbug.com/506051 regarding why one extra convert call can |
| 299 // sometimes be required. It should be a rare case. | 300 // sometimes be required. It should be a rare case. |
| 300 if (!audio_converter_->data_was_converted()) { | 301 if (!audio_converter_->data_was_converted()) { |
| 301 event_args.audio_data = audio_converter_->Convert(data); | 302 event_args.audio_data = audio_converter_->Convert(data); |
| (...skipping 596 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 898 engine_error(SPEECH_RECOGNITION_ERROR_NONE) { | 899 engine_error(SPEECH_RECOGNITION_ERROR_NONE) { |
| 899 } | 900 } |
| 900 | 901 |
| 901 SpeechRecognizerImpl::FSMEventArgs::FSMEventArgs(const FSMEventArgs& other) = | 902 SpeechRecognizerImpl::FSMEventArgs::FSMEventArgs(const FSMEventArgs& other) = |
| 902 default; | 903 default; |
| 903 | 904 |
| 904 SpeechRecognizerImpl::FSMEventArgs::~FSMEventArgs() { | 905 SpeechRecognizerImpl::FSMEventArgs::~FSMEventArgs() { |
| 905 } | 906 } |
| 906 | 907 |
| 907 } // namespace content | 908 } // namespace content |
| OLD | NEW |