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 "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 775 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
786 } | 786 } |
787 | 787 |
788 void SpeechRecognizerImpl::CloseAudioControllerAsynchronously() { | 788 void SpeechRecognizerImpl::CloseAudioControllerAsynchronously() { |
789 DCHECK(IsCapturingAudio()); | 789 DCHECK(IsCapturingAudio()); |
790 DVLOG(1) << "SpeechRecognizerImpl closing audio controller."; | 790 DVLOG(1) << "SpeechRecognizerImpl closing audio controller."; |
791 // Issues a Close on the audio controller, passing an empty callback. The only | 791 // Issues a Close on the audio controller, passing an empty callback. The only |
792 // purpose of such callback is to keep the audio controller refcounted until | 792 // purpose of such callback is to keep the audio controller refcounted until |
793 // Close has completed (in the audio thread) and automatically destroy it | 793 // Close has completed (in the audio thread) and automatically destroy it |
794 // afterwards (upon return from OnAudioClosed). | 794 // afterwards (upon return from OnAudioClosed). |
795 audio_controller_->Close(base::Bind(&SpeechRecognizerImpl::OnAudioClosed, | 795 audio_controller_->Close(base::Bind(&SpeechRecognizerImpl::OnAudioClosed, |
796 this, audio_controller_)); | 796 this, |
| 797 base::RetainedRef(audio_controller_))); |
797 audio_controller_ = NULL; // The controller is still refcounted by Bind. | 798 audio_controller_ = NULL; // The controller is still refcounted by Bind. |
798 audio_log_->OnClosed(0); | 799 audio_log_->OnClosed(0); |
799 } | 800 } |
800 | 801 |
801 int SpeechRecognizerImpl::GetElapsedTimeMs() const { | 802 int SpeechRecognizerImpl::GetElapsedTimeMs() const { |
802 return (num_samples_recorded_ * 1000) / kAudioSampleRate; | 803 return (num_samples_recorded_ * 1000) / kAudioSampleRate; |
803 } | 804 } |
804 | 805 |
805 void SpeechRecognizerImpl::UpdateSignalAndNoiseLevels(const float& rms, | 806 void SpeechRecognizerImpl::UpdateSignalAndNoiseLevels(const float& rms, |
806 bool clip_detected) { | 807 bool clip_detected) { |
(...skipping 28 matching lines...) Expand all Loading... |
835 engine_error(SPEECH_RECOGNITION_ERROR_NONE) { | 836 engine_error(SPEECH_RECOGNITION_ERROR_NONE) { |
836 } | 837 } |
837 | 838 |
838 SpeechRecognizerImpl::FSMEventArgs::FSMEventArgs(const FSMEventArgs& other) = | 839 SpeechRecognizerImpl::FSMEventArgs::FSMEventArgs(const FSMEventArgs& other) = |
839 default; | 840 default; |
840 | 841 |
841 SpeechRecognizerImpl::FSMEventArgs::~FSMEventArgs() { | 842 SpeechRecognizerImpl::FSMEventArgs::~FSMEventArgs() { |
842 } | 843 } |
843 | 844 |
844 } // namespace content | 845 } // namespace content |
OLD | NEW |