| 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 23 matching lines...) Expand all Loading... |
| 34 VoiceDetectionImpl::VoiceDetectionImpl(rtc::CriticalSection* crit) | 34 VoiceDetectionImpl::VoiceDetectionImpl(rtc::CriticalSection* crit) |
| 35 : crit_(crit) { | 35 : crit_(crit) { |
| 36 RTC_DCHECK(crit); | 36 RTC_DCHECK(crit); |
| 37 } | 37 } |
| 38 | 38 |
| 39 VoiceDetectionImpl::~VoiceDetectionImpl() {} | 39 VoiceDetectionImpl::~VoiceDetectionImpl() {} |
| 40 | 40 |
| 41 void VoiceDetectionImpl::Initialize(int sample_rate_hz) { | 41 void VoiceDetectionImpl::Initialize(int sample_rate_hz) { |
| 42 rtc::CritScope cs(crit_); | 42 rtc::CritScope cs(crit_); |
| 43 sample_rate_hz_ = sample_rate_hz; | 43 sample_rate_hz_ = sample_rate_hz; |
| 44 rtc::scoped_ptr<Vad> new_vad; | 44 std::unique_ptr<Vad> new_vad; |
| 45 if (enabled_) { | 45 if (enabled_) { |
| 46 new_vad.reset(new Vad()); | 46 new_vad.reset(new Vad()); |
| 47 } | 47 } |
| 48 vad_.swap(new_vad); | 48 vad_.swap(new_vad); |
| 49 using_external_vad_ = false; | 49 using_external_vad_ = false; |
| 50 frame_size_samples_ = | 50 frame_size_samples_ = |
| 51 static_cast<size_t>(frame_size_ms_ * sample_rate_hz_) / 1000; | 51 static_cast<size_t>(frame_size_ms_ * sample_rate_hz_) / 1000; |
| 52 set_likelihood(likelihood_); | 52 set_likelihood(likelihood_); |
| 53 } | 53 } |
| 54 | 54 |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 frame_size_ms_ = size; | 145 frame_size_ms_ = size; |
| 146 Initialize(sample_rate_hz_); | 146 Initialize(sample_rate_hz_); |
| 147 return AudioProcessing::kNoError; | 147 return AudioProcessing::kNoError; |
| 148 } | 148 } |
| 149 | 149 |
| 150 int VoiceDetectionImpl::frame_size_ms() const { | 150 int VoiceDetectionImpl::frame_size_ms() const { |
| 151 rtc::CritScope cs(crit_); | 151 rtc::CritScope cs(crit_); |
| 152 return frame_size_ms_; | 152 return frame_size_ms_; |
| 153 } | 153 } |
| 154 } // namespace webrtc | 154 } // namespace webrtc |
| OLD | NEW |