1 /* 2 * Copyright (c) 2012 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 // Unit tests for DecisionLogic class and derived classes. 12 13 #include "modules/audio_coding/neteq/decision_logic.h" 14 15 #include "api/neteq/neteq_controller.h" 16 #include "api/neteq/tick_timer.h" 17 #include "modules/audio_coding/neteq/buffer_level_filter.h" 18 #include "modules/audio_coding/neteq/decoder_database.h" 19 #include "modules/audio_coding/neteq/delay_manager.h" 20 #include "modules/audio_coding/neteq/packet_buffer.h" 21 #include "modules/audio_coding/neteq/statistics_calculator.h" 22 #include "test/gtest.h" 23 #include "test/mock_audio_decoder_factory.h" 24 25 namespace webrtc { 26 TEST(DecisionLogic,CreateAndDestroy)27TEST(DecisionLogic, CreateAndDestroy) { 28 int fs_hz = 8000; 29 int output_size_samples = fs_hz / 100; // Samples per 10 ms. 30 DecoderDatabase decoder_database( 31 new rtc::RefCountedObject<MockAudioDecoderFactory>, absl::nullopt); 32 TickTimer tick_timer; 33 StatisticsCalculator stats; 34 PacketBuffer packet_buffer(10, &tick_timer); 35 BufferLevelFilter buffer_level_filter; 36 NetEqController::Config config; 37 config.tick_timer = &tick_timer; 38 config.base_min_delay_ms = 0; 39 config.max_packets_in_buffer = 240; 40 config.enable_rtx_handling = false; 41 config.allow_time_stretching = true; 42 auto logic = std::make_unique<DecisionLogic>(std::move(config)); 43 logic->SetSampleRate(fs_hz, output_size_samples); 44 } 45 46 // TODO(hlundin): Write more tests. 47 48 } // namespace webrtc 49