henrik.lundin@webrtc.org | d94659d | 2013-01-29 12:09:21 +0000 | [diff] [blame] | 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 | |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 13 | #include "modules/audio_coding/neteq/decision_logic.h" |
| 14 | #include "modules/audio_coding/neteq/buffer_level_filter.h" |
| 15 | #include "modules/audio_coding/neteq/decoder_database.h" |
| 16 | #include "modules/audio_coding/neteq/delay_manager.h" |
| 17 | #include "modules/audio_coding/neteq/delay_peak_detector.h" |
| 18 | #include "modules/audio_coding/neteq/packet_buffer.h" |
| 19 | #include "modules/audio_coding/neteq/tick_timer.h" |
| 20 | #include "test/gtest.h" |
| 21 | #include "test/mock_audio_decoder_factory.h" |
henrik.lundin@webrtc.org | d94659d | 2013-01-29 12:09:21 +0000 | [diff] [blame] | 22 | |
| 23 | namespace webrtc { |
| 24 | |
| 25 | TEST(DecisionLogic, CreateAndDestroy) { |
| 26 | int fs_hz = 8000; |
| 27 | int output_size_samples = fs_hz / 100; // Samples per 10 ms. |
kwiberg | 5178ee8 | 2016-05-03 01:39:01 -0700 | [diff] [blame] | 28 | DecoderDatabase decoder_database( |
Danil Chapovalov | b602123 | 2018-06-19 13:26:36 +0200 | [diff] [blame] | 29 | new rtc::RefCountedObject<MockAudioDecoderFactory>, absl::nullopt); |
henrik.lundin | 84f8cd6 | 2016-04-26 07:45:16 -0700 | [diff] [blame] | 30 | TickTimer tick_timer; |
| 31 | PacketBuffer packet_buffer(10, &tick_timer); |
henrik.lundin | f393370 | 2016-04-28 01:53:52 -0700 | [diff] [blame] | 32 | DelayPeakDetector delay_peak_detector(&tick_timer); |
henrik.lundin | 8f8c96d | 2016-04-28 23:19:20 -0700 | [diff] [blame] | 33 | DelayManager delay_manager(240, &delay_peak_detector, &tick_timer); |
henrik.lundin@webrtc.org | d94659d | 2013-01-29 12:09:21 +0000 | [diff] [blame] | 34 | BufferLevelFilter buffer_level_filter; |
Henrik Lundin | 47b17dc | 2016-05-10 10:20:59 +0200 | [diff] [blame] | 35 | DecisionLogic* logic = DecisionLogic::Create( |
Henrik Lundin | 7687ad5 | 2018-07-02 10:14:46 +0200 | [diff] [blame^] | 36 | fs_hz, output_size_samples, false, &decoder_database, packet_buffer, |
Henrik Lundin | 47b17dc | 2016-05-10 10:20:59 +0200 | [diff] [blame] | 37 | &delay_manager, &buffer_level_filter, &tick_timer); |
henrik.lundin@webrtc.org | d94659d | 2013-01-29 12:09:21 +0000 | [diff] [blame] | 38 | delete logic; |
| 39 | } |
| 40 | |
| 41 | // TODO(hlundin): Write more tests. |
| 42 | |
| 43 | } // namespace webrtc |