| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2016 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 #include <cmath> | 10 #include <cmath> |
| 11 #include <memory> | 11 #include <memory> |
| 12 #include <vector> | 12 #include <vector> |
| 13 | 13 |
| 14 #include "webrtc/api/array_view.h" |
| 14 #include "webrtc/modules/audio_processing/rms_level.h" | 15 #include "webrtc/modules/audio_processing/rms_level.h" |
| 15 #include "webrtc/rtc_base/array_view.h" | |
| 16 #include "webrtc/rtc_base/checks.h" | 16 #include "webrtc/rtc_base/checks.h" |
| 17 #include "webrtc/rtc_base/mathutils.h" | 17 #include "webrtc/rtc_base/mathutils.h" |
| 18 #include "webrtc/rtc_base/safe_conversions.h" | 18 #include "webrtc/rtc_base/safe_conversions.h" |
| 19 #include "webrtc/test/gtest.h" | 19 #include "webrtc/test/gtest.h" |
| 20 | 20 |
| 21 namespace webrtc { | 21 namespace webrtc { |
| 22 namespace { | 22 namespace { |
| 23 constexpr int kSampleRateHz = 48000; | 23 constexpr int kSampleRateHz = 48000; |
| 24 constexpr size_t kBlockSizeSamples = kSampleRateHz / 100; | 24 constexpr size_t kBlockSizeSamples = kSampleRateHz / 100; |
| 25 | 25 |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 auto y = CreateSinusoid(1000, INT16_MAX / 2, kBlockSizeSamples * 2); | 141 auto y = CreateSinusoid(1000, INT16_MAX / 2, kBlockSizeSamples * 2); |
| 142 level->Analyze(y); | 142 level->Analyze(y); |
| 143 auto stats = level->AverageAndPeak(); | 143 auto stats = level->AverageAndPeak(); |
| 144 // Expect all stats to only be influenced by the last signal (y), since the | 144 // Expect all stats to only be influenced by the last signal (y), since the |
| 145 // changed block size should reset the stats. | 145 // changed block size should reset the stats. |
| 146 EXPECT_EQ(9, stats.average); | 146 EXPECT_EQ(9, stats.average); |
| 147 EXPECT_EQ(9, stats.peak); | 147 EXPECT_EQ(9, stats.peak); |
| 148 } | 148 } |
| 149 | 149 |
| 150 } // namespace webrtc | 150 } // namespace webrtc |
| OLD | NEW |