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

Unified Diff: webrtc/modules/audio_processing/aec3/render_signal_analyzer_unittest.cc

Issue 2782423003: Major updates to the echo removal functionality in AEC3 (Closed)
Patch Set: Added initialization of uninitialized vector 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 side-by-side diff with in-line comments
Download patch
Index: webrtc/modules/audio_processing/aec3/render_signal_analyzer_unittest.cc
diff --git a/webrtc/modules/audio_processing/aec3/render_signal_analyzer_unittest.cc b/webrtc/modules/audio_processing/aec3/render_signal_analyzer_unittest.cc
index 345f6c9f8c13205f6c19bdc316803e70d92d0ffa..9b25f181c17265ae0b4442d7c194cffafd02518e 100644
--- a/webrtc/modules/audio_processing/aec3/render_signal_analyzer_unittest.cc
+++ b/webrtc/modules/audio_processing/aec3/render_signal_analyzer_unittest.cc
@@ -10,9 +10,6 @@
#include "webrtc/modules/audio_processing/aec3/render_signal_analyzer.h"
-// TODO(peah): Reactivate once the next CL has landed.
-#if 0
-
#include <math.h>
#include <array>
#include <vector>
@@ -21,8 +18,8 @@
#include "webrtc/base/random.h"
#include "webrtc/modules/audio_processing/aec3/aec3_common.h"
#include "webrtc/modules/audio_processing/aec3/aec3_fft.h"
-#include "webrtc/modules/audio_processing/aec3/fft_buffer.h"
#include "webrtc/modules/audio_processing/aec3/fft_data.h"
+#include "webrtc/modules/audio_processing/aec3/render_buffer.h"
#include "webrtc/modules/audio_processing/test/echo_canceller_test_tools.h"
#include "webrtc/test/gtest.h"
@@ -59,19 +56,20 @@ TEST(RenderSignalAnalyzer, NullMaskOutput) {
TEST(RenderSignalAnalyzer, NoFalseDetectionOfNarrowBands) {
RenderSignalAnalyzer analyzer;
Random random_generator(42U);
- std::vector<float> x(kBlockSize, 0.f);
+ std::vector<std::vector<float>> x(3, std::vector<float>(kBlockSize, 0.f));
std::array<float, kBlockSize> x_old;
FftData X;
Aec3Fft fft;
- FftBuffer X_buffer(Aec3Optimization::kNone, 1, std::vector<size_t>(1, 1));
+ RenderBuffer render_buffer(Aec3Optimization::kNone, 3, 1,
+ std::vector<size_t>(1, 1));
std::array<float, kFftLengthBy2Plus1> mask;
x_old.fill(0.f);
for (size_t k = 0; k < 100; ++k) {
- RandomizeSampleVector(&random_generator, x);
- fft.PaddedFft(x, x_old, &X);
- X_buffer.Insert(X);
- analyzer.Update(X_buffer, rtc::Optional<size_t>(0));
+ RandomizeSampleVector(&random_generator, x[0]);
+ fft.PaddedFft(x[0], x_old, &X);
+ render_buffer.Insert(x);
+ analyzer.Update(render_buffer, rtc::Optional<size_t>(0));
}
mask.fill(1.f);
@@ -85,11 +83,11 @@ TEST(RenderSignalAnalyzer, NoFalseDetectionOfNarrowBands) {
TEST(RenderSignalAnalyzer, NarrowBandDetection) {
RenderSignalAnalyzer analyzer;
Random random_generator(42U);
- std::vector<float> x(kBlockSize, 0.f);
+ std::vector<std::vector<float>> x(3, std::vector<float>(kBlockSize, 0.f));
std::array<float, kBlockSize> x_old;
- FftData X;
Aec3Fft fft;
- FftBuffer X_buffer(Aec3Optimization::kNone, 1, std::vector<size_t>(1, 1));
+ RenderBuffer render_buffer(Aec3Optimization::kNone, 3, 1,
+ std::vector<size_t>(1, 1));
std::array<float, kFftLengthBy2Plus1> mask;
x_old.fill(0.f);
constexpr int kSinusFrequencyBin = 32;
@@ -98,12 +96,10 @@ TEST(RenderSignalAnalyzer, NarrowBandDetection) {
size_t sample_counter = 0;
for (size_t k = 0; k < 100; ++k) {
ProduceSinusoid(16000, 16000 / 2 * kSinusFrequencyBin / kFftLengthBy2,
- &sample_counter, x);
- fft.PaddedFft(x, x_old, &X);
- X_buffer.Insert(X);
- analyzer.Update(
- X_buffer,
- known_delay ? rtc::Optional<size_t>(0) : rtc::Optional<size_t>());
+ &sample_counter, x[0]);
+ render_buffer.Insert(x);
+ analyzer.Update(render_buffer, known_delay ? rtc::Optional<size_t>(0)
+ : rtc::Optional<size_t>());
}
};
@@ -124,5 +120,3 @@ TEST(RenderSignalAnalyzer, NarrowBandDetection) {
}
} // namespace webrtc
-
-#endif

Powered by Google App Engine
This is Rietveld 408576698