Change StartAecDump methods to work with FILE* and FileWrapper

Bug: webrtc:6463
Change-Id: Id275975decb9b2876021ced19ee9f279b07bea53
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/140283
Commit-Queue: Niels Moller <nisse@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Reviewed-by: Alex Loiko <aleloi@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#28233}
This commit is contained in:
Niels Möller
2019-06-11 14:04:16 +02:00
committed by Commit Bot
parent 7742b21839
commit e8e4dc4c8b
17 changed files with 45 additions and 39 deletions

View File

@ -1581,14 +1581,14 @@ TEST_F(ApmTest, DebugDumpFromFileHandle) {
const std::string filename =
test::TempFilename(test::OutputPath(), "debug_aec");
FILE* fid = fopen(filename.c_str(), "w");
ASSERT_TRUE(fid);
FileWrapper f = FileWrapper::OpenWriteOnly(filename.c_str());
ASSERT_TRUE(f.is_open());
#ifdef WEBRTC_AUDIOPROC_DEBUG_DUMP
// Stopping without having started should be OK.
apm_->DetachAecDump();
auto aec_dump = AecDumpFactory::Create(fid, -1, &worker_queue);
auto aec_dump = AecDumpFactory::Create(std::move(f), -1, &worker_queue);
EXPECT_TRUE(aec_dump);
apm_->AttachAecDump(std::move(aec_dump));
EXPECT_EQ(apm_->kNoError, apm_->ProcessReverseStream(revframe_));
@ -1596,14 +1596,12 @@ TEST_F(ApmTest, DebugDumpFromFileHandle) {
apm_->DetachAecDump();
// Verify the file has been written.
fid = fopen(filename.c_str(), "r");
FILE* fid = fopen(filename.c_str(), "r");
ASSERT_TRUE(fid != NULL);
// Clean it up.
ASSERT_EQ(0, fclose(fid));
ASSERT_EQ(0, remove(filename.c_str()));
#else
ASSERT_EQ(0, fclose(fid));
#endif // WEBRTC_AUDIOPROC_DEBUG_DUMP
}