Chromium Code Reviews

Side by Side Diff: webrtc/modules/audio_mixer/gain_change_calculator.h

Issue 2776113002: Send data from mixer to APM limiter more often. (Closed)
Patch Set: Conversions due to Win warnings. Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff |
OLDNEW
(Empty)
1 /*
2 * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved.
3 *
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
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
11 #ifndef WEBRTC_MODULES_AUDIO_MIXER_GAIN_CHANGE_CALCULATOR_H_
12 #define WEBRTC_MODULES_AUDIO_MIXER_GAIN_CHANGE_CALCULATOR_H_
13
14 #include "webrtc/base/array_view.h"
15
16 namespace webrtc {
17
18 class GainChangeCalculator {
19 public:
20 // The 'out' signal is assumed to be produced from 'in' by applying
21 // a smoothly varying gain. This method computes variations of the
22 // gain and handles special cases when the samples are small.
23 float CalculateGainChange(rtc::ArrayView<const int16_t> in,
24 rtc::ArrayView<const int16_t> out);
25
26 private:
27 void CalculateGain(rtc::ArrayView<const int16_t> in,
28 rtc::ArrayView<const int16_t> out,
29 rtc::ArrayView<float> gain);
30
31 float CalculateDifferences(rtc::ArrayView<const float> values);
32 float last_value_ = 0.f;
33 float last_reliable_gain_ = 1.0f;
34 };
35
36 } // namespace webrtc
37
38 #endif // WEBRTC_MODULES_AUDIO_MIXER_GAIN_CHANGE_CALCULATOR_H_
OLDNEW

Powered by Google App Engine