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

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

Issue 2776113002: Send data from mixer to APM limiter more often. (Closed)
Patch Set: Test 1 not needed. Created 3 years, 8 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 /*
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_FRAME_COMBINER_TEST_TOOLS_H_
12 #define WEBRTC_MODULES_AUDIO_MIXER_FRAME_COMBINER_TEST_TOOLS_H_
13
14 #include "webrtc/base/array_view.h"
15 #include "webrtc/base/checks.h"
16 #include "webrtc/modules/include/module_common_types.h"
17
18 namespace webrtc {
19
20 class SineWaveGenerator {
ivoc 2017/03/28 16:11:06 Please move to sine_wave_generator.{cc,h}
aleloi 2017/03/28 17:10:13 Done.
21 public:
22 SineWaveGenerator(float wave_frequency_hz, int16_t amplitude)
23 : wave_frequency_hz_(wave_frequency_hz), amplitude_(amplitude) {
24 RTC_DCHECK_GT(wave_frequency_hz, 0);
25 }
26
27 // Produces appropriate output based on frame->num_channels_,
28 // frame->sample_rate_hz_.
29 void GenerateNextFrame(AudioFrame* frame);
30
31 private:
32 float phase_ = 0.f;
33 const float wave_frequency_hz_;
34 const int16_t amplitude_;
35 };
36
37 class GainChangeCalculator {
ivoc 2017/03/28 16:11:06 And this to gain_change_calculator.{cc,h}
aleloi 2017/03/28 17:10:13 Done.
38 public:
39 // The 'out' signal is assumed to be produced from 'in' by applying
40 // a smoothly varying gain. This method computes variations of the
41 // gain and handles special cases when the samples are small.
42 float CalculateGainChange(rtc::ArrayView<const int16_t> in,
43 rtc::ArrayView<const int16_t> out);
44
45 private:
46 void CalculateGain(rtc::ArrayView<const int16_t> in,
47 rtc::ArrayView<const int16_t> out,
48 rtc::ArrayView<float> gain);
49
50 float CalculateDifferences(rtc::ArrayView<const float> values);
51 float last_value_ = 0.f;
52 float last_reliable_gain_ = 1.0f;
53 };
54
55 } // namespace webrtc
56
57 #endif // WEBRTC_MODULES_AUDIO_MIXER_FRAME_COMBINER_TEST_TOOLS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698