| 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_recognizer.h" | 5 #include "content/browser/speech/speech_recognizer.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 467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 478 SpeechRecognizer::DetectEndOfSpeech(const FSMEventArgs& event_args) { | 478 SpeechRecognizer::DetectEndOfSpeech(const FSMEventArgs& event_args) { |
| 479 if (endpointer_.speech_input_complete()) | 479 if (endpointer_.speech_input_complete()) |
| 480 return StopCaptureAndWaitForResult(event_args); | 480 return StopCaptureAndWaitForResult(event_args); |
| 481 return STATE_RECOGNIZING; | 481 return STATE_RECOGNIZING; |
| 482 } | 482 } |
| 483 | 483 |
| 484 SpeechRecognizer::FSMState | 484 SpeechRecognizer::FSMState |
| 485 SpeechRecognizer::StopCaptureAndWaitForResult(const FSMEventArgs&) { | 485 SpeechRecognizer::StopCaptureAndWaitForResult(const FSMEventArgs&) { |
| 486 DCHECK(state_ >= STATE_ESTIMATING_ENVIRONMENT && state_ <= STATE_RECOGNIZING); | 486 DCHECK(state_ >= STATE_ESTIMATING_ENVIRONMENT && state_ <= STATE_RECOGNIZING); |
| 487 | 487 |
| 488 recognition_engine_->AudioChunksEnded(); |
| 489 |
| 488 DVLOG(1) << "Concluding recognition"; | 490 DVLOG(1) << "Concluding recognition"; |
| 489 CloseAudioControllerAsynchronously(); | 491 CloseAudioControllerAsynchronously(); |
| 490 recognition_engine_->AudioChunksEnded(); | |
| 491 | 492 |
| 492 if (state_ > STATE_WAITING_FOR_SPEECH) | 493 if (state_ > STATE_WAITING_FOR_SPEECH) |
| 493 listener_->OnSoundEnd(session_id_); | 494 listener_->OnSoundEnd(session_id_); |
| 494 | 495 |
| 495 listener_->OnAudioEnd(session_id_); | 496 listener_->OnAudioEnd(session_id_); |
| 496 return STATE_WAITING_FINAL_RESULT; | 497 return STATE_WAITING_FINAL_RESULT; |
| 497 } | 498 } |
| 498 | 499 |
| 499 SpeechRecognizer::FSMState | 500 SpeechRecognizer::FSMState |
| 500 SpeechRecognizer::AbortSilently(const FSMEventArgs& event_args) { | 501 SpeechRecognizer::AbortSilently(const FSMEventArgs& event_args) { |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 657 : event(event_value), | 658 : event(event_value), |
| 658 audio_error_code(0), | 659 audio_error_code(0), |
| 659 audio_data(NULL), | 660 audio_data(NULL), |
| 660 engine_error(content::SPEECH_RECOGNITION_ERROR_NONE) { | 661 engine_error(content::SPEECH_RECOGNITION_ERROR_NONE) { |
| 661 } | 662 } |
| 662 | 663 |
| 663 SpeechRecognizer::FSMEventArgs::~FSMEventArgs() { | 664 SpeechRecognizer::FSMEventArgs::~FSMEventArgs() { |
| 664 } | 665 } |
| 665 | 666 |
| 666 } // namespace speech | 667 } // namespace speech |
| OLD | NEW |