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_dump/aec_dump_factory.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 |
| 19 TEST(AecDumper, APICallsDoNotCrash) { |
| 20 // Note order of initialization: factory first (has event pool), |
| 21 // then task queue (looks at event pool), then aec_dumper (posts |
| 22 // stuff to task queue). |
| 23 rtc::TaskQueue file_writer_queue("file_writer_queue"); |
| 24 auto aec_dump = |
| 25 webrtc::AecDumpFactory::Create("file1", -1, &file_writer_queue); |
| 26 EXPECT_TRUE(aec_dump); |
| 27 |
| 28 // TODO(aleloi): wait a while and check that file1 is |
| 29 // opened. Perhaps add a Flush/join method? Or call d-tor? |
| 30 aec_dump = webrtc::AecDumpFactory::Create("file2", -1, &file_writer_queue); |
| 31 |
| 32 aec_dump = webrtc::AecDumpFactory::Create("file3", 10, &file_writer_queue); |
| 33 |
| 34 // TODO(aleloi): open from handle. |
| 35 |
| 36 const webrtc::AudioFrame frame; |
| 37 aec_dump->WriteRenderStreamMessage(frame); |
| 38 |
| 39 auto capture_stream_info = aec_dump->GetCaptureStreamInfo(); |
| 40 |
| 41 capture_stream_info->AddInput(frame); |
| 42 capture_stream_info->AddOutput(frame); |
| 43 |
| 44 aec_dump->WriteCaptureStreamMessage(std::move(capture_stream_info)); |
| 45 |
| 46 webrtc::InternalAPMConfig apm_config; |
| 47 aec_dump->WriteConfig(apm_config, false); |
| 48 |
| 49 aec_dump->WriteConfig(apm_config, true); |
| 50 |
| 51 webrtc::ProcessingConfig processing_config; |
| 52 aec_dump->WriteInitMessage(processing_config); |
| 53 } |
OLD | NEW |