| 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 "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/time/time.h" | 9 #include "base/time/time.h" |
| 10 #include "content/browser/browser_main_loop.h" | 10 #include "content/browser/browser_main_loop.h" |
| (...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 549 // and the idea is to simplify the audio conversion since each Convert() | 549 // and the idea is to simplify the audio conversion since each Convert() |
| 550 // call will then render exactly one ProvideInput() call. | 550 // call will then render exactly one ProvideInput() call. |
| 551 // Due to implementation details in the audio converter, 2 milliseconds | 551 // Due to implementation details in the audio converter, 2 milliseconds |
| 552 // are added to the default frame size (100 ms) to ensure there is enough | 552 // are added to the default frame size (100 ms) to ensure there is enough |
| 553 // data to generate 100 ms of output when resampling. | 553 // data to generate 100 ms of output when resampling. |
| 554 frames_per_buffer = | 554 frames_per_buffer = |
| 555 ((in_params.sample_rate() * (chunk_duration_ms + 2)) / 1000.0) + 0.5; | 555 ((in_params.sample_rate() * (chunk_duration_ms + 2)) / 1000.0) + 0.5; |
| 556 input_parameters.Reset(in_params.format(), | 556 input_parameters.Reset(in_params.format(), |
| 557 in_params.channel_layout(), | 557 in_params.channel_layout(), |
| 558 in_params.channels(), | 558 in_params.channels(), |
| 559 in_params.input_channels(), | |
| 560 in_params.sample_rate(), | 559 in_params.sample_rate(), |
| 561 in_params.bits_per_sample(), | 560 in_params.bits_per_sample(), |
| 562 frames_per_buffer); | 561 frames_per_buffer); |
| 563 } | 562 } |
| 564 | 563 |
| 565 // Create an audio converter which converts data between native input format | 564 // Create an audio converter which converts data between native input format |
| 566 // and WebSpeech specific output format. | 565 // and WebSpeech specific output format. |
| 567 audio_converter_.reset( | 566 audio_converter_.reset( |
| 568 new OnDataConverter(input_parameters, output_parameters)); | 567 new OnDataConverter(input_parameters, output_parameters)); |
| 569 | 568 |
| (...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 816 SpeechRecognizerImpl::FSMEventArgs::FSMEventArgs(FSMEvent event_value) | 815 SpeechRecognizerImpl::FSMEventArgs::FSMEventArgs(FSMEvent event_value) |
| 817 : event(event_value), | 816 : event(event_value), |
| 818 audio_data(NULL), | 817 audio_data(NULL), |
| 819 engine_error(SPEECH_RECOGNITION_ERROR_NONE) { | 818 engine_error(SPEECH_RECOGNITION_ERROR_NONE) { |
| 820 } | 819 } |
| 821 | 820 |
| 822 SpeechRecognizerImpl::FSMEventArgs::~FSMEventArgs() { | 821 SpeechRecognizerImpl::FSMEventArgs::~FSMEventArgs() { |
| 823 } | 822 } |
| 824 | 823 |
| 825 } // namespace content | 824 } // namespace content |
| OLD | NEW |