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(), |
559 in_params.sample_rate(), | 560 in_params.sample_rate(), |
560 in_params.bits_per_sample(), | 561 in_params.bits_per_sample(), |
561 frames_per_buffer); | 562 frames_per_buffer); |
562 } | 563 } |
563 | 564 |
564 // Create an audio converter which converts data between native input format | 565 // Create an audio converter which converts data between native input format |
565 // and WebSpeech specific output format. | 566 // and WebSpeech specific output format. |
566 audio_converter_.reset( | 567 audio_converter_.reset( |
567 new OnDataConverter(input_parameters, output_parameters)); | 568 new OnDataConverter(input_parameters, output_parameters)); |
568 | 569 |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
815 SpeechRecognizerImpl::FSMEventArgs::FSMEventArgs(FSMEvent event_value) | 816 SpeechRecognizerImpl::FSMEventArgs::FSMEventArgs(FSMEvent event_value) |
816 : event(event_value), | 817 : event(event_value), |
817 audio_data(NULL), | 818 audio_data(NULL), |
818 engine_error(SPEECH_RECOGNITION_ERROR_NONE) { | 819 engine_error(SPEECH_RECOGNITION_ERROR_NONE) { |
819 } | 820 } |
820 | 821 |
821 SpeechRecognizerImpl::FSMEventArgs::~FSMEventArgs() { | 822 SpeechRecognizerImpl::FSMEventArgs::~FSMEventArgs() { |
822 } | 823 } |
823 | 824 |
824 } // namespace content | 825 } // namespace content |
OLD | NEW |