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

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

Issue 1230503003: Update a ton of audio code to use size_t more correctly and in general reduce (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Resync Created 5 years, 3 months 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 13 matching lines...) Expand all
24 24
25 // A Voice Activity Detector (VAD) that combines the voice probability from the 25 // A Voice Activity Detector (VAD) that combines the voice probability from the
26 // StandaloneVad and PitchBasedVad to get a more robust estimation. 26 // StandaloneVad and PitchBasedVad to get a more robust estimation.
27 class VoiceActivityDetector { 27 class VoiceActivityDetector {
28 public: 28 public:
29 VoiceActivityDetector(); 29 VoiceActivityDetector();
30 30
31 // Processes each audio chunk and estimates the voice probability. The maximum 31 // Processes each audio chunk and estimates the voice probability. The maximum
32 // supported sample rate is 32kHz. 32 // supported sample rate is 32kHz.
33 // TODO(aluebs): Change |length| to size_t. 33 // TODO(aluebs): Change |length| to size_t.
34 void ProcessChunk(const int16_t* audio, int length, int sample_rate_hz); 34 void ProcessChunk(const int16_t* audio, size_t length, int sample_rate_hz);
35 35
36 // Returns a vector of voice probabilities for each chunk. It can be empty for 36 // Returns a vector of voice probabilities for each chunk. It can be empty for
37 // some chunks, but it catches up afterwards returning multiple values at 37 // some chunks, but it catches up afterwards returning multiple values at
38 // once. 38 // once.
39 const std::vector<double>& chunkwise_voice_probabilities() const { 39 const std::vector<double>& chunkwise_voice_probabilities() const {
40 return chunkwise_voice_probabilities_; 40 return chunkwise_voice_probabilities_;
41 } 41 }
42 42
43 // Returns a vector of RMS values for each chunk. It has the same length as 43 // Returns a vector of RMS values for each chunk. It has the same length as
44 // chunkwise_voice_probabilities(). 44 // chunkwise_voice_probabilities().
(...skipping 16 matching lines...) Expand all
61 rtc::scoped_ptr<StandaloneVad> standalone_vad_; 61 rtc::scoped_ptr<StandaloneVad> standalone_vad_;
62 PitchBasedVad pitch_based_vad_; 62 PitchBasedVad pitch_based_vad_;
63 63
64 int16_t resampled_[kLength10Ms]; 64 int16_t resampled_[kLength10Ms];
65 AudioFeatures features_; 65 AudioFeatures features_;
66 }; 66 };
67 67
68 } // namespace webrtc 68 } // namespace webrtc
69 69
70 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_VAD_VOICE_ACTIVITY_DETECTOR_H_ 70 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_VAD_VOICE_ACTIVITY_DETECTOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698