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..1d30a834082810c0a976ebe0c47b1dee857b0149 100644 |
--- a/webrtc/modules/audio_processing/audio_processing_unittest.cc |
+++ b/webrtc/modules/audio_processing/audio_processing_unittest.cc |
@@ -20,10 +20,13 @@ |
#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" |
#include "webrtc/common_audio/signal_processing/include/signal_processing_library.h" |
+#include "webrtc/modules/audio_processing/aec_dump/aec_dump_factory.h" |
#include "webrtc/modules/audio_processing/audio_processing_impl.h" |
#include "webrtc/modules/audio_processing/beamformer/mock_nonlinear_beamformer.h" |
#include "webrtc/modules/audio_processing/common.h" |
@@ -410,17 +413,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 +584,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 +598,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 +1711,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 +1739,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)); |
+ apm_->StartDebugRecording(AecDumpFactory::Create( |
+ out_filename, max_size_bytes, &worker_queue)); |
first_init = false; |
} |
@@ -1790,7 +1796,7 @@ void ApmTest::ProcessDebugDump(const std::string& in_filename, |
ProcessStreamChooser(format); |
} |
} |
- EXPECT_NOERR(apm_->StopDebugRecording()); |
+ apm_->StopDebugRecording(); |
fclose(in_file); |
} |
@@ -1870,19 +1876,19 @@ 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()); |
+ apm_->StopDebugRecording(); |
- EXPECT_EQ(apm_->kNoError, apm_->StartDebugRecording(filename.c_str(), -1)); |
+ apm_->StartDebugRecording( |
+ webrtc::AecDumpFactory::Create(filename, -1, &worker_queue)); |
EXPECT_EQ(apm_->kNoError, apm_->ProcessStream(frame_)); |
EXPECT_EQ(apm_->kNoError, apm_->ProcessReverseStream(revframe_)); |
- EXPECT_EQ(apm_->kNoError, apm_->StopDebugRecording()); |
+ apm_->StopDebugRecording(); |
// Verify the file has been written. |
FILE* fid = fopen(filename.c_str(), "r"); |
@@ -1903,21 +1909,21 @@ 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()); |
+ apm_->StopDebugRecording(); |
- EXPECT_EQ(apm_->kNoError, apm_->StartDebugRecording(fid, -1)); |
+ apm_->StartDebugRecording( |
+ webrtc::AecDumpFactory::Create(fid, -1, &worker_queue)); |
EXPECT_EQ(apm_->kNoError, apm_->ProcessReverseStream(revframe_)); |
EXPECT_EQ(apm_->kNoError, apm_->ProcessStream(frame_)); |
- EXPECT_EQ(apm_->kNoError, apm_->StopDebugRecording()); |
+ apm_->StopDebugRecording(); |
// Verify the file has been written. |
fid = fopen(filename.c_str(), "r"); |