Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 /* | |
| 2 * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved. | |
| 3 * | |
| 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 | |
| 6 * tree. An additional intellectual property rights grant can be found | |
| 7 * in the file PATENTS. All contributing project authors may | |
| 8 * be found in the AUTHORS file in the root of the source tree. | |
| 9 */ | |
| 10 | |
| 11 #include <utility> | |
| 12 | |
| 13 #include "webrtc/modules/audio_processing/aec_dumper/aec_dumper.h" | |
| 14 | |
| 15 #include "webrtc/base/task_queue.h" | |
| 16 #include "webrtc/modules/include/module_common_types.h" | |
| 17 #include "webrtc/test/gtest.h" | |
| 18 #include "webrtc/test/testsupport/fileutils.h" | |
| 19 | |
| 20 TEST(AecDumper, APICallsDoNotCrash) { | |
| 21 // Note order of initialization: factory first (has event pool), | |
| 22 // then task queue (looks at event pool), then aec_dumper (posts | |
| 23 // stuff to task queue). | |
| 24 rtc::TaskQueue file_writer_queue("file_writer_queue"); | |
| 25 | |
| 26 std::vector<std::string> file_names; | |
| 27 for (const std::string prefix : {"aecdumper0", "aecdumper1", "aecdumper2"}) { | |
| 28 file_names.push_back( | |
| 29 webrtc::test::TempFilename(webrtc::test::OutputPath(), prefix)); | |
| 30 } | |
| 31 | |
| 32 auto aec_dumper = | |
| 33 webrtc::AecDumper::Create(file_names[0], -1, &file_writer_queue); | |
| 34 EXPECT_TRUE(aec_dumper); | |
| 35 | |
| 36 aec_dumper = webrtc::AecDumper::Create(file_names[1], -1, &file_writer_queue); | |
| 37 | |
| 38 aec_dumper = webrtc::AecDumper::Create(file_names[2], 10, &file_writer_queue); | |
| 39 | |
| 40 FILE* fid = nullptr; | |
| 41 aec_dumper = webrtc::AecDumper::Create(fid, 10, &file_writer_queue); | |
| 42 | |
| 43 const webrtc::AudioFrame frame; | |
| 44 aec_dumper->WriteReverseStreamMessage(frame); | |
| 45 | |
| 46 auto capture_stream_info = aec_dumper->GetCaptureStreamInfo(); | |
| 47 | |
| 48 capture_stream_info->AddInput(frame); | |
|
peah-webrtc
2017/03/31 07:24:42
It would be good to have calls for AddInput/AddOu
aleloi
2017/04/06 15:46:11
Done.
| |
| 49 capture_stream_info->AddOutput(frame); | |
| 50 | |
| 51 aec_dumper->WriteCaptureStreamMessage(std::move(capture_stream_info)); | |
| 52 | |
| 53 webrtc::InternalAPMConfig apm_config; | |
| 54 aec_dumper->WriteConfig(apm_config, false); | |
| 55 | |
| 56 aec_dumper->WriteConfig(apm_config, true); | |
| 57 | |
| 58 webrtc::ProcessingConfig processing_config; | |
| 59 aec_dumper->WriteInitMessage(processing_config); | |
| 60 | |
| 61 for (const auto& filename : file_names) { | |
| 62 remove(filename.c_str()); | |
| 63 } | |
| 64 } | |
| OLD | NEW |