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

Unified Diff: webrtc/modules/audio_processing/audio_processing_unittest.cc

Issue 2747123007: Test submission of complete AEC-dump refactoring. (Closed)
Patch Set: Most of Karl's comments addressed. Created 3 years, 9 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/audio_processing_unittest.cc
diff --git a/webrtc/modules/audio_processing/audio_processing_unittest.cc b/webrtc/modules/audio_processing/audio_processing_unittest.cc
index b52acce230c4d980feb25d8aa89a6f3092b619d1..dc6b098d942162775b69f2d56d54e7fb107592fb 100644
--- a/webrtc/modules/audio_processing/audio_processing_unittest.cc
+++ b/webrtc/modules/audio_processing/audio_processing_unittest.cc
@@ -20,6 +20,8 @@
#include "webrtc/base/checks.h"
#include "webrtc/base/gtest_prod_util.h"
#include "webrtc/base/ignore_wundef.h"
+#include "webrtc/base/task_queue.h"
+#include "webrtc/base/thread.h"
#include "webrtc/common_audio/include/audio_util.h"
#include "webrtc/common_audio/resampler/include/push_resampler.h"
#include "webrtc/common_audio/resampler/push_sinc_resampler.h"
@@ -410,17 +412,17 @@ class ApmTest : public ::testing::Test {
ApmTest::ApmTest()
: output_path_(test::OutputPath()),
#if defined(WEBRTC_AUDIOPROC_FIXED_PROFILE)
- ref_filename_(test::ResourcePath("audio_processing/output_data_fixed",
- "pb")),
+ ref_filename_(
+ test::ResourcePath("audio_processing/output_data_fixed", "pb")),
#elif defined(WEBRTC_AUDIOPROC_FLOAT_PROFILE)
#if defined(WEBRTC_MAC)
// A different file for Mac is needed because on this platform the AEC
// constant |kFixedDelayMs| value is 20 and not 50 as it is on the rest.
- ref_filename_(test::ResourcePath("audio_processing/output_data_mac",
- "pb")),
+ ref_filename_(
+ test::ResourcePath("audio_processing/output_data_mac", "pb")),
#else
- ref_filename_(test::ResourcePath("audio_processing/output_data_float",
- "pb")),
+ ref_filename_(
+ test::ResourcePath("audio_processing/output_data_float", "pb")),
#endif
#endif
frame_(NULL),
@@ -581,6 +583,7 @@ void ApmTest::ProcessWithDefaultStreamParameters(AudioFrame* frame) {
}
int ApmTest::ProcessStreamChooser(Format format) {
+ rtc::Thread::Current()->SleepMs(1);
if (format == kIntFormat) {
return apm_->ProcessStream(frame_);
}
@@ -594,6 +597,7 @@ int ApmTest::ProcessStreamChooser(Format format) {
}
int ApmTest::AnalyzeReverseStreamChooser(Format format) {
+ rtc::Thread::Current()->SleepMs(1);
if (format == kIntFormat) {
return apm_->ProcessReverseStream(revframe_);
}
@@ -1706,6 +1710,7 @@ void ApmTest::ProcessDebugDump(const std::string& in_filename,
const std::string& out_filename,
Format format,
int max_size_bytes) {
+ rtc::TaskQueue worker_queue("ApmTest_worker_queue");
FILE* in_file = fopen(in_filename.c_str(), "rb");
ASSERT_TRUE(in_file != NULL);
audioproc::Event event_msg;
@@ -1733,8 +1738,8 @@ void ApmTest::ProcessDebugDump(const std::string& in_filename,
if (first_init) {
// StartDebugRecording() writes an additional init message. Don't start
// recording until after the first init to avoid the extra message.
- EXPECT_NOERR(
- apm_->StartDebugRecording(out_filename.c_str(), max_size_bytes));
+ EXPECT_NOERR(apm_->StartDebugRecording(out_filename.c_str(),
+ max_size_bytes, &worker_queue));
first_init = false;
}
@@ -1870,16 +1875,16 @@ TEST_F(ApmTest, VerifyDebugDumpFloat) {
// TODO(andrew): expand test to verify output.
TEST_F(ApmTest, DebugDump) {
+ rtc::TaskQueue worker_queue("ApmTest_worker_queue");
const std::string filename =
test::TempFilename(test::OutputPath(), "debug_aec");
- EXPECT_EQ(apm_->kNullPointerError,
- apm_->StartDebugRecording(static_cast<const char*>(NULL), -1));
#ifdef WEBRTC_AUDIOPROC_DEBUG_DUMP
// Stopping without having started should be OK.
EXPECT_EQ(apm_->kNoError, apm_->StopDebugRecording());
- EXPECT_EQ(apm_->kNoError, apm_->StartDebugRecording(filename.c_str(), -1));
+ EXPECT_EQ(apm_->kNoError,
+ apm_->StartDebugRecording(filename.c_str(), -1, &worker_queue));
EXPECT_EQ(apm_->kNoError, apm_->ProcessStream(frame_));
EXPECT_EQ(apm_->kNoError, apm_->ProcessReverseStream(revframe_));
EXPECT_EQ(apm_->kNoError, apm_->StopDebugRecording());
@@ -1903,18 +1908,17 @@ TEST_F(ApmTest, DebugDump) {
// TODO(andrew): expand test to verify output.
TEST_F(ApmTest, DebugDumpFromFileHandle) {
- FILE* fid = NULL;
- EXPECT_EQ(apm_->kNullPointerError, apm_->StartDebugRecording(fid, -1));
+ rtc::TaskQueue worker_queue("ApmTest_worker_queue");
const std::string filename =
test::TempFilename(test::OutputPath(), "debug_aec");
- fid = fopen(filename.c_str(), "w");
+ FILE* fid = fopen(filename.c_str(), "w");
ASSERT_TRUE(fid);
#ifdef WEBRTC_AUDIOPROC_DEBUG_DUMP
// Stopping without having started should be OK.
EXPECT_EQ(apm_->kNoError, apm_->StopDebugRecording());
- EXPECT_EQ(apm_->kNoError, apm_->StartDebugRecording(fid, -1));
+ EXPECT_EQ(apm_->kNoError, apm_->StartDebugRecording(fid, -1, &worker_queue));
EXPECT_EQ(apm_->kNoError, apm_->ProcessReverseStream(revframe_));
EXPECT_EQ(apm_->kNoError, apm_->ProcessStream(frame_));
EXPECT_EQ(apm_->kNoError, apm_->StopDebugRecording());

Powered by Google App Engine
This is Rietveld 408576698