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

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

Issue 2840773004: [Chromoting] Add AudioVolumeApplier to reduce the complexity and the dependency of kChannels (Closed)
Patch Set: Resolve review comments Created 3 years, 7 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
(Empty)
1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef REMOTING_HOST_AUDIO_VOLUME_FILTER_H_
6 #define REMOTING_HOST_AUDIO_VOLUME_FILTER_H_
7
8 #include "remoting/host/audio_silence_detector.h"
9
10 namespace remoting {
11
12 // A component to modify input audio sample to apply the audio level. This class
13 // is used on platforms which returns non-adjusted audio samples, e.g. Windows.
14 // This class supports frames with 16 bits per sample only.
15 class AudioVolumeFilter {
16 public:
17 // See AudioSilenceDetector for the meaning of |silence_threshold|.
18 explicit AudioVolumeFilter(int silence_threshold);
19 virtual ~AudioVolumeFilter();
20
21 // Adjusts audio samples in |data|. If the samples are silent before applying
22 // the volume level or the GetAudioLevel() returns 0, this function returns
23 // false. If |frames| is 0, this function also returns false.
24 bool Apply(int16_t* data, size_t frames);
25
26 // Updates the sampling rate and channels.
27 void Initialize(int sampling_rate, int channels);
28
29 protected:
30 // Returns the volume level in [0, 1].
Sergey Ulanov 2017/05/23 00:02:14 I think it's important to make it clear that this
Hzj_jie 2017/05/23 02:54:27 Done.
31 virtual float GetAudioLevel() = 0;
32
33 private:
34 AudioSilenceDetector silence_detector_;
35 };
36
37 } // namespace remoting
38
39 #endif // REMOTING_HOST_AUDIO_VOLUME_FILTER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698