blob: 17840d1a28470a06e85ba8e938c391dccf30503a [file] [log] [blame]
henrik.lundin@webrtc.orgd94659d2013-01-29 12:09:21 +00001/*
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 Bonadei92ea95e2017-09-15 06:47:31 +020013#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"
Jakob Ivarsson‎423bae42019-03-05 09:16:06 +000020#include "test/field_trial.h"
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020021#include "test/gtest.h"
22#include "test/mock_audio_decoder_factory.h"
henrik.lundin@webrtc.orgd94659d2013-01-29 12:09:21 +000023
24namespace webrtc {
25
26TEST(DecisionLogic, CreateAndDestroy) {
27 int fs_hz = 8000;
28 int output_size_samples = fs_hz / 100; // Samples per 10 ms.
kwiberg5178ee82016-05-03 01:39:01 -070029 DecoderDatabase decoder_database(
Danil Chapovalovb6021232018-06-19 13:26:36 +020030 new rtc::RefCountedObject<MockAudioDecoderFactory>, absl::nullopt);
henrik.lundin84f8cd62016-04-26 07:45:16 -070031 TickTimer tick_timer;
32 PacketBuffer packet_buffer(10, &tick_timer);
Jakob Ivarsson39b934b2019-01-10 10:28:23 +010033 DelayPeakDetector delay_peak_detector(&tick_timer, false);
Jakob Ivarsson1eb3d7e2019-02-21 15:42:31 +010034 auto delay_manager =
35 DelayManager::Create(240, 0, false, &delay_peak_detector, &tick_timer);
henrik.lundin@webrtc.orgd94659d2013-01-29 12:09:21 +000036 BufferLevelFilter buffer_level_filter;
Henrik Lundin47b17dc2016-05-10 10:20:59 +020037 DecisionLogic* logic = DecisionLogic::Create(
Henrik Lundin7687ad52018-07-02 10:14:46 +020038 fs_hz, output_size_samples, false, &decoder_database, packet_buffer,
Jakob Ivarsson1eb3d7e2019-02-21 15:42:31 +010039 delay_manager.get(), &buffer_level_filter, &tick_timer);
henrik.lundin@webrtc.orgd94659d2013-01-29 12:09:21 +000040 delete logic;
41}
42
henrik.lundin@webrtc.orgd94659d2013-01-29 12:09:21 +000043// TODO(hlundin): Write more tests.
44
45} // namespace webrtc