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.h" | 9 #include "base/time.h" |
10 #include "content/browser/browser_main_loop.h" | 10 #include "content/browser/browser_main_loop.h" |
(...skipping 550 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
561 | 561 |
562 // Create an audio converter which converts data between native input format | 562 // Create an audio converter which converts data between native input format |
563 // and WebSpeech specific output format. | 563 // and WebSpeech specific output format. |
564 audio_converter_.reset( | 564 audio_converter_.reset( |
565 new OnDataConverter(input_parameters, output_parameters)); | 565 new OnDataConverter(input_parameters, output_parameters)); |
566 | 566 |
567 // TODO(xians): use the correct input device here. | 567 // TODO(xians): use the correct input device here. |
568 audio_controller_ = AudioInputController::Create( | 568 audio_controller_ = AudioInputController::Create( |
569 audio_manager, this, input_parameters, device_id_); | 569 audio_manager, this, input_parameters, device_id_); |
570 | 570 |
571 if (!audio_controller_) { | 571 if (!audio_controller_.get()) { |
572 return Abort(SpeechRecognitionError(SPEECH_RECOGNITION_ERROR_AUDIO)); | 572 return Abort(SpeechRecognitionError(SPEECH_RECOGNITION_ERROR_AUDIO)); |
573 } | 573 } |
574 | 574 |
575 // The endpointer needs to estimate the environment/background noise before | 575 // The endpointer needs to estimate the environment/background noise before |
576 // starting to treat the audio as user input. We wait in the state | 576 // starting to treat the audio as user input. We wait in the state |
577 // ESTIMATING_ENVIRONMENT until such interval has elapsed before switching | 577 // ESTIMATING_ENVIRONMENT until such interval has elapsed before switching |
578 // to user input mode. | 578 // to user input mode. |
579 endpointer_.SetEnvironmentEstimationMode(); | 579 endpointer_.SetEnvironmentEstimationMode(); |
580 audio_controller_->Record(); | 580 audio_controller_->Record(); |
581 return STATE_STARTING; | 581 return STATE_STARTING; |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
812 SpeechRecognizerImpl::FSMEventArgs::FSMEventArgs(FSMEvent event_value) | 812 SpeechRecognizerImpl::FSMEventArgs::FSMEventArgs(FSMEvent event_value) |
813 : event(event_value), | 813 : event(event_value), |
814 audio_data(NULL), | 814 audio_data(NULL), |
815 engine_error(SPEECH_RECOGNITION_ERROR_NONE) { | 815 engine_error(SPEECH_RECOGNITION_ERROR_NONE) { |
816 } | 816 } |
817 | 817 |
818 SpeechRecognizerImpl::FSMEventArgs::~FSMEventArgs() { | 818 SpeechRecognizerImpl::FSMEventArgs::~FSMEventArgs() { |
819 } | 819 } |
820 | 820 |
821 } // namespace content | 821 } // namespace content |
OLD | NEW |