blob: c5bb515437b24cbd955faec7f440618a4157d0fe [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
kjellander3e6db232015-11-26 04:44:54 -080011#ifndef WEBRTC_MODULES_AUDIO_CODING_TEST_ISACTEST_H_
12#define WEBRTC_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
kwiberg@webrtc.org00b8f6b2015-02-26 14:34:55 +000016#include "webrtc/base/scoped_ptr.h"
turaj@webrtc.org6ea3d1c2013-10-02 21:44:33 +000017#include "webrtc/common_types.h"
kjellander3e6db232015-11-26 04:44:54 -080018#include "webrtc/modules/audio_coding/include/audio_coding_module.h"
19#include "webrtc/modules/audio_coding/test/ACMTest.h"
20#include "webrtc/modules/audio_coding/test/Channel.h"
21#include "webrtc/modules/audio_coding/test/PCMFile.h"
22#include "webrtc/modules/audio_coding/test/utility.h"
niklase@google.com470e71d2011-07-07 08:21:25 +000023
24#define MAX_FILE_NAME_LENGTH_BYTE 500
25#define NO_OF_CLIENTS 15
26
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
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000038class ISACTest : public ACMTest {
39 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();
44 private:
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +000045 void Setup();
niklase@google.com470e71d2011-07-07 08:21:25 +000046
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000047 void Run10ms();
niklase@google.com470e71d2011-07-07 08:21:25 +000048
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000049 void EncodeDecode(int testNr, ACMTestISACConfig& wbISACConfig,
50 ACMTestISACConfig& swbISACConfig);
pbos@webrtc.org0946a562013-04-09 00:28:06 +000051
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000052 void SwitchingSamplingRate(int testNr, int maxSampRateChange);
niklase@google.com470e71d2011-07-07 08:21:25 +000053
kwiberg@webrtc.org00b8f6b2015-02-26 14:34:55 +000054 rtc::scoped_ptr<AudioCodingModule> _acmA;
55 rtc::scoped_ptr<AudioCodingModule> _acmB;
niklase@google.com470e71d2011-07-07 08:21:25 +000056
kwiberg@webrtc.org00b8f6b2015-02-26 14:34:55 +000057 rtc::scoped_ptr<Channel> _channel_A2B;
58 rtc::scoped_ptr<Channel> _channel_B2A;
niklase@google.com470e71d2011-07-07 08:21:25 +000059
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000060 PCMFile _inFileA;
61 PCMFile _inFileB;
niklase@google.com470e71d2011-07-07 08:21:25 +000062
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000063 PCMFile _outFileA;
64 PCMFile _outFileB;
niklase@google.com470e71d2011-07-07 08:21:25 +000065
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000066 uint8_t _idISAC16kHz;
67 uint8_t _idISAC32kHz;
68 CodecInst _paramISAC16kHz;
69 CodecInst _paramISAC32kHz;
niklase@google.com470e71d2011-07-07 08:21:25 +000070
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000071 std::string file_name_swb_;
niklase@google.com470e71d2011-07-07 08:21:25 +000072
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000073 ACMTestTimer _myTimer;
74 int _testMode;
niklase@google.com470e71d2011-07-07 08:21:25 +000075};
76
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000077} // namespace webrtc
niklase@google.com470e71d2011-07-07 08:21:25 +000078
kjellander3e6db232015-11-26 04:44:54 -080079#endif // WEBRTC_MODULES_AUDIO_CODING_TEST_ISACTEST_H_