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

Side by Side Diff: remoting/host/audio_silence_detector.h

Issue 1547473005: Switch to standard integer types in remoting/host/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 12 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
« no previous file with comments | « remoting/host/audio_pump_unittest.cc ('k') | remoting/host/audio_silence_detector.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #ifndef REMOTING_HOST_AUDIO_SILENCE_DETECTOR_H_ 5 #ifndef REMOTING_HOST_AUDIO_SILENCE_DETECTOR_H_
6 #define REMOTING_HOST_AUDIO_SILENCE_DETECTOR_H_ 6 #define REMOTING_HOST_AUDIO_SILENCE_DETECTOR_H_
7 7
8 #include "base/basictypes.h" 8 #include <stddef.h>
9 #include <stdint.h>
10
9 #include "base/logging.h" 11 #include "base/logging.h"
10 12
11 namespace remoting { 13 namespace remoting {
12 14
13 // Helper used in audio capturers to detect and drop silent audio packets. 15 // Helper used in audio capturers to detect and drop silent audio packets.
14 class AudioSilenceDetector { 16 class AudioSilenceDetector {
15 public: 17 public:
16 // |threshold| is used to specify maximum absolute sample value that should 18 // |threshold| is used to specify maximum absolute sample value that should
17 // still be considered as silence. 19 // still be considered as silence.
18 explicit AudioSilenceDetector(int threshold); 20 explicit AudioSilenceDetector(int threshold);
19 ~AudioSilenceDetector(); 21 ~AudioSilenceDetector();
20 22
21 void Reset(int sampling_rate, int channels); 23 void Reset(int sampling_rate, int channels);
22 24
23 // Must be called for each new chunk of data. Return true the given packet 25 // Must be called for each new chunk of data. Return true the given packet
24 // is silence should be dropped. 26 // is silence should be dropped.
25 bool IsSilence(const int16* samples, size_t samples_count); 27 bool IsSilence(const int16_t* samples, size_t samples_count);
26 28
27 private: 29 private:
28 // Maximum absolute sample value that should still be considered as silence. 30 // Maximum absolute sample value that should still be considered as silence.
29 int threshold_; 31 int threshold_;
30 32
31 // Silence period threshold in samples. Silence intervals shorter than this 33 // Silence period threshold in samples. Silence intervals shorter than this
32 // value are still encoded and sent to the client, so that we don't disrupt 34 // value are still encoded and sent to the client, so that we don't disrupt
33 // playback by dropping them. 35 // playback by dropping them.
34 int silence_length_max_; 36 int silence_length_max_;
35 37
36 // Lengths of the current silence period in samples. 38 // Lengths of the current silence period in samples.
37 int silence_length_; 39 int silence_length_;
38 }; 40 };
39 41
40 } // namespace remoting 42 } // namespace remoting
41 43
42 #endif // REMOTING_HOST_AUDIO_SILENCE_DETECTOR_H_ 44 #endif // REMOTING_HOST_AUDIO_SILENCE_DETECTOR_H_
OLDNEW
« no previous file with comments | « remoting/host/audio_pump_unittest.cc ('k') | remoting/host/audio_silence_detector.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698