| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 return 1; | 31 return 1; |
| 32 case VoiceDetection::kHighLikelihood: | 32 case VoiceDetection::kHighLikelihood: |
| 33 return 0; | 33 return 0; |
| 34 } | 34 } |
| 35 assert(false); | 35 assert(false); |
| 36 return -1; | 36 return -1; |
| 37 } | 37 } |
| 38 } // namespace | 38 } // namespace |
| 39 | 39 |
| 40 VoiceDetectionImpl::VoiceDetectionImpl(const AudioProcessing* apm, | 40 VoiceDetectionImpl::VoiceDetectionImpl(const AudioProcessing* apm, |
| 41 CriticalSectionWrapper* crit) | 41 CriticalSectionWrapper* crit, |
| 42 : ProcessingComponent(), | 42 rtc::ThreadChecker* capture_thread) |
| 43 apm_(apm), | 43 : ProcessingComponent(), |
| 44 crit_(crit), | 44 apm_(apm), |
| 45 stream_has_voice_(false), | 45 crit_(crit), |
| 46 using_external_vad_(false), | 46 capture_thread_(capture_thread), |
| 47 likelihood_(kLowLikelihood), | 47 stream_has_voice_(false), |
| 48 frame_size_ms_(10), | 48 using_external_vad_(false), |
| 49 frame_size_samples_(0) {} | 49 likelihood_(kLowLikelihood), |
| 50 frame_size_ms_(10), |
| 51 frame_size_samples_(0) {} |
| 50 | 52 |
| 51 VoiceDetectionImpl::~VoiceDetectionImpl() {} | 53 VoiceDetectionImpl::~VoiceDetectionImpl() {} |
| 52 | 54 |
| 53 int VoiceDetectionImpl::ProcessCaptureAudio(AudioBuffer* audio) { | 55 int VoiceDetectionImpl::ProcessCaptureAudio(AudioBuffer* audio) { |
| 56 RTC_DCHECK(capture_thread_->CalledOnValidThread()); |
| 54 if (!is_component_enabled()) { | 57 if (!is_component_enabled()) { |
| 55 return apm_->kNoError; | 58 return apm_->kNoError; |
| 56 } | 59 } |
| 57 | 60 |
| 58 if (using_external_vad_) { | 61 if (using_external_vad_) { |
| 59 using_external_vad_ = false; | 62 using_external_vad_ = false; |
| 60 return apm_->kNoError; | 63 return apm_->kNoError; |
| 61 } | 64 } |
| 62 assert(audio->num_frames_per_band() <= 160); | 65 assert(audio->num_frames_per_band() <= 160); |
| 63 | 66 |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 int VoiceDetectionImpl::num_handles_required() const { | 170 int VoiceDetectionImpl::num_handles_required() const { |
| 168 return 1; | 171 return 1; |
| 169 } | 172 } |
| 170 | 173 |
| 171 int VoiceDetectionImpl::GetHandleError(void* handle) const { | 174 int VoiceDetectionImpl::GetHandleError(void* handle) const { |
| 172 // The VAD has no get_error() function. | 175 // The VAD has no get_error() function. |
| 173 assert(handle != NULL); | 176 assert(handle != NULL); |
| 174 return apm_->kUnspecifiedError; | 177 return apm_->kUnspecifiedError; |
| 175 } | 178 } |
| 176 } // namespace webrtc | 179 } // namespace webrtc |
| OLD | NEW |