blob: e0004763d912905239aad9f4f2bee6b0bb285335 [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 Bonadei92ea95e2017-09-15 06:47:31 +020018#include "modules/audio_coding/include/audio_coding_module.h"
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020019#include "modules/audio_coding/test/Channel.h"
20#include "modules/audio_coding/test/PCMFile.h"
niklase@google.com470e71d2011-07-07 08:21:25 +000021
tina.legrand@webrtc.org554ae1a2011-12-16 10:09:04 +000022namespace webrtc {
23
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000024struct ACMTestISACConfig {
25 int32_t currentRateBitPerSec;
26 int16_t currentFrameSizeMsec;
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000027 int16_t encodingMode;
28 uint32_t initRateBitPerSec;
29 int16_t initFrameSizeInMsec;
30 bool enforceFrameSize;
niklase@google.com470e71d2011-07-07 08:21:25 +000031};
32
Karl Wiberg3ff52ff2018-10-01 12:31:22 +020033class ISACTest {
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000034 public:
Fredrik Solenberg657b2962018-12-05 10:30:25 +010035 ISACTest();
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000036 ~ISACTest();
niklase@google.com470e71d2011-07-07 08:21:25 +000037
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000038 void Perform();
Yves Gerey665174f2018-06-19 15:03:05 +020039
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000040 private:
Fredrik Solenberg657b2962018-12-05 10:30:25 +010041 class ACMTestTimer {
42 public:
43 ACMTestTimer();
44 ~ACMTestTimer();
45
46 void Reset();
47 void Tick10ms();
48 void Tick1ms();
49 void Tick100ms();
50 void Tick1sec();
51 void CurrentTimeHMS(char* currTime);
52 void CurrentTime(unsigned long& h,
53 unsigned char& m,
54 unsigned char& s,
55 unsigned short& ms);
56
57 private:
58 void Adjust();
59
60 unsigned short _msec;
61 unsigned char _sec;
62 unsigned char _min;
63 unsigned long _hour;
64 };
65
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +000066 void Setup();
niklase@google.com470e71d2011-07-07 08:21:25 +000067
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000068 void Run10ms();
niklase@google.com470e71d2011-07-07 08:21:25 +000069
Yves Gerey665174f2018-06-19 15:03:05 +020070 void EncodeDecode(int testNr,
71 ACMTestISACConfig& wbISACConfig,
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000072 ACMTestISACConfig& swbISACConfig);
pbos@webrtc.org0946a562013-04-09 00:28:06 +000073
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000074 void SwitchingSamplingRate(int testNr, int maxSampRateChange);
niklase@google.com470e71d2011-07-07 08:21:25 +000075
kwiberg37478382016-02-14 20:40:57 -080076 std::unique_ptr<AudioCodingModule> _acmA;
77 std::unique_ptr<AudioCodingModule> _acmB;
niklase@google.com470e71d2011-07-07 08:21:25 +000078
kwiberg37478382016-02-14 20:40:57 -080079 std::unique_ptr<Channel> _channel_A2B;
80 std::unique_ptr<Channel> _channel_B2A;
niklase@google.com470e71d2011-07-07 08:21:25 +000081
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000082 PCMFile _inFileA;
83 PCMFile _inFileB;
niklase@google.com470e71d2011-07-07 08:21:25 +000084
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000085 PCMFile _outFileA;
86 PCMFile _outFileB;
niklase@google.com470e71d2011-07-07 08:21:25 +000087
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000088 std::string file_name_swb_;
niklase@google.com470e71d2011-07-07 08:21:25 +000089
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000090 ACMTestTimer _myTimer;
niklase@google.com470e71d2011-07-07 08:21:25 +000091};
92
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000093} // namespace webrtc
niklase@google.com470e71d2011-07-07 08:21:25 +000094
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020095#endif // MODULES_AUDIO_CODING_TEST_ISACTEST_H_