blob: 22c85b4aa49de3742b491a61951a04a186e7a116 [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"
20#include "modules/audio_coding/test/ACMTest.h"
21#include "modules/audio_coding/test/Channel.h"
22#include "modules/audio_coding/test/PCMFile.h"
23#include "modules/audio_coding/test/utility.h"
niklase@google.com470e71d2011-07-07 08:21:25 +000024
25#define MAX_FILE_NAME_LENGTH_BYTE 500
Yves Gerey665174f2018-06-19 15:03:05 +020026#define NO_OF_CLIENTS 15
niklase@google.com470e71d2011-07-07 08:21:25 +000027
tina.legrand@webrtc.org554ae1a2011-12-16 10:09:04 +000028namespace webrtc {
29
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000030struct ACMTestISACConfig {
31 int32_t currentRateBitPerSec;
32 int16_t currentFrameSizeMsec;
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000033 int16_t encodingMode;
34 uint32_t initRateBitPerSec;
35 int16_t initFrameSizeInMsec;
36 bool enforceFrameSize;
niklase@google.com470e71d2011-07-07 08:21:25 +000037};
38
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000039class ISACTest : public ACMTest {
40 public:
henrik.lundin@webrtc.orgadaf8092014-04-17 08:29:10 +000041 explicit ISACTest(int testMode);
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000042 ~ISACTest();
niklase@google.com470e71d2011-07-07 08:21:25 +000043
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000044 void Perform();
Yves Gerey665174f2018-06-19 15:03:05 +020045
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000046 private:
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +000047 void Setup();
niklase@google.com470e71d2011-07-07 08:21:25 +000048
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000049 void Run10ms();
niklase@google.com470e71d2011-07-07 08:21:25 +000050
Yves Gerey665174f2018-06-19 15:03:05 +020051 void EncodeDecode(int testNr,
52 ACMTestISACConfig& wbISACConfig,
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000053 ACMTestISACConfig& swbISACConfig);
pbos@webrtc.org0946a562013-04-09 00:28:06 +000054
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000055 void SwitchingSamplingRate(int testNr, int maxSampRateChange);
niklase@google.com470e71d2011-07-07 08:21:25 +000056
kwiberg37478382016-02-14 20:40:57 -080057 std::unique_ptr<AudioCodingModule> _acmA;
58 std::unique_ptr<AudioCodingModule> _acmB;
niklase@google.com470e71d2011-07-07 08:21:25 +000059
kwiberg37478382016-02-14 20:40:57 -080060 std::unique_ptr<Channel> _channel_A2B;
61 std::unique_ptr<Channel> _channel_B2A;
niklase@google.com470e71d2011-07-07 08:21:25 +000062
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000063 PCMFile _inFileA;
64 PCMFile _inFileB;
niklase@google.com470e71d2011-07-07 08:21:25 +000065
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000066 PCMFile _outFileA;
67 PCMFile _outFileB;
niklase@google.com470e71d2011-07-07 08:21:25 +000068
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000069 uint8_t _idISAC16kHz;
70 uint8_t _idISAC32kHz;
71 CodecInst _paramISAC16kHz;
72 CodecInst _paramISAC32kHz;
niklase@google.com470e71d2011-07-07 08:21:25 +000073
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000074 std::string file_name_swb_;
niklase@google.com470e71d2011-07-07 08:21:25 +000075
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000076 ACMTestTimer _myTimer;
77 int _testMode;
niklase@google.com470e71d2011-07-07 08:21:25 +000078};
79
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000080} // namespace webrtc
niklase@google.com470e71d2011-07-07 08:21:25 +000081
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020082#endif // MODULES_AUDIO_CODING_TEST_ISACTEST_H_