blob: 0b140b60325029c967a00492926b12d62bdfe64d [file] [log] [blame]
niklase@google.com470e71d2011-07-07 08:21:25 +00001/*
tina.legrand@webrtc.orgba468042012-08-17 10:38:28 +00002 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
niklase@google.com470e71d2011-07-07 08:21:25 +00003 *
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
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020011#ifndef MODULES_AUDIO_CODING_TEST_ISACTEST_H_
12#define MODULES_AUDIO_CODING_TEST_ISACTEST_H_
niklase@google.com470e71d2011-07-07 08:21:25 +000013
tina.legrand@webrtc.orgba468042012-08-17 10:38:28 +000014#include <string.h>
15
kwiberg37478382016-02-14 20:40:57 -080016#include <memory>
17
Mirko Bonadei71207422017-09-15 13:58:09 +020018#include "common_types.h" // NOLINT(build/include)
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020019#include "modules/audio_coding/include/audio_coding_module.h"
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020020#include "modules/audio_coding/test/Channel.h"
21#include "modules/audio_coding/test/PCMFile.h"
22#include "modules/audio_coding/test/utility.h"
niklase@google.com470e71d2011-07-07 08:21:25 +000023
24#define MAX_FILE_NAME_LENGTH_BYTE 500
Yves Gerey665174f2018-06-19 15:03:05 +020025#define NO_OF_CLIENTS 15
niklase@google.com470e71d2011-07-07 08:21:25 +000026
tina.legrand@webrtc.org554ae1a2011-12-16 10:09:04 +000027namespace webrtc {
28
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000029struct ACMTestISACConfig {
30 int32_t currentRateBitPerSec;
31 int16_t currentFrameSizeMsec;
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000032 int16_t encodingMode;
33 uint32_t initRateBitPerSec;
34 int16_t initFrameSizeInMsec;
35 bool enforceFrameSize;
niklase@google.com470e71d2011-07-07 08:21:25 +000036};
37
Karl Wiberg3ff52ff2018-10-01 12:31:22 +020038class ISACTest {
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000039 public:
henrik.lundin@webrtc.orgadaf8092014-04-17 08:29:10 +000040 explicit ISACTest(int testMode);
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000041 ~ISACTest();
niklase@google.com470e71d2011-07-07 08:21:25 +000042
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000043 void Perform();
Yves Gerey665174f2018-06-19 15:03:05 +020044
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000045 private:
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +000046 void Setup();
niklase@google.com470e71d2011-07-07 08:21:25 +000047
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000048 void Run10ms();
niklase@google.com470e71d2011-07-07 08:21:25 +000049
Yves Gerey665174f2018-06-19 15:03:05 +020050 void EncodeDecode(int testNr,
51 ACMTestISACConfig& wbISACConfig,
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000052 ACMTestISACConfig& swbISACConfig);
pbos@webrtc.org0946a562013-04-09 00:28:06 +000053
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000054 void SwitchingSamplingRate(int testNr, int maxSampRateChange);
niklase@google.com470e71d2011-07-07 08:21:25 +000055
kwiberg37478382016-02-14 20:40:57 -080056 std::unique_ptr<AudioCodingModule> _acmA;
57 std::unique_ptr<AudioCodingModule> _acmB;
niklase@google.com470e71d2011-07-07 08:21:25 +000058
kwiberg37478382016-02-14 20:40:57 -080059 std::unique_ptr<Channel> _channel_A2B;
60 std::unique_ptr<Channel> _channel_B2A;
niklase@google.com470e71d2011-07-07 08:21:25 +000061
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000062 PCMFile _inFileA;
63 PCMFile _inFileB;
niklase@google.com470e71d2011-07-07 08:21:25 +000064
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000065 PCMFile _outFileA;
66 PCMFile _outFileB;
niklase@google.com470e71d2011-07-07 08:21:25 +000067
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000068 uint8_t _idISAC16kHz;
69 uint8_t _idISAC32kHz;
70 CodecInst _paramISAC16kHz;
71 CodecInst _paramISAC32kHz;
niklase@google.com470e71d2011-07-07 08:21:25 +000072
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000073 std::string file_name_swb_;
niklase@google.com470e71d2011-07-07 08:21:25 +000074
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000075 ACMTestTimer _myTimer;
76 int _testMode;
niklase@google.com470e71d2011-07-07 08:21:25 +000077};
78
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000079} // namespace webrtc
niklase@google.com470e71d2011-07-07 08:21:25 +000080
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020081#endif // MODULES_AUDIO_CODING_TEST_ISACTEST_H_