blob: 9ba3b9d380b603b624ed65034fbbcf89f20b34aa [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"
Jonas Olssona4d87372019-07-05 19:08:33 +020014
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020015#include "modules/audio_coding/neteq/buffer_level_filter.h"
16#include "modules/audio_coding/neteq/decoder_database.h"
17#include "modules/audio_coding/neteq/delay_manager.h"
18#include "modules/audio_coding/neteq/delay_peak_detector.h"
Ivo Creusen53a31f72019-10-24 15:20:39 +020019#include "modules/audio_coding/neteq/neteq_controller.h"
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020020#include "modules/audio_coding/neteq/packet_buffer.h"
Jakob Ivarsson44507082019-03-05 16:59:03 +010021#include "modules/audio_coding/neteq/statistics_calculator.h"
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020022#include "modules/audio_coding/neteq/tick_timer.h"
23#include "test/gtest.h"
24#include "test/mock_audio_decoder_factory.h"
henrik.lundin@webrtc.orgd94659d2013-01-29 12:09:21 +000025
26namespace webrtc {
27
28TEST(DecisionLogic, CreateAndDestroy) {
29 int fs_hz = 8000;
30 int output_size_samples = fs_hz / 100; // Samples per 10 ms.
kwiberg5178ee82016-05-03 01:39:01 -070031 DecoderDatabase decoder_database(
Danil Chapovalovb6021232018-06-19 13:26:36 +020032 new rtc::RefCountedObject<MockAudioDecoderFactory>, absl::nullopt);
henrik.lundin84f8cd62016-04-26 07:45:16 -070033 TickTimer tick_timer;
Jakob Ivarsson44507082019-03-05 16:59:03 +010034 StatisticsCalculator stats;
henrik.lundin84f8cd62016-04-26 07:45:16 -070035 PacketBuffer packet_buffer(10, &tick_timer);
henrik.lundin@webrtc.orgd94659d2013-01-29 12:09:21 +000036 BufferLevelFilter buffer_level_filter;
Ivo Creusen53a31f72019-10-24 15:20:39 +020037 NetEqController::Config config;
38 config.tick_timer = &tick_timer;
39 config.base_min_delay_ms = 0;
40 config.max_packets_in_buffer = 240;
41 config.enable_rtx_handling = false;
42 config.allow_time_stretching = true;
43 auto logic = std::make_unique<DecisionLogic>(std::move(config));
44 logic->SetSampleRate(fs_hz, output_size_samples);
henrik.lundin@webrtc.orgd94659d2013-01-29 12:09:21 +000045}
46
henrik.lundin@webrtc.orgd94659d2013-01-29 12:09:21 +000047// TODO(hlundin): Write more tests.
48
49} // namespace webrtc