Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(15)

Side by Side Diff: webrtc/modules/audio_processing/vad/voice_activity_detector.cc

Issue 2534683002: RTC_[D]CHECK_op: Remove superfluous casts (Closed)
Patch Set: test Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2015 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 21 matching lines...) Expand all
32 } 32 }
33 33
34 VoiceActivityDetector::~VoiceActivityDetector() = default; 34 VoiceActivityDetector::~VoiceActivityDetector() = default;
35 35
36 // Because ISAC has a different chunk length, it updates 36 // Because ISAC has a different chunk length, it updates
37 // |chunkwise_voice_probabilities_| and |chunkwise_rms_| when there is new data. 37 // |chunkwise_voice_probabilities_| and |chunkwise_rms_| when there is new data.
38 // Otherwise it clears them. 38 // Otherwise it clears them.
39 void VoiceActivityDetector::ProcessChunk(const int16_t* audio, 39 void VoiceActivityDetector::ProcessChunk(const int16_t* audio,
40 size_t length, 40 size_t length,
41 int sample_rate_hz) { 41 int sample_rate_hz) {
42 RTC_DCHECK_EQ(static_cast<int>(length), sample_rate_hz / 100); 42 RTC_DCHECK_EQ(length, sample_rate_hz / 100);
43 RTC_DCHECK_LE(length, kMaxLength); 43 RTC_DCHECK_LE(length, kMaxLength);
44 // Resample to the required rate. 44 // Resample to the required rate.
45 const int16_t* resampled_ptr = audio; 45 const int16_t* resampled_ptr = audio;
46 if (sample_rate_hz != kSampleRateHz) { 46 if (sample_rate_hz != kSampleRateHz) {
47 RTC_CHECK_EQ( 47 RTC_CHECK_EQ(
48 resampler_.ResetIfNeeded(sample_rate_hz, kSampleRateHz, kNumChannels), 48 resampler_.ResetIfNeeded(sample_rate_hz, kSampleRateHz, kNumChannels),
49 0); 49 0);
50 resampler_.Push(audio, length, resampled_, kLength10Ms, length); 50 resampler_.Push(audio, length, resampled_, kLength10Ms, length);
51 resampled_ptr = resampled_; 51 resampled_ptr = resampled_;
52 } 52 }
(...skipping 25 matching lines...) Expand all
78 0); 78 0);
79 RTC_CHECK_GE(pitch_based_vad_.VoicingProbability( 79 RTC_CHECK_GE(pitch_based_vad_.VoicingProbability(
80 features_, &chunkwise_voice_probabilities_[0]), 80 features_, &chunkwise_voice_probabilities_[0]),
81 0); 81 0);
82 } 82 }
83 last_voice_probability_ = chunkwise_voice_probabilities_.back(); 83 last_voice_probability_ = chunkwise_voice_probabilities_.back();
84 } 84 }
85 } 85 }
86 86
87 } // namespace webrtc 87 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698