blob: d9563dbd94587f9f453007266834b42da939f4d2 [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
turaj@webrtc.org6ea3d1c2013-10-02 21:44:33 +000011#ifndef WEBRTC_MODULES_AUDIO_CODING_MAIN_TEST_ISACTEST_H_
12#define WEBRTC_MODULES_AUDIO_CODING_MAIN_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
turaj@webrtc.org6ea3d1c2013-10-02 21:44:33 +000016#include "webrtc/common.h"
17#include "webrtc/common_types.h"
18#include "webrtc/modules/audio_coding/main/interface/audio_coding_module.h"
19#include "webrtc/modules/audio_coding/main/test/ACMTest.h"
20#include "webrtc/modules/audio_coding/main/test/Channel.h"
21#include "webrtc/modules/audio_coding/main/test/PCMFile.h"
22#include "webrtc/modules/audio_coding/main/test/utility.h"
turaj@webrtc.org55e17232013-10-29 04:40:09 +000023#include "webrtc/system_wrappers/interface/scoped_ptr.h"
niklase@google.com470e71d2011-07-07 08:21:25 +000024
25#define MAX_FILE_NAME_LENGTH_BYTE 500
26#define NO_OF_CLIENTS 15
27
tina.legrand@webrtc.org554ae1a2011-12-16 10:09:04 +000028namespace webrtc {
29
turaj@webrtc.org6ea3d1c2013-10-02 21:44:33 +000030class Config;
31
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000032struct ACMTestISACConfig {
33 int32_t currentRateBitPerSec;
34 int16_t currentFrameSizeMsec;
35 uint32_t maxRateBitPerSec;
36 int16_t maxPayloadSizeByte;
37 int16_t encodingMode;
38 uint32_t initRateBitPerSec;
39 int16_t initFrameSizeInMsec;
40 bool enforceFrameSize;
niklase@google.com470e71d2011-07-07 08:21:25 +000041};
42
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000043class ISACTest : public ACMTest {
44 public:
turaj@webrtc.org6ea3d1c2013-10-02 21:44:33 +000045 ISACTest(int testMode, const Config& config);
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000046 ~ISACTest();
niklase@google.com470e71d2011-07-07 08:21:25 +000047
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000048 void Perform();
49 private:
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +000050 void Setup();
niklase@google.com470e71d2011-07-07 08:21:25 +000051
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000052 void Run10ms();
niklase@google.com470e71d2011-07-07 08:21:25 +000053
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000054 void EncodeDecode(int testNr, ACMTestISACConfig& wbISACConfig,
55 ACMTestISACConfig& swbISACConfig);
pbos@webrtc.org0946a562013-04-09 00:28:06 +000056
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000057 void SwitchingSamplingRate(int testNr, int maxSampRateChange);
niklase@google.com470e71d2011-07-07 08:21:25 +000058
turaj@webrtc.org55e17232013-10-29 04:40:09 +000059 scoped_ptr<AudioCodingModule> _acmA;
60 scoped_ptr<AudioCodingModule> _acmB;
niklase@google.com470e71d2011-07-07 08:21:25 +000061
turaj@webrtc.org55e17232013-10-29 04:40:09 +000062 scoped_ptr<Channel> _channel_A2B;
63 scoped_ptr<Channel> _channel_B2A;
niklase@google.com470e71d2011-07-07 08:21:25 +000064
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000065 PCMFile _inFileA;
66 PCMFile _inFileB;
niklase@google.com470e71d2011-07-07 08:21:25 +000067
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000068 PCMFile _outFileA;
69 PCMFile _outFileB;
niklase@google.com470e71d2011-07-07 08:21:25 +000070
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000071 uint8_t _idISAC16kHz;
72 uint8_t _idISAC32kHz;
73 CodecInst _paramISAC16kHz;
74 CodecInst _paramISAC32kHz;
niklase@google.com470e71d2011-07-07 08:21:25 +000075
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000076 std::string file_name_swb_;
niklase@google.com470e71d2011-07-07 08:21:25 +000077
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000078 ACMTestTimer _myTimer;
79 int _testMode;
niklase@google.com470e71d2011-07-07 08:21:25 +000080};
81
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000082} // namespace webrtc
niklase@google.com470e71d2011-07-07 08:21:25 +000083
turaj@webrtc.org6ea3d1c2013-10-02 21:44:33 +000084#endif // WEBRTC_MODULES_AUDIO_CODING_MAIN_TEST_ISACTEST_H_