blob: d6c6dc4e6d879443aab37166abacb53778c10daa [file] [log] [blame]
niklase@google.com470e71d2011-07-07 08:21:25 +00001/*
tina.legrand@webrtc.orgdf697752012-02-08 10:22:21 +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
tina.legrand@webrtc.orga092cbf2013-02-14 09:28:10 +000011#include "webrtc/modules/audio_coding/main/test/TestAllCodecs.h"
niklase@google.com470e71d2011-07-07 08:21:25 +000012
tina.legrand@webrtc.org5e7ca602012-06-12 07:16:24 +000013#include <stdio.h>
tina.legrand@webrtc.org5e7ca602012-06-12 07:16:24 +000014#include <string>
kjellander@webrtc.org5490c712011-12-21 13:34:18 +000015
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +000016#include "gtest/gtest.h"
17
tina.legrand@webrtc.orga092cbf2013-02-14 09:28:10 +000018#include "webrtc/common_types.h"
19#include "webrtc/engine_configurations.h"
20#include "webrtc/modules/audio_coding/main/interface/audio_coding_module.h"
21#include "webrtc/modules/audio_coding/main/interface/audio_coding_module_typedefs.h"
22#include "webrtc/modules/audio_coding/main/test/utility.h"
23#include "webrtc/system_wrappers/interface/trace.h"
24#include "webrtc/test/testsupport/fileutils.h"
25#include "webrtc/typedefs.h"
niklase@google.com470e71d2011-07-07 08:21:25 +000026
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +000027// Description of the test:
28// In this test we set up a one-way communication channel from a participant
29// called "a" to a participant called "b".
30// a -> channel_a_to_b -> b
31//
32// The test loops through all available mono codecs, encode at "a" sends over
33// the channel, and decodes at "b".
34
tina.legrand@webrtc.org554ae1a2011-12-16 10:09:04 +000035namespace webrtc {
36
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +000037// Class for simulating packet handling.
38TestPack::TestPack()
39 : receiver_acm_(NULL),
40 sequence_number_(0),
41 timestamp_diff_(0),
42 last_in_timestamp_(0),
43 total_bytes_(0),
44 payload_size_(0) {
niklase@google.com470e71d2011-07-07 08:21:25 +000045}
46
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +000047TestPack::~TestPack() {
niklase@google.com470e71d2011-07-07 08:21:25 +000048}
49
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +000050void TestPack::RegisterReceiverACM(AudioCodingModule* acm) {
51 receiver_acm_ = acm;
52 return;
niklase@google.com470e71d2011-07-07 08:21:25 +000053}
54
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +000055int32_t TestPack::SendData(FrameType frame_type, uint8_t payload_type,
56 uint32_t timestamp, const uint8_t* payload_data,
57 uint16_t payload_size,
58 const RTPFragmentationHeader* fragmentation) {
59 WebRtcRTPHeader rtp_info;
60 int32_t status;
niklase@google.com470e71d2011-07-07 08:21:25 +000061
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +000062 rtp_info.header.markerBit = false;
63 rtp_info.header.ssrc = 0;
64 rtp_info.header.sequenceNumber = sequence_number_++;
65 rtp_info.header.payloadType = payload_type;
66 rtp_info.header.timestamp = timestamp;
67 if (frame_type == kAudioFrameCN) {
68 rtp_info.type.Audio.isCNG = true;
69 } else {
70 rtp_info.type.Audio.isCNG = false;
71 }
72 if (frame_type == kFrameEmpty) {
73 // Skip this frame.
74 return 0;
75 }
76
77 // Only run mono for all test cases.
78 rtp_info.type.Audio.channel = 1;
79 memcpy(payload_data_, payload_data, payload_size);
80
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000081 status = receiver_acm_->IncomingPacket(payload_data_, payload_size, rtp_info);
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +000082
83 payload_size_ = payload_size;
84 timestamp_diff_ = timestamp - last_in_timestamp_;
85 last_in_timestamp_ = timestamp;
86 total_bytes_ += payload_size;
87 return status;
niklase@google.com470e71d2011-07-07 08:21:25 +000088}
89
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +000090uint16_t TestPack::payload_size() {
91 return payload_size_;
niklase@google.com470e71d2011-07-07 08:21:25 +000092}
93
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +000094uint32_t TestPack::timestamp_diff() {
95 return timestamp_diff_;
niklase@google.com470e71d2011-07-07 08:21:25 +000096}
97
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +000098void TestPack::reset_payload_size() {
99 payload_size_ = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000100}
101
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +0000102TestAllCodecs::TestAllCodecs(int test_mode)
andrew@webrtc.org89df0922013-09-12 01:27:43 +0000103 : acm_a_(AudioCodingModule::Create(0)),
104 acm_b_(AudioCodingModule::Create(1)),
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +0000105 channel_a_to_b_(NULL),
106 test_count_(0),
107 packet_size_samples_(0),
108 packet_size_bytes_(0) {
109 // test_mode = 0 for silent test (auto test)
110 test_mode_ = test_mode;
111}
niklase@google.com470e71d2011-07-07 08:21:25 +0000112
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +0000113TestAllCodecs::~TestAllCodecs() {
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +0000114 if (channel_a_to_b_ != NULL) {
115 delete channel_a_to_b_;
116 channel_a_to_b_ = NULL;
117 }
118}
niklase@google.com470e71d2011-07-07 08:21:25 +0000119
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +0000120void TestAllCodecs::Perform() {
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +0000121 const std::string file_name = webrtc::test::ResourcePath(
122 "audio_coding/testfile32kHz", "pcm");
tina.legrand@webrtc.orgba468042012-08-17 10:38:28 +0000123 infile_a_.Open(file_name, 32000, "rb");
niklase@google.com470e71d2011-07-07 08:21:25 +0000124
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +0000125 if (test_mode_ == 0) {
126 WEBRTC_TRACE(kTraceStateInfo, kTraceAudioCoding, -1,
127 "---------- TestAllCodecs ----------");
128 }
niklase@google.com470e71d2011-07-07 08:21:25 +0000129
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +0000130 acm_a_->InitializeReceiver();
131 acm_b_->InitializeReceiver();
niklase@google.com470e71d2011-07-07 08:21:25 +0000132
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +0000133 uint8_t num_encoders = acm_a_->NumberOfCodecs();
134 CodecInst my_codec_param;
135 for (uint8_t n = 0; n < num_encoders; n++) {
tina.legrand@webrtc.org7a7a0082013-02-21 10:27:48 +0000136 acm_b_->Codec(n, &my_codec_param);
tina.legrand@webrtc.orgc4590582012-11-28 12:23:29 +0000137 if (!strcmp(my_codec_param.plname, "opus")) {
138 my_codec_param.channels = 1;
139 }
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +0000140 acm_b_->RegisterReceiveCodec(my_codec_param);
141 }
niklase@google.com470e71d2011-07-07 08:21:25 +0000142
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +0000143 // Create and connect the channel
144 channel_a_to_b_ = new TestPack;
145 acm_a_->RegisterTransportCallback(channel_a_to_b_);
andrew@webrtc.org89df0922013-09-12 01:27:43 +0000146 channel_a_to_b_->RegisterReceiverACM(acm_b_.get());
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +0000147
148 // All codecs are tested for all allowed sampling frequencies, rates and
149 // packet sizes.
150#ifdef WEBRTC_CODEC_AMR
151 if (test_mode_ != 0) {
152 printf("===============================================================\n");
153 }
154 test_count_++;
155 OpenOutFile(test_count_);
156 char codec_amr[] = "AMR";
157 RegisterSendCodec('A', codec_amr, 8000, 4750, 160, 2);
158 Run(channel_a_to_b_);
159 RegisterSendCodec('A', codec_amr, 8000, 4750, 320, 2);
160 Run(channel_a_to_b_);
161 RegisterSendCodec('A', codec_amr, 8000, 4750, 480, 3);
162 Run(channel_a_to_b_);
163 RegisterSendCodec('A', codec_amr, 8000, 5150, 160, 2);
164 Run(channel_a_to_b_);
165 RegisterSendCodec('A', codec_amr, 8000, 5150, 320, 2);
166 Run(channel_a_to_b_);
167 RegisterSendCodec('A', codec_amr, 8000, 5150, 480, 3);
168 Run(channel_a_to_b_);
169 RegisterSendCodec('A', codec_amr, 8000, 5900, 160, 1);
170 Run(channel_a_to_b_);
171 RegisterSendCodec('A', codec_amr, 8000, 5900, 320, 2);
172 Run(channel_a_to_b_);
173 RegisterSendCodec('A', codec_amr, 8000, 5900, 480, 2);
174 Run(channel_a_to_b_);
175 RegisterSendCodec('A', codec_amr, 8000, 6700, 160, 1);
176 Run(channel_a_to_b_);
177 RegisterSendCodec('A', codec_amr, 8000, 6700, 320, 2);
178 Run(channel_a_to_b_);
179 RegisterSendCodec('A', codec_amr, 8000, 6700, 480, 2);
180 Run(channel_a_to_b_);
181 RegisterSendCodec('A', codec_amr, 8000, 7400, 160, 1);
182 Run(channel_a_to_b_);
183 RegisterSendCodec('A', codec_amr, 8000, 7400, 320, 2);
184 Run(channel_a_to_b_);
185 RegisterSendCodec('A', codec_amr, 8000, 7400, 480, 3);
186 Run(channel_a_to_b_);
187 RegisterSendCodec('A', codec_amr, 8000, 7950, 160, 2);
188 Run(channel_a_to_b_);
189 RegisterSendCodec('A', codec_amr, 8000, 7950, 320, 2);
190 Run(channel_a_to_b_);
191 RegisterSendCodec('A', codec_amr, 8000, 7950, 480, 3);
192 Run(channel_a_to_b_);
193 RegisterSendCodec('A', codec_amr, 8000, 10200, 160, 1);
194 Run(channel_a_to_b_);
195 RegisterSendCodec('A', codec_amr, 8000, 10200, 320, 2);
196 Run(channel_a_to_b_);
197 RegisterSendCodec('A', codec_amr, 8000, 10200, 480, 3);
198 Run(channel_a_to_b_);
199 RegisterSendCodec('A', codec_amr, 8000, 12200, 160, 1);
200 Run(channel_a_to_b_);
201 RegisterSendCodec('A', codec_amr, 8000, 12200, 320, 2);
202 Run(channel_a_to_b_);
203 RegisterSendCodec('A', codec_amr, 8000, 12200, 480, 3);
204 Run(channel_a_to_b_);
205 outfile_b_.Close();
niklase@google.com470e71d2011-07-07 08:21:25 +0000206#endif
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +0000207#ifdef WEBRTC_CODEC_AMRWB
208 if (test_mode_ != 0) {
209 printf("===============================================================\n");
210 }
211 test_count_++;
212 char codec_amrwb[] = "AMR-WB";
213 OpenOutFile(test_count_);
214 RegisterSendCodec('A', codec_amrwb, 16000, 7000, 320, 0);
215 Run(channel_a_to_b_);
216 RegisterSendCodec('A', codec_amrwb, 16000, 7000, 640, 0);
217 Run(channel_a_to_b_);
218 RegisterSendCodec('A', codec_amrwb, 16000, 7000, 960, 0);
219 Run(channel_a_to_b_);
220 RegisterSendCodec('A', codec_amrwb, 16000, 9000, 320, 1);
221 Run(channel_a_to_b_);
222 RegisterSendCodec('A', codec_amrwb, 16000, 9000, 640, 2);
223 Run(channel_a_to_b_);
224 RegisterSendCodec('A', codec_amrwb, 16000, 9000, 960, 2);
225 Run(channel_a_to_b_);
226 RegisterSendCodec('A', codec_amrwb, 16000, 12000, 320, 3);
227 Run(channel_a_to_b_);
228 RegisterSendCodec('A', codec_amrwb, 16000, 12000, 640, 6);
229 Run(channel_a_to_b_);
230 RegisterSendCodec('A', codec_amrwb, 16000, 12000, 960, 8);
231 Run(channel_a_to_b_);
232 RegisterSendCodec('A', codec_amrwb, 16000, 14000, 320, 2);
233 Run(channel_a_to_b_);
234 RegisterSendCodec('A', codec_amrwb, 16000, 14000, 640, 4);
235 Run(channel_a_to_b_);
236 RegisterSendCodec('A', codec_amrwb, 16000, 14000, 960, 5);
237 Run(channel_a_to_b_);
238 RegisterSendCodec('A', codec_amrwb, 16000, 16000, 320, 1);
239 Run(channel_a_to_b_);
240 RegisterSendCodec('A', codec_amrwb, 16000, 16000, 640, 2);
241 Run(channel_a_to_b_);
242 RegisterSendCodec('A', codec_amrwb, 16000, 16000, 960, 2);
243 Run(channel_a_to_b_);
244 RegisterSendCodec('A', codec_amrwb, 16000, 18000, 320, 2);
245 Run(channel_a_to_b_);
246 RegisterSendCodec('A', codec_amrwb, 16000, 18000, 640, 4);
247 Run(channel_a_to_b_);
248 RegisterSendCodec('A', codec_amrwb, 16000, 18000, 960, 5);
249 Run(channel_a_to_b_);
250 RegisterSendCodec('A', codec_amrwb, 16000, 20000, 320, 1);
251 Run(channel_a_to_b_);
252 RegisterSendCodec('A', codec_amrwb, 16000, 20000, 640, 2);
253 Run(channel_a_to_b_);
254 RegisterSendCodec('A', codec_amrwb, 16000, 20000, 960, 2);
255 Run(channel_a_to_b_);
256 RegisterSendCodec('A', codec_amrwb, 16000, 23000, 320, 1);
257 Run(channel_a_to_b_);
258 RegisterSendCodec('A', codec_amrwb, 16000, 23000, 640, 3);
259 Run(channel_a_to_b_);
260 RegisterSendCodec('A', codec_amrwb, 16000, 23000, 960, 3);
261 Run(channel_a_to_b_);
262 RegisterSendCodec('A', codec_amrwb, 16000, 24000, 320, 1);
263 Run(channel_a_to_b_);
264 RegisterSendCodec('A', codec_amrwb, 16000, 24000, 640, 2);
265 Run(channel_a_to_b_);
266 RegisterSendCodec('A', codec_amrwb, 16000, 24000, 960, 2);
267 Run(channel_a_to_b_);
268 outfile_b_.Close();
niklase@google.com470e71d2011-07-07 08:21:25 +0000269#endif
270#ifdef WEBRTC_CODEC_G722
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +0000271 if (test_mode_ != 0) {
272 printf("===============================================================\n");
273 }
274 test_count_++;
275 OpenOutFile(test_count_);
276 char codec_g722[] = "G722";
277 RegisterSendCodec('A', codec_g722, 16000, 64000, 160, 0);
278 Run(channel_a_to_b_);
279 RegisterSendCodec('A', codec_g722, 16000, 64000, 320, 0);
280 Run(channel_a_to_b_);
281 RegisterSendCodec('A', codec_g722, 16000, 64000, 480, 0);
282 Run(channel_a_to_b_);
283 RegisterSendCodec('A', codec_g722, 16000, 64000, 640, 0);
284 Run(channel_a_to_b_);
285 RegisterSendCodec('A', codec_g722, 16000, 64000, 800, 0);
286 Run(channel_a_to_b_);
287 RegisterSendCodec('A', codec_g722, 16000, 64000, 960, 0);
288 Run(channel_a_to_b_);
289 outfile_b_.Close();
niklase@google.com470e71d2011-07-07 08:21:25 +0000290#endif
291#ifdef WEBRTC_CODEC_G722_1
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +0000292 if (test_mode_ != 0) {
293 printf("===============================================================\n");
294 }
295 test_count_++;
296 OpenOutFile(test_count_);
297 char codec_g722_1[] = "G7221";
298 RegisterSendCodec('A', codec_g722_1, 16000, 32000, 320, 0);
299 Run(channel_a_to_b_);
300 RegisterSendCodec('A', codec_g722_1, 16000, 24000, 320, 0);
301 Run(channel_a_to_b_);
302 RegisterSendCodec('A', codec_g722_1, 16000, 16000, 320, 0);
303 Run(channel_a_to_b_);
304 outfile_b_.Close();
niklase@google.com470e71d2011-07-07 08:21:25 +0000305#endif
306#ifdef WEBRTC_CODEC_G722_1C
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +0000307 if (test_mode_ != 0) {
308 printf("===============================================================\n");
309 }
310 test_count_++;
311 OpenOutFile(test_count_);
312 char codec_g722_1c[] = "G7221";
313 RegisterSendCodec('A', codec_g722_1c, 32000, 48000, 640, 0);
314 Run(channel_a_to_b_);
315 RegisterSendCodec('A', codec_g722_1c, 32000, 32000, 640, 0);
316 Run(channel_a_to_b_);
317 RegisterSendCodec('A', codec_g722_1c, 32000, 24000, 640, 0);
318 Run(channel_a_to_b_);
319 outfile_b_.Close();
niklase@google.com470e71d2011-07-07 08:21:25 +0000320#endif
321#ifdef WEBRTC_CODEC_G729
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +0000322 if (test_mode_ != 0) {
323 printf("===============================================================\n");
324 }
325 test_count_++;
326 OpenOutFile(test_count_);
327 char codec_g729[] = "G729";
328 RegisterSendCodec('A', codec_g729, 8000, 8000, 80, 0);
329 Run(channel_a_to_b_);
330 RegisterSendCodec('A', codec_g729, 8000, 8000, 160, 0);
331 Run(channel_a_to_b_);
332 RegisterSendCodec('A', codec_g729, 8000, 8000, 240, 0);
333 Run(channel_a_to_b_);
334 RegisterSendCodec('A', codec_g729, 8000, 8000, 320, 0);
335 Run(channel_a_to_b_);
336 RegisterSendCodec('A', codec_g729, 8000, 8000, 400, 0);
337 Run(channel_a_to_b_);
338 RegisterSendCodec('A', codec_g729, 8000, 8000, 480, 0);
339 Run(channel_a_to_b_);
340 outfile_b_.Close();
niklase@google.com470e71d2011-07-07 08:21:25 +0000341#endif
342#ifdef WEBRTC_CODEC_G729_1
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +0000343 if (test_mode_ != 0) {
344 printf("===============================================================\n");
345 }
346 test_count_++;
347 OpenOutFile(test_count_);
348 char codec_g729_1[] = "G7291";
349 RegisterSendCodec('A', codec_g729_1, 16000, 8000, 320, 1);
350 Run(channel_a_to_b_);
351 RegisterSendCodec('A', codec_g729_1, 16000, 8000, 640, 1);
352 Run(channel_a_to_b_);
353 RegisterSendCodec('A', codec_g729_1, 16000, 8000, 960, 1);
354 Run(channel_a_to_b_);
355 RegisterSendCodec('A', codec_g729_1, 16000, 12000, 320, 1);
356 Run(channel_a_to_b_);
357 RegisterSendCodec('A', codec_g729_1, 16000, 12000, 640, 1);
358 Run(channel_a_to_b_);
359 RegisterSendCodec('A', codec_g729_1, 16000, 12000, 960, 1);
360 Run(channel_a_to_b_);
361 RegisterSendCodec('A', codec_g729_1, 16000, 14000, 320, 1);
362 Run(channel_a_to_b_);
363 RegisterSendCodec('A', codec_g729_1, 16000, 14000, 640, 1);
364 Run(channel_a_to_b_);
365 RegisterSendCodec('A', codec_g729_1, 16000, 14000, 960, 1);
366 Run(channel_a_to_b_);
367 RegisterSendCodec('A', codec_g729_1, 16000, 16000, 320, 1);
368 Run(channel_a_to_b_);
369 RegisterSendCodec('A', codec_g729_1, 16000, 16000, 640, 1);
370 Run(channel_a_to_b_);
371 RegisterSendCodec('A', codec_g729_1, 16000, 16000, 960, 1);
372 Run(channel_a_to_b_);
373 RegisterSendCodec('A', codec_g729_1, 16000, 18000, 320, 1);
374 Run(channel_a_to_b_);
375 RegisterSendCodec('A', codec_g729_1, 16000, 18000, 640, 1);
376 Run(channel_a_to_b_);
377 RegisterSendCodec('A', codec_g729_1, 16000, 18000, 960, 1);
378 Run(channel_a_to_b_);
379 RegisterSendCodec('A', codec_g729_1, 16000, 20000, 320, 1);
380 Run(channel_a_to_b_);
381 RegisterSendCodec('A', codec_g729_1, 16000, 20000, 640, 1);
382 Run(channel_a_to_b_);
383 RegisterSendCodec('A', codec_g729_1, 16000, 20000, 960, 1);
384 Run(channel_a_to_b_);
385 RegisterSendCodec('A', codec_g729_1, 16000, 22000, 320, 1);
386 Run(channel_a_to_b_);
387 RegisterSendCodec('A', codec_g729_1, 16000, 22000, 640, 1);
388 Run(channel_a_to_b_);
389 RegisterSendCodec('A', codec_g729_1, 16000, 22000, 960, 1);
390 Run(channel_a_to_b_);
391 RegisterSendCodec('A', codec_g729_1, 16000, 24000, 320, 1);
392 Run(channel_a_to_b_);
393 RegisterSendCodec('A', codec_g729_1, 16000, 24000, 640, 1);
394 Run(channel_a_to_b_);
395 RegisterSendCodec('A', codec_g729_1, 16000, 24000, 960, 1);
396 Run(channel_a_to_b_);
397 RegisterSendCodec('A', codec_g729_1, 16000, 26000, 320, 1);
398 Run(channel_a_to_b_);
399 RegisterSendCodec('A', codec_g729_1, 16000, 26000, 640, 1);
400 Run(channel_a_to_b_);
401 RegisterSendCodec('A', codec_g729_1, 16000, 26000, 960, 1);
402 Run(channel_a_to_b_);
403 RegisterSendCodec('A', codec_g729_1, 16000, 28000, 320, 1);
404 Run(channel_a_to_b_);
405 RegisterSendCodec('A', codec_g729_1, 16000, 28000, 640, 1);
406 Run(channel_a_to_b_);
407 RegisterSendCodec('A', codec_g729_1, 16000, 28000, 960, 1);
408 Run(channel_a_to_b_);
409 RegisterSendCodec('A', codec_g729_1, 16000, 30000, 320, 1);
410 Run(channel_a_to_b_);
411 RegisterSendCodec('A', codec_g729_1, 16000, 30000, 640, 1);
412 Run(channel_a_to_b_);
413 RegisterSendCodec('A', codec_g729_1, 16000, 30000, 960, 1);
414 Run(channel_a_to_b_);
415 RegisterSendCodec('A', codec_g729_1, 16000, 32000, 320, 1);
416 Run(channel_a_to_b_);
417 RegisterSendCodec('A', codec_g729_1, 16000, 32000, 640, 1);
418 Run(channel_a_to_b_);
419 RegisterSendCodec('A', codec_g729_1, 16000, 32000, 960, 1);
420 Run(channel_a_to_b_);
421 outfile_b_.Close();
niklase@google.com470e71d2011-07-07 08:21:25 +0000422#endif
423#ifdef WEBRTC_CODEC_GSMFR
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +0000424 if (test_mode_ != 0) {
425 printf("===============================================================\n");
426 }
427 test_count_++;
428 OpenOutFile(test_count_);
429 char codec_gsmfr[] = "GSM";
430 RegisterSendCodec('A', codec_gsmfr, 8000, 13200, 160, 0);
431 Run(channel_a_to_b_);
432 RegisterSendCodec('A', codec_gsmfr, 8000, 13200, 320, 0);
433 Run(channel_a_to_b_);
434 RegisterSendCodec('A', codec_gsmfr, 8000, 13200, 480, 0);
435 Run(channel_a_to_b_);
436 outfile_b_.Close();
niklase@google.com470e71d2011-07-07 08:21:25 +0000437#endif
438#ifdef WEBRTC_CODEC_ILBC
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +0000439 if (test_mode_ != 0) {
440 printf("===============================================================\n");
441 }
442 test_count_++;
443 OpenOutFile(test_count_);
444 char codec_ilbc[] = "ILBC";
445 RegisterSendCodec('A', codec_ilbc, 8000, 13300, 240, 0);
446 Run(channel_a_to_b_);
447 RegisterSendCodec('A', codec_ilbc, 8000, 13300, 480, 0);
448 Run(channel_a_to_b_);
449 RegisterSendCodec('A', codec_ilbc, 8000, 15200, 160, 0);
450 Run(channel_a_to_b_);
451 RegisterSendCodec('A', codec_ilbc, 8000, 15200, 320, 0);
452 Run(channel_a_to_b_);
453 outfile_b_.Close();
niklase@google.com470e71d2011-07-07 08:21:25 +0000454#endif
455#if (defined(WEBRTC_CODEC_ISAC) || defined(WEBRTC_CODEC_ISACFX))
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +0000456 if (test_mode_ != 0) {
457 printf("===============================================================\n");
458 }
459 test_count_++;
460 OpenOutFile(test_count_);
461 char codec_isac[] = "ISAC";
462 RegisterSendCodec('A', codec_isac, 16000, -1, 480, -1);
463 Run(channel_a_to_b_);
464 RegisterSendCodec('A', codec_isac, 16000, -1, 960, -1);
465 Run(channel_a_to_b_);
466 RegisterSendCodec('A', codec_isac, 16000, 15000, 480, -1);
467 Run(channel_a_to_b_);
468 RegisterSendCodec('A', codec_isac, 16000, 32000, 960, -1);
469 Run(channel_a_to_b_);
470 outfile_b_.Close();
niklase@google.com470e71d2011-07-07 08:21:25 +0000471#endif
472#ifdef WEBRTC_CODEC_ISAC
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +0000473 if (test_mode_ != 0) {
474 printf("===============================================================\n");
475 }
476 test_count_++;
477 OpenOutFile(test_count_);
478 RegisterSendCodec('A', codec_isac, 32000, -1, 960, -1);
479 Run(channel_a_to_b_);
480 RegisterSendCodec('A', codec_isac, 32000, 56000, 960, -1);
481 Run(channel_a_to_b_);
482 RegisterSendCodec('A', codec_isac, 32000, 37000, 960, -1);
483 Run(channel_a_to_b_);
484 RegisterSendCodec('A', codec_isac, 32000, 32000, 960, -1);
485 Run(channel_a_to_b_);
486 outfile_b_.Close();
niklase@google.com470e71d2011-07-07 08:21:25 +0000487#endif
488#ifdef WEBRTC_CODEC_PCM16
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +0000489 if (test_mode_ != 0) {
490 printf("===============================================================\n");
491 }
492 test_count_++;
493 OpenOutFile(test_count_);
494 char codec_l16[] = "L16";
495 RegisterSendCodec('A', codec_l16, 8000, 128000, 80, 0);
496 Run(channel_a_to_b_);
497 RegisterSendCodec('A', codec_l16, 8000, 128000, 160, 0);
498 Run(channel_a_to_b_);
499 RegisterSendCodec('A', codec_l16, 8000, 128000, 240, 0);
500 Run(channel_a_to_b_);
501 RegisterSendCodec('A', codec_l16, 8000, 128000, 320, 0);
502 Run(channel_a_to_b_);
503 outfile_b_.Close();
504 if (test_mode_ != 0) {
505 printf("===============================================================\n");
506 }
507 test_count_++;
508 OpenOutFile(test_count_);
509 RegisterSendCodec('A', codec_l16, 16000, 256000, 160, 0);
510 Run(channel_a_to_b_);
511 RegisterSendCodec('A', codec_l16, 16000, 256000, 320, 0);
512 Run(channel_a_to_b_);
513 RegisterSendCodec('A', codec_l16, 16000, 256000, 480, 0);
514 Run(channel_a_to_b_);
515 RegisterSendCodec('A', codec_l16, 16000, 256000, 640, 0);
516 Run(channel_a_to_b_);
517 outfile_b_.Close();
518 if (test_mode_ != 0) {
519 printf("===============================================================\n");
520 }
521 test_count_++;
522 OpenOutFile(test_count_);
523 RegisterSendCodec('A', codec_l16, 32000, 512000, 320, 0);
524 Run(channel_a_to_b_);
525 RegisterSendCodec('A', codec_l16, 32000, 512000, 640, 0);
526 Run(channel_a_to_b_);
527 outfile_b_.Close();
niklase@google.com470e71d2011-07-07 08:21:25 +0000528#endif
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +0000529 if (test_mode_ != 0) {
530 printf("===============================================================\n");
531 }
532 test_count_++;
533 OpenOutFile(test_count_);
534 char codec_pcma[] = "PCMA";
535 RegisterSendCodec('A', codec_pcma, 8000, 64000, 80, 0);
536 Run(channel_a_to_b_);
537 RegisterSendCodec('A', codec_pcma, 8000, 64000, 160, 0);
538 Run(channel_a_to_b_);
539 RegisterSendCodec('A', codec_pcma, 8000, 64000, 240, 0);
540 Run(channel_a_to_b_);
541 RegisterSendCodec('A', codec_pcma, 8000, 64000, 320, 0);
542 Run(channel_a_to_b_);
543 RegisterSendCodec('A', codec_pcma, 8000, 64000, 400, 0);
544 Run(channel_a_to_b_);
545 RegisterSendCodec('A', codec_pcma, 8000, 64000, 480, 0);
546 Run(channel_a_to_b_);
547 if (test_mode_ != 0) {
548 printf("===============================================================\n");
549 }
550 char codec_pcmu[] = "PCMU";
551 RegisterSendCodec('A', codec_pcmu, 8000, 64000, 80, 0);
552 Run(channel_a_to_b_);
553 RegisterSendCodec('A', codec_pcmu, 8000, 64000, 160, 0);
554 Run(channel_a_to_b_);
555 RegisterSendCodec('A', codec_pcmu, 8000, 64000, 240, 0);
556 Run(channel_a_to_b_);
557 RegisterSendCodec('A', codec_pcmu, 8000, 64000, 320, 0);
558 Run(channel_a_to_b_);
559 RegisterSendCodec('A', codec_pcmu, 8000, 64000, 400, 0);
560 Run(channel_a_to_b_);
561 RegisterSendCodec('A', codec_pcmu, 8000, 64000, 480, 0);
562 Run(channel_a_to_b_);
563 outfile_b_.Close();
niklase@google.com470e71d2011-07-07 08:21:25 +0000564#ifdef WEBRTC_CODEC_SPEEX
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +0000565 if (test_mode_ != 0) {
566 printf("===============================================================\n");
567 }
568 test_count_++;
569 OpenOutFile(test_count_);
570 char codec_speex[] = "SPEEX";
571 RegisterSendCodec('A', codec_speex, 8000, 2400, 160, 0);
572 Run(channel_a_to_b_);
573 RegisterSendCodec('A', codec_speex, 8000, 8000, 320, 0);
574 Run(channel_a_to_b_);
575 RegisterSendCodec('A', codec_speex, 8000, 18200, 480, 0);
576 Run(channel_a_to_b_);
577 outfile_b_.Close();
niklase@google.com470e71d2011-07-07 08:21:25 +0000578
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +0000579 if (test_mode_ != 0) {
580 printf("===============================================================\n");
581 }
582 test_count_++;
583 OpenOutFile(test_count_);
584 RegisterSendCodec('A', codec_speex, 16000, 4000, 320, 0);
585 Run(channel_a_to_b_);
586 RegisterSendCodec('A', codec_speex, 16000, 12800, 640, 0);
587 Run(channel_a_to_b_);
588 RegisterSendCodec('A', codec_speex, 16000, 34200, 960, 0);
589 Run(channel_a_to_b_);
590 outfile_b_.Close();
niklase@google.com470e71d2011-07-07 08:21:25 +0000591#endif
tina.legrand@webrtc.orgdf697752012-02-08 10:22:21 +0000592#ifdef WEBRTC_CODEC_CELT
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +0000593 if (test_mode_ != 0) {
594 printf("===============================================================\n");
595 }
596 test_count_++;
597 OpenOutFile(test_count_);
598 char codec_celt[] = "CELT";
599 RegisterSendCodec('A', codec_celt, 32000, 48000, 640, 0);
600 Run(channel_a_to_b_);
601 RegisterSendCodec('A', codec_celt, 32000, 64000, 640, 0);
602 Run(channel_a_to_b_);
603 RegisterSendCodec('A', codec_celt, 32000, 128000, 640, 0);
604 Run(channel_a_to_b_);
605 outfile_b_.Close();
tina.legrand@webrtc.orgdf697752012-02-08 10:22:21 +0000606#endif
tina.legrand@webrtc.orga7d83872012-10-18 10:00:52 +0000607#ifdef WEBRTC_CODEC_OPUS
608 if (test_mode_ != 0) {
609 printf("===============================================================\n");
610 }
611 test_count_++;
612 OpenOutFile(test_count_);
613 char codec_opus[] = "OPUS";
tina.legrand@webrtc.org46d90dc2013-02-01 14:20:06 +0000614 RegisterSendCodec('A', codec_opus, 48000, 6000, 480, -1);
tina.legrand@webrtc.orga7d83872012-10-18 10:00:52 +0000615 Run(channel_a_to_b_);
tina.legrand@webrtc.org46d90dc2013-02-01 14:20:06 +0000616 RegisterSendCodec('A', codec_opus, 48000, 20000, 480*2, -1);
tina.legrand@webrtc.orga7d83872012-10-18 10:00:52 +0000617 Run(channel_a_to_b_);
tina.legrand@webrtc.org46d90dc2013-02-01 14:20:06 +0000618 RegisterSendCodec('A', codec_opus, 48000, 32000, 480*4, -1);
tina.legrand@webrtc.orga7d83872012-10-18 10:00:52 +0000619 Run(channel_a_to_b_);
tina.legrand@webrtc.org46d90dc2013-02-01 14:20:06 +0000620 RegisterSendCodec('A', codec_opus, 48000, 48000, 480, -1);
tina.legrand@webrtc.orga7d83872012-10-18 10:00:52 +0000621 Run(channel_a_to_b_);
tina.legrand@webrtc.org46d90dc2013-02-01 14:20:06 +0000622 RegisterSendCodec('A', codec_opus, 48000, 64000, 480*4, -1);
tina.legrand@webrtc.orga7d83872012-10-18 10:00:52 +0000623 Run(channel_a_to_b_);
tina.legrand@webrtc.org46d90dc2013-02-01 14:20:06 +0000624 RegisterSendCodec('A', codec_opus, 48000, 96000, 480*6, -1);
tina.legrand@webrtc.orga7d83872012-10-18 10:00:52 +0000625 Run(channel_a_to_b_);
tina.legrand@webrtc.org46d90dc2013-02-01 14:20:06 +0000626 RegisterSendCodec('A', codec_opus, 48000, 500000, 480*2, -1);
tina.legrand@webrtc.orga7d83872012-10-18 10:00:52 +0000627 Run(channel_a_to_b_);
tina.legrand@webrtc.orgc4590582012-11-28 12:23:29 +0000628 outfile_b_.Close();
tina.legrand@webrtc.orga7d83872012-10-18 10:00:52 +0000629#endif
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +0000630 if (test_mode_ != 0) {
631 printf("===============================================================\n");
niklase@google.com470e71d2011-07-07 08:21:25 +0000632
633 /* Print out all codecs that were not tested in the run */
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +0000634 printf("The following codecs was not included in the test:\n");
635#ifndef WEBRTC_CODEC_AMR
636 printf(" GSMAMR\n");
niklase@google.com470e71d2011-07-07 08:21:25 +0000637#endif
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +0000638#ifndef WEBRTC_CODEC_AMRWB
639 printf(" GSMAMR-wb\n");
niklase@google.com470e71d2011-07-07 08:21:25 +0000640#endif
641#ifndef WEBRTC_CODEC_G722
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +0000642 printf(" G.722\n");
niklase@google.com470e71d2011-07-07 08:21:25 +0000643#endif
644#ifndef WEBRTC_CODEC_G722_1
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +0000645 printf(" G.722.1\n");
niklase@google.com470e71d2011-07-07 08:21:25 +0000646#endif
647#ifndef WEBRTC_CODEC_G722_1C
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +0000648 printf(" G.722.1C\n");
niklase@google.com470e71d2011-07-07 08:21:25 +0000649#endif
650#ifndef WEBRTC_CODEC_G729
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +0000651 printf(" G.729\n");
niklase@google.com470e71d2011-07-07 08:21:25 +0000652#endif
653#ifndef WEBRTC_CODEC_G729_1
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +0000654 printf(" G.729.1\n");
niklase@google.com470e71d2011-07-07 08:21:25 +0000655#endif
656#ifndef WEBRTC_CODEC_GSMFR
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +0000657 printf(" GSMFR\n");
niklase@google.com470e71d2011-07-07 08:21:25 +0000658#endif
659#ifndef WEBRTC_CODEC_ILBC
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +0000660 printf(" iLBC\n");
niklase@google.com470e71d2011-07-07 08:21:25 +0000661#endif
662#ifndef WEBRTC_CODEC_ISAC
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +0000663 printf(" ISAC float\n");
niklase@google.com470e71d2011-07-07 08:21:25 +0000664#endif
665#ifndef WEBRTC_CODEC_ISACFX
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +0000666 printf(" ISAC fix\n");
niklase@google.com470e71d2011-07-07 08:21:25 +0000667#endif
668#ifndef WEBRTC_CODEC_PCM16
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +0000669 printf(" PCM16\n");
niklase@google.com470e71d2011-07-07 08:21:25 +0000670#endif
671#ifndef WEBRTC_CODEC_SPEEX
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +0000672 printf(" Speex\n");
niklase@google.com470e71d2011-07-07 08:21:25 +0000673#endif
674
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +0000675 printf("\nTo complete the test, listen to the %d number of output files.\n",
676 test_count_);
677 }
niklase@google.com470e71d2011-07-07 08:21:25 +0000678}
679
680// Register Codec to use in the test
681//
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +0000682// Input: side - which ACM to use, 'A' or 'B'
683// codec_name - name to use when register the codec
684// sampling_freq_hz - sampling frequency in Herz
685// rate - bitrate in bytes
686// packet_size - packet size in samples
687// extra_byte - if extra bytes needed compared to the bitrate
niklase@google.com470e71d2011-07-07 08:21:25 +0000688// used when registering, can be an internal header
689// set to -1 if the codec is a variable rate codec
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +0000690void TestAllCodecs::RegisterSendCodec(char side, char* codec_name,
691 int32_t sampling_freq_hz, int rate,
692 int packet_size, int extra_byte) {
693 if (test_mode_ != 0) {
694 // Print out codec and settings.
695 printf("codec: %s Freq: %d Rate: %d PackSize: %d\n", codec_name,
696 sampling_freq_hz, rate, packet_size);
697 }
698
699 // Store packet-size in samples, used to validate the received packet.
700 // If G.722, store half the size to compensate for the timestamp bug in the
701 // RFC for G.722.
702 // If iSAC runs in adaptive mode, packet size in samples can change on the
703 // fly, so we exclude this test by setting |packet_size_samples_| to -1.
704 if (!strcmp(codec_name, "G722")) {
705 packet_size_samples_ = packet_size / 2;
706 } else if (!strcmp(codec_name, "ISAC") && (rate == -1)) {
707 packet_size_samples_ = -1;
708 } else {
709 packet_size_samples_ = packet_size;
710 }
711
712 // Store the expected packet size in bytes, used to validate the received
713 // packet. If variable rate codec (extra_byte == -1), set to -1 (65535).
714 if (extra_byte != -1) {
715 // Add 0.875 to always round up to a whole byte
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +0000716 packet_size_bytes_ = static_cast<uint16_t>(static_cast<float>(packet_size
717 * rate) / static_cast<float>(sampling_freq_hz * 8) + 0.875)
718 + extra_byte;
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +0000719 } else {
720 // Packets will have a variable size.
721 packet_size_bytes_ = -1;
722 }
723
724 // Set pointer to the ACM where to register the codec.
725 AudioCodingModule* my_acm = NULL;
726 switch (side) {
727 case 'A': {
andrew@webrtc.org89df0922013-09-12 01:27:43 +0000728 my_acm = acm_a_.get();
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +0000729 break;
niklase@google.com470e71d2011-07-07 08:21:25 +0000730 }
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +0000731 case 'B': {
andrew@webrtc.org89df0922013-09-12 01:27:43 +0000732 my_acm = acm_b_.get();
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +0000733 break;
niklase@google.com470e71d2011-07-07 08:21:25 +0000734 }
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +0000735 default: {
736 break;
niklase@google.com470e71d2011-07-07 08:21:25 +0000737 }
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +0000738 }
739 ASSERT_TRUE(my_acm != NULL);
niklase@google.com470e71d2011-07-07 08:21:25 +0000740
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +0000741 // Get all codec parameters before registering
742 CodecInst my_codec_param;
tina.legrand@webrtc.org7a7a0082013-02-21 10:27:48 +0000743 CHECK_ERROR(AudioCodingModule::Codec(codec_name, &my_codec_param,
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +0000744 sampling_freq_hz, 1));
745 my_codec_param.rate = rate;
746 my_codec_param.pacsize = packet_size;
747 CHECK_ERROR(my_acm->RegisterSendCodec(my_codec_param));
niklase@google.com470e71d2011-07-07 08:21:25 +0000748}
749
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +0000750void TestAllCodecs::Run(TestPack* channel) {
751 AudioFrame audio_frame;
niklase@google.com470e71d2011-07-07 08:21:25 +0000752
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +0000753 int32_t out_freq_hz = outfile_b_.SamplingFrequency();
754 uint16_t receive_size;
755 uint32_t timestamp_diff;
756 channel->reset_payload_size();
757 int error_count = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000758
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +0000759 int counter = 0;
760 while (!infile_a_.EndOfFile()) {
761 // Add 10 msec to ACM.
762 infile_a_.Read10MsData(audio_frame);
763 CHECK_ERROR(acm_a_->Add10MsData(audio_frame));
niklase@google.com470e71d2011-07-07 08:21:25 +0000764
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +0000765 // Run sender side of ACM.
766 CHECK_ERROR(acm_a_->Process());
niklase@google.com470e71d2011-07-07 08:21:25 +0000767
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +0000768 // Verify that the received packet size matches the settings.
769 receive_size = channel->payload_size();
770 if (receive_size) {
771 if ((receive_size != packet_size_bytes_) &&
772 (packet_size_bytes_ < 65535)) {
773 error_count++;
774 }
niklase@google.com470e71d2011-07-07 08:21:25 +0000775
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +0000776 // Verify that the timestamp is updated with expected length. The counter
777 // is used to avoid problems when switching codec or frame size in the
778 // test.
779 timestamp_diff = channel->timestamp_diff();
780 if ((counter > 10) && (timestamp_diff != packet_size_samples_) &&
781 (packet_size_samples_ < 65535))
782 error_count++;
niklase@google.com470e71d2011-07-07 08:21:25 +0000783 }
784
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +0000785 // Run received side of ACM.
tina.legrand@webrtc.org7a7a0082013-02-21 10:27:48 +0000786 CHECK_ERROR(acm_b_->PlayoutData10Ms(out_freq_hz, &audio_frame));
niklase@google.com470e71d2011-07-07 08:21:25 +0000787
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +0000788 // Write output speech to file.
789 outfile_b_.Write10MsData(audio_frame.data_,
790 audio_frame.samples_per_channel_);
791
792 // Update loop counter
793 counter++;
794 }
795
796 EXPECT_EQ(0, error_count);
797
798 if (infile_a_.EndOfFile()) {
799 infile_a_.Rewind();
800 }
niklase@google.com470e71d2011-07-07 08:21:25 +0000801}
802
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +0000803void TestAllCodecs::OpenOutFile(int test_number) {
804 std::string filename = webrtc::test::OutputPath();
805 std::ostringstream test_number_str;
806 test_number_str << test_number;
807 filename += "testallcodecs_out_";
808 filename += test_number_str.str();
809 filename += ".pcm";
tina.legrand@webrtc.orgba468042012-08-17 10:38:28 +0000810 outfile_b_.Open(filename, 32000, "wb");
niklase@google.com470e71d2011-07-07 08:21:25 +0000811}
812
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +0000813void TestAllCodecs::DisplaySendReceiveCodec() {
814 CodecInst my_codec_param;
tina.legrand@webrtc.org7a7a0082013-02-21 10:27:48 +0000815 acm_a_->SendCodec(&my_codec_param);
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +0000816 printf("%s -> ", my_codec_param.plname);
tina.legrand@webrtc.org7a7a0082013-02-21 10:27:48 +0000817 acm_b_->ReceiveCodec(&my_codec_param);
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +0000818 printf("%s\n", my_codec_param.plname);
niklase@google.com470e71d2011-07-07 08:21:25 +0000819}
820
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +0000821} // namespace webrtc
tina.legrand@webrtc.org554ae1a2011-12-16 10:09:04 +0000822