blob: c47a5829c6ae45e27f5e5b169636a34bc53792d8 [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)
103 : acm_a_(NULL),
104 acm_b_(NULL),
105 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() {
114 if (acm_a_ != NULL) {
115 AudioCodingModule::Destroy(acm_a_);
116 acm_a_ = NULL;
117 }
118 if (acm_b_ != NULL) {
119 AudioCodingModule::Destroy(acm_b_);
120 acm_b_ = NULL;
121 }
122 if (channel_a_to_b_ != NULL) {
123 delete channel_a_to_b_;
124 channel_a_to_b_ = NULL;
125 }
126}
niklase@google.com470e71d2011-07-07 08:21:25 +0000127
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +0000128void TestAllCodecs::Perform() {
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +0000129 const std::string file_name = webrtc::test::ResourcePath(
130 "audio_coding/testfile32kHz", "pcm");
tina.legrand@webrtc.orgba468042012-08-17 10:38:28 +0000131 infile_a_.Open(file_name, 32000, "rb");
niklase@google.com470e71d2011-07-07 08:21:25 +0000132
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +0000133 if (test_mode_ == 0) {
134 WEBRTC_TRACE(kTraceStateInfo, kTraceAudioCoding, -1,
135 "---------- TestAllCodecs ----------");
136 }
niklase@google.com470e71d2011-07-07 08:21:25 +0000137
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +0000138 acm_a_ = AudioCodingModule::Create(0);
139 acm_b_ = AudioCodingModule::Create(1);
niklase@google.com470e71d2011-07-07 08:21:25 +0000140
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +0000141 acm_a_->InitializeReceiver();
142 acm_b_->InitializeReceiver();
niklase@google.com470e71d2011-07-07 08:21:25 +0000143
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +0000144 uint8_t num_encoders = acm_a_->NumberOfCodecs();
145 CodecInst my_codec_param;
146 for (uint8_t n = 0; n < num_encoders; n++) {
tina.legrand@webrtc.org7a7a0082013-02-21 10:27:48 +0000147 acm_b_->Codec(n, &my_codec_param);
tina.legrand@webrtc.orgc4590582012-11-28 12:23:29 +0000148 if (!strcmp(my_codec_param.plname, "opus")) {
149 my_codec_param.channels = 1;
150 }
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +0000151 acm_b_->RegisterReceiveCodec(my_codec_param);
152 }
niklase@google.com470e71d2011-07-07 08:21:25 +0000153
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +0000154 // Create and connect the channel
155 channel_a_to_b_ = new TestPack;
156 acm_a_->RegisterTransportCallback(channel_a_to_b_);
157 channel_a_to_b_->RegisterReceiverACM(acm_b_);
158
159 // All codecs are tested for all allowed sampling frequencies, rates and
160 // packet sizes.
161#ifdef WEBRTC_CODEC_AMR
162 if (test_mode_ != 0) {
163 printf("===============================================================\n");
164 }
165 test_count_++;
166 OpenOutFile(test_count_);
167 char codec_amr[] = "AMR";
168 RegisterSendCodec('A', codec_amr, 8000, 4750, 160, 2);
169 Run(channel_a_to_b_);
170 RegisterSendCodec('A', codec_amr, 8000, 4750, 320, 2);
171 Run(channel_a_to_b_);
172 RegisterSendCodec('A', codec_amr, 8000, 4750, 480, 3);
173 Run(channel_a_to_b_);
174 RegisterSendCodec('A', codec_amr, 8000, 5150, 160, 2);
175 Run(channel_a_to_b_);
176 RegisterSendCodec('A', codec_amr, 8000, 5150, 320, 2);
177 Run(channel_a_to_b_);
178 RegisterSendCodec('A', codec_amr, 8000, 5150, 480, 3);
179 Run(channel_a_to_b_);
180 RegisterSendCodec('A', codec_amr, 8000, 5900, 160, 1);
181 Run(channel_a_to_b_);
182 RegisterSendCodec('A', codec_amr, 8000, 5900, 320, 2);
183 Run(channel_a_to_b_);
184 RegisterSendCodec('A', codec_amr, 8000, 5900, 480, 2);
185 Run(channel_a_to_b_);
186 RegisterSendCodec('A', codec_amr, 8000, 6700, 160, 1);
187 Run(channel_a_to_b_);
188 RegisterSendCodec('A', codec_amr, 8000, 6700, 320, 2);
189 Run(channel_a_to_b_);
190 RegisterSendCodec('A', codec_amr, 8000, 6700, 480, 2);
191 Run(channel_a_to_b_);
192 RegisterSendCodec('A', codec_amr, 8000, 7400, 160, 1);
193 Run(channel_a_to_b_);
194 RegisterSendCodec('A', codec_amr, 8000, 7400, 320, 2);
195 Run(channel_a_to_b_);
196 RegisterSendCodec('A', codec_amr, 8000, 7400, 480, 3);
197 Run(channel_a_to_b_);
198 RegisterSendCodec('A', codec_amr, 8000, 7950, 160, 2);
199 Run(channel_a_to_b_);
200 RegisterSendCodec('A', codec_amr, 8000, 7950, 320, 2);
201 Run(channel_a_to_b_);
202 RegisterSendCodec('A', codec_amr, 8000, 7950, 480, 3);
203 Run(channel_a_to_b_);
204 RegisterSendCodec('A', codec_amr, 8000, 10200, 160, 1);
205 Run(channel_a_to_b_);
206 RegisterSendCodec('A', codec_amr, 8000, 10200, 320, 2);
207 Run(channel_a_to_b_);
208 RegisterSendCodec('A', codec_amr, 8000, 10200, 480, 3);
209 Run(channel_a_to_b_);
210 RegisterSendCodec('A', codec_amr, 8000, 12200, 160, 1);
211 Run(channel_a_to_b_);
212 RegisterSendCodec('A', codec_amr, 8000, 12200, 320, 2);
213 Run(channel_a_to_b_);
214 RegisterSendCodec('A', codec_amr, 8000, 12200, 480, 3);
215 Run(channel_a_to_b_);
216 outfile_b_.Close();
niklase@google.com470e71d2011-07-07 08:21:25 +0000217#endif
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +0000218#ifdef WEBRTC_CODEC_AMRWB
219 if (test_mode_ != 0) {
220 printf("===============================================================\n");
221 }
222 test_count_++;
223 char codec_amrwb[] = "AMR-WB";
224 OpenOutFile(test_count_);
225 RegisterSendCodec('A', codec_amrwb, 16000, 7000, 320, 0);
226 Run(channel_a_to_b_);
227 RegisterSendCodec('A', codec_amrwb, 16000, 7000, 640, 0);
228 Run(channel_a_to_b_);
229 RegisterSendCodec('A', codec_amrwb, 16000, 7000, 960, 0);
230 Run(channel_a_to_b_);
231 RegisterSendCodec('A', codec_amrwb, 16000, 9000, 320, 1);
232 Run(channel_a_to_b_);
233 RegisterSendCodec('A', codec_amrwb, 16000, 9000, 640, 2);
234 Run(channel_a_to_b_);
235 RegisterSendCodec('A', codec_amrwb, 16000, 9000, 960, 2);
236 Run(channel_a_to_b_);
237 RegisterSendCodec('A', codec_amrwb, 16000, 12000, 320, 3);
238 Run(channel_a_to_b_);
239 RegisterSendCodec('A', codec_amrwb, 16000, 12000, 640, 6);
240 Run(channel_a_to_b_);
241 RegisterSendCodec('A', codec_amrwb, 16000, 12000, 960, 8);
242 Run(channel_a_to_b_);
243 RegisterSendCodec('A', codec_amrwb, 16000, 14000, 320, 2);
244 Run(channel_a_to_b_);
245 RegisterSendCodec('A', codec_amrwb, 16000, 14000, 640, 4);
246 Run(channel_a_to_b_);
247 RegisterSendCodec('A', codec_amrwb, 16000, 14000, 960, 5);
248 Run(channel_a_to_b_);
249 RegisterSendCodec('A', codec_amrwb, 16000, 16000, 320, 1);
250 Run(channel_a_to_b_);
251 RegisterSendCodec('A', codec_amrwb, 16000, 16000, 640, 2);
252 Run(channel_a_to_b_);
253 RegisterSendCodec('A', codec_amrwb, 16000, 16000, 960, 2);
254 Run(channel_a_to_b_);
255 RegisterSendCodec('A', codec_amrwb, 16000, 18000, 320, 2);
256 Run(channel_a_to_b_);
257 RegisterSendCodec('A', codec_amrwb, 16000, 18000, 640, 4);
258 Run(channel_a_to_b_);
259 RegisterSendCodec('A', codec_amrwb, 16000, 18000, 960, 5);
260 Run(channel_a_to_b_);
261 RegisterSendCodec('A', codec_amrwb, 16000, 20000, 320, 1);
262 Run(channel_a_to_b_);
263 RegisterSendCodec('A', codec_amrwb, 16000, 20000, 640, 2);
264 Run(channel_a_to_b_);
265 RegisterSendCodec('A', codec_amrwb, 16000, 20000, 960, 2);
266 Run(channel_a_to_b_);
267 RegisterSendCodec('A', codec_amrwb, 16000, 23000, 320, 1);
268 Run(channel_a_to_b_);
269 RegisterSendCodec('A', codec_amrwb, 16000, 23000, 640, 3);
270 Run(channel_a_to_b_);
271 RegisterSendCodec('A', codec_amrwb, 16000, 23000, 960, 3);
272 Run(channel_a_to_b_);
273 RegisterSendCodec('A', codec_amrwb, 16000, 24000, 320, 1);
274 Run(channel_a_to_b_);
275 RegisterSendCodec('A', codec_amrwb, 16000, 24000, 640, 2);
276 Run(channel_a_to_b_);
277 RegisterSendCodec('A', codec_amrwb, 16000, 24000, 960, 2);
278 Run(channel_a_to_b_);
279 outfile_b_.Close();
niklase@google.com470e71d2011-07-07 08:21:25 +0000280#endif
281#ifdef WEBRTC_CODEC_G722
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +0000282 if (test_mode_ != 0) {
283 printf("===============================================================\n");
284 }
285 test_count_++;
286 OpenOutFile(test_count_);
287 char codec_g722[] = "G722";
288 RegisterSendCodec('A', codec_g722, 16000, 64000, 160, 0);
289 Run(channel_a_to_b_);
290 RegisterSendCodec('A', codec_g722, 16000, 64000, 320, 0);
291 Run(channel_a_to_b_);
292 RegisterSendCodec('A', codec_g722, 16000, 64000, 480, 0);
293 Run(channel_a_to_b_);
294 RegisterSendCodec('A', codec_g722, 16000, 64000, 640, 0);
295 Run(channel_a_to_b_);
296 RegisterSendCodec('A', codec_g722, 16000, 64000, 800, 0);
297 Run(channel_a_to_b_);
298 RegisterSendCodec('A', codec_g722, 16000, 64000, 960, 0);
299 Run(channel_a_to_b_);
300 outfile_b_.Close();
niklase@google.com470e71d2011-07-07 08:21:25 +0000301#endif
302#ifdef WEBRTC_CODEC_G722_1
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +0000303 if (test_mode_ != 0) {
304 printf("===============================================================\n");
305 }
306 test_count_++;
307 OpenOutFile(test_count_);
308 char codec_g722_1[] = "G7221";
309 RegisterSendCodec('A', codec_g722_1, 16000, 32000, 320, 0);
310 Run(channel_a_to_b_);
311 RegisterSendCodec('A', codec_g722_1, 16000, 24000, 320, 0);
312 Run(channel_a_to_b_);
313 RegisterSendCodec('A', codec_g722_1, 16000, 16000, 320, 0);
314 Run(channel_a_to_b_);
315 outfile_b_.Close();
niklase@google.com470e71d2011-07-07 08:21:25 +0000316#endif
317#ifdef WEBRTC_CODEC_G722_1C
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +0000318 if (test_mode_ != 0) {
319 printf("===============================================================\n");
320 }
321 test_count_++;
322 OpenOutFile(test_count_);
323 char codec_g722_1c[] = "G7221";
324 RegisterSendCodec('A', codec_g722_1c, 32000, 48000, 640, 0);
325 Run(channel_a_to_b_);
326 RegisterSendCodec('A', codec_g722_1c, 32000, 32000, 640, 0);
327 Run(channel_a_to_b_);
328 RegisterSendCodec('A', codec_g722_1c, 32000, 24000, 640, 0);
329 Run(channel_a_to_b_);
330 outfile_b_.Close();
niklase@google.com470e71d2011-07-07 08:21:25 +0000331#endif
332#ifdef WEBRTC_CODEC_G729
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +0000333 if (test_mode_ != 0) {
334 printf("===============================================================\n");
335 }
336 test_count_++;
337 OpenOutFile(test_count_);
338 char codec_g729[] = "G729";
339 RegisterSendCodec('A', codec_g729, 8000, 8000, 80, 0);
340 Run(channel_a_to_b_);
341 RegisterSendCodec('A', codec_g729, 8000, 8000, 160, 0);
342 Run(channel_a_to_b_);
343 RegisterSendCodec('A', codec_g729, 8000, 8000, 240, 0);
344 Run(channel_a_to_b_);
345 RegisterSendCodec('A', codec_g729, 8000, 8000, 320, 0);
346 Run(channel_a_to_b_);
347 RegisterSendCodec('A', codec_g729, 8000, 8000, 400, 0);
348 Run(channel_a_to_b_);
349 RegisterSendCodec('A', codec_g729, 8000, 8000, 480, 0);
350 Run(channel_a_to_b_);
351 outfile_b_.Close();
niklase@google.com470e71d2011-07-07 08:21:25 +0000352#endif
353#ifdef WEBRTC_CODEC_G729_1
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +0000354 if (test_mode_ != 0) {
355 printf("===============================================================\n");
356 }
357 test_count_++;
358 OpenOutFile(test_count_);
359 char codec_g729_1[] = "G7291";
360 RegisterSendCodec('A', codec_g729_1, 16000, 8000, 320, 1);
361 Run(channel_a_to_b_);
362 RegisterSendCodec('A', codec_g729_1, 16000, 8000, 640, 1);
363 Run(channel_a_to_b_);
364 RegisterSendCodec('A', codec_g729_1, 16000, 8000, 960, 1);
365 Run(channel_a_to_b_);
366 RegisterSendCodec('A', codec_g729_1, 16000, 12000, 320, 1);
367 Run(channel_a_to_b_);
368 RegisterSendCodec('A', codec_g729_1, 16000, 12000, 640, 1);
369 Run(channel_a_to_b_);
370 RegisterSendCodec('A', codec_g729_1, 16000, 12000, 960, 1);
371 Run(channel_a_to_b_);
372 RegisterSendCodec('A', codec_g729_1, 16000, 14000, 320, 1);
373 Run(channel_a_to_b_);
374 RegisterSendCodec('A', codec_g729_1, 16000, 14000, 640, 1);
375 Run(channel_a_to_b_);
376 RegisterSendCodec('A', codec_g729_1, 16000, 14000, 960, 1);
377 Run(channel_a_to_b_);
378 RegisterSendCodec('A', codec_g729_1, 16000, 16000, 320, 1);
379 Run(channel_a_to_b_);
380 RegisterSendCodec('A', codec_g729_1, 16000, 16000, 640, 1);
381 Run(channel_a_to_b_);
382 RegisterSendCodec('A', codec_g729_1, 16000, 16000, 960, 1);
383 Run(channel_a_to_b_);
384 RegisterSendCodec('A', codec_g729_1, 16000, 18000, 320, 1);
385 Run(channel_a_to_b_);
386 RegisterSendCodec('A', codec_g729_1, 16000, 18000, 640, 1);
387 Run(channel_a_to_b_);
388 RegisterSendCodec('A', codec_g729_1, 16000, 18000, 960, 1);
389 Run(channel_a_to_b_);
390 RegisterSendCodec('A', codec_g729_1, 16000, 20000, 320, 1);
391 Run(channel_a_to_b_);
392 RegisterSendCodec('A', codec_g729_1, 16000, 20000, 640, 1);
393 Run(channel_a_to_b_);
394 RegisterSendCodec('A', codec_g729_1, 16000, 20000, 960, 1);
395 Run(channel_a_to_b_);
396 RegisterSendCodec('A', codec_g729_1, 16000, 22000, 320, 1);
397 Run(channel_a_to_b_);
398 RegisterSendCodec('A', codec_g729_1, 16000, 22000, 640, 1);
399 Run(channel_a_to_b_);
400 RegisterSendCodec('A', codec_g729_1, 16000, 22000, 960, 1);
401 Run(channel_a_to_b_);
402 RegisterSendCodec('A', codec_g729_1, 16000, 24000, 320, 1);
403 Run(channel_a_to_b_);
404 RegisterSendCodec('A', codec_g729_1, 16000, 24000, 640, 1);
405 Run(channel_a_to_b_);
406 RegisterSendCodec('A', codec_g729_1, 16000, 24000, 960, 1);
407 Run(channel_a_to_b_);
408 RegisterSendCodec('A', codec_g729_1, 16000, 26000, 320, 1);
409 Run(channel_a_to_b_);
410 RegisterSendCodec('A', codec_g729_1, 16000, 26000, 640, 1);
411 Run(channel_a_to_b_);
412 RegisterSendCodec('A', codec_g729_1, 16000, 26000, 960, 1);
413 Run(channel_a_to_b_);
414 RegisterSendCodec('A', codec_g729_1, 16000, 28000, 320, 1);
415 Run(channel_a_to_b_);
416 RegisterSendCodec('A', codec_g729_1, 16000, 28000, 640, 1);
417 Run(channel_a_to_b_);
418 RegisterSendCodec('A', codec_g729_1, 16000, 28000, 960, 1);
419 Run(channel_a_to_b_);
420 RegisterSendCodec('A', codec_g729_1, 16000, 30000, 320, 1);
421 Run(channel_a_to_b_);
422 RegisterSendCodec('A', codec_g729_1, 16000, 30000, 640, 1);
423 Run(channel_a_to_b_);
424 RegisterSendCodec('A', codec_g729_1, 16000, 30000, 960, 1);
425 Run(channel_a_to_b_);
426 RegisterSendCodec('A', codec_g729_1, 16000, 32000, 320, 1);
427 Run(channel_a_to_b_);
428 RegisterSendCodec('A', codec_g729_1, 16000, 32000, 640, 1);
429 Run(channel_a_to_b_);
430 RegisterSendCodec('A', codec_g729_1, 16000, 32000, 960, 1);
431 Run(channel_a_to_b_);
432 outfile_b_.Close();
niklase@google.com470e71d2011-07-07 08:21:25 +0000433#endif
434#ifdef WEBRTC_CODEC_GSMFR
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +0000435 if (test_mode_ != 0) {
436 printf("===============================================================\n");
437 }
438 test_count_++;
439 OpenOutFile(test_count_);
440 char codec_gsmfr[] = "GSM";
441 RegisterSendCodec('A', codec_gsmfr, 8000, 13200, 160, 0);
442 Run(channel_a_to_b_);
443 RegisterSendCodec('A', codec_gsmfr, 8000, 13200, 320, 0);
444 Run(channel_a_to_b_);
445 RegisterSendCodec('A', codec_gsmfr, 8000, 13200, 480, 0);
446 Run(channel_a_to_b_);
447 outfile_b_.Close();
niklase@google.com470e71d2011-07-07 08:21:25 +0000448#endif
449#ifdef WEBRTC_CODEC_ILBC
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +0000450 if (test_mode_ != 0) {
451 printf("===============================================================\n");
452 }
453 test_count_++;
454 OpenOutFile(test_count_);
455 char codec_ilbc[] = "ILBC";
456 RegisterSendCodec('A', codec_ilbc, 8000, 13300, 240, 0);
457 Run(channel_a_to_b_);
458 RegisterSendCodec('A', codec_ilbc, 8000, 13300, 480, 0);
459 Run(channel_a_to_b_);
460 RegisterSendCodec('A', codec_ilbc, 8000, 15200, 160, 0);
461 Run(channel_a_to_b_);
462 RegisterSendCodec('A', codec_ilbc, 8000, 15200, 320, 0);
463 Run(channel_a_to_b_);
464 outfile_b_.Close();
niklase@google.com470e71d2011-07-07 08:21:25 +0000465#endif
466#if (defined(WEBRTC_CODEC_ISAC) || defined(WEBRTC_CODEC_ISACFX))
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +0000467 if (test_mode_ != 0) {
468 printf("===============================================================\n");
469 }
470 test_count_++;
471 OpenOutFile(test_count_);
472 char codec_isac[] = "ISAC";
473 RegisterSendCodec('A', codec_isac, 16000, -1, 480, -1);
474 Run(channel_a_to_b_);
475 RegisterSendCodec('A', codec_isac, 16000, -1, 960, -1);
476 Run(channel_a_to_b_);
477 RegisterSendCodec('A', codec_isac, 16000, 15000, 480, -1);
478 Run(channel_a_to_b_);
479 RegisterSendCodec('A', codec_isac, 16000, 32000, 960, -1);
480 Run(channel_a_to_b_);
481 outfile_b_.Close();
niklase@google.com470e71d2011-07-07 08:21:25 +0000482#endif
483#ifdef WEBRTC_CODEC_ISAC
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +0000484 if (test_mode_ != 0) {
485 printf("===============================================================\n");
486 }
487 test_count_++;
488 OpenOutFile(test_count_);
489 RegisterSendCodec('A', codec_isac, 32000, -1, 960, -1);
490 Run(channel_a_to_b_);
491 RegisterSendCodec('A', codec_isac, 32000, 56000, 960, -1);
492 Run(channel_a_to_b_);
493 RegisterSendCodec('A', codec_isac, 32000, 37000, 960, -1);
494 Run(channel_a_to_b_);
495 RegisterSendCodec('A', codec_isac, 32000, 32000, 960, -1);
496 Run(channel_a_to_b_);
497 outfile_b_.Close();
niklase@google.com470e71d2011-07-07 08:21:25 +0000498#endif
499#ifdef WEBRTC_CODEC_PCM16
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +0000500 if (test_mode_ != 0) {
501 printf("===============================================================\n");
502 }
503 test_count_++;
504 OpenOutFile(test_count_);
505 char codec_l16[] = "L16";
506 RegisterSendCodec('A', codec_l16, 8000, 128000, 80, 0);
507 Run(channel_a_to_b_);
508 RegisterSendCodec('A', codec_l16, 8000, 128000, 160, 0);
509 Run(channel_a_to_b_);
510 RegisterSendCodec('A', codec_l16, 8000, 128000, 240, 0);
511 Run(channel_a_to_b_);
512 RegisterSendCodec('A', codec_l16, 8000, 128000, 320, 0);
513 Run(channel_a_to_b_);
514 outfile_b_.Close();
515 if (test_mode_ != 0) {
516 printf("===============================================================\n");
517 }
518 test_count_++;
519 OpenOutFile(test_count_);
520 RegisterSendCodec('A', codec_l16, 16000, 256000, 160, 0);
521 Run(channel_a_to_b_);
522 RegisterSendCodec('A', codec_l16, 16000, 256000, 320, 0);
523 Run(channel_a_to_b_);
524 RegisterSendCodec('A', codec_l16, 16000, 256000, 480, 0);
525 Run(channel_a_to_b_);
526 RegisterSendCodec('A', codec_l16, 16000, 256000, 640, 0);
527 Run(channel_a_to_b_);
528 outfile_b_.Close();
529 if (test_mode_ != 0) {
530 printf("===============================================================\n");
531 }
532 test_count_++;
533 OpenOutFile(test_count_);
534 RegisterSendCodec('A', codec_l16, 32000, 512000, 320, 0);
535 Run(channel_a_to_b_);
536 RegisterSendCodec('A', codec_l16, 32000, 512000, 640, 0);
537 Run(channel_a_to_b_);
538 outfile_b_.Close();
niklase@google.com470e71d2011-07-07 08:21:25 +0000539#endif
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +0000540 if (test_mode_ != 0) {
541 printf("===============================================================\n");
542 }
543 test_count_++;
544 OpenOutFile(test_count_);
545 char codec_pcma[] = "PCMA";
546 RegisterSendCodec('A', codec_pcma, 8000, 64000, 80, 0);
547 Run(channel_a_to_b_);
548 RegisterSendCodec('A', codec_pcma, 8000, 64000, 160, 0);
549 Run(channel_a_to_b_);
550 RegisterSendCodec('A', codec_pcma, 8000, 64000, 240, 0);
551 Run(channel_a_to_b_);
552 RegisterSendCodec('A', codec_pcma, 8000, 64000, 320, 0);
553 Run(channel_a_to_b_);
554 RegisterSendCodec('A', codec_pcma, 8000, 64000, 400, 0);
555 Run(channel_a_to_b_);
556 RegisterSendCodec('A', codec_pcma, 8000, 64000, 480, 0);
557 Run(channel_a_to_b_);
558 if (test_mode_ != 0) {
559 printf("===============================================================\n");
560 }
561 char codec_pcmu[] = "PCMU";
562 RegisterSendCodec('A', codec_pcmu, 8000, 64000, 80, 0);
563 Run(channel_a_to_b_);
564 RegisterSendCodec('A', codec_pcmu, 8000, 64000, 160, 0);
565 Run(channel_a_to_b_);
566 RegisterSendCodec('A', codec_pcmu, 8000, 64000, 240, 0);
567 Run(channel_a_to_b_);
568 RegisterSendCodec('A', codec_pcmu, 8000, 64000, 320, 0);
569 Run(channel_a_to_b_);
570 RegisterSendCodec('A', codec_pcmu, 8000, 64000, 400, 0);
571 Run(channel_a_to_b_);
572 RegisterSendCodec('A', codec_pcmu, 8000, 64000, 480, 0);
573 Run(channel_a_to_b_);
574 outfile_b_.Close();
niklase@google.com470e71d2011-07-07 08:21:25 +0000575#ifdef WEBRTC_CODEC_SPEEX
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +0000576 if (test_mode_ != 0) {
577 printf("===============================================================\n");
578 }
579 test_count_++;
580 OpenOutFile(test_count_);
581 char codec_speex[] = "SPEEX";
582 RegisterSendCodec('A', codec_speex, 8000, 2400, 160, 0);
583 Run(channel_a_to_b_);
584 RegisterSendCodec('A', codec_speex, 8000, 8000, 320, 0);
585 Run(channel_a_to_b_);
586 RegisterSendCodec('A', codec_speex, 8000, 18200, 480, 0);
587 Run(channel_a_to_b_);
588 outfile_b_.Close();
niklase@google.com470e71d2011-07-07 08:21:25 +0000589
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +0000590 if (test_mode_ != 0) {
591 printf("===============================================================\n");
592 }
593 test_count_++;
594 OpenOutFile(test_count_);
595 RegisterSendCodec('A', codec_speex, 16000, 4000, 320, 0);
596 Run(channel_a_to_b_);
597 RegisterSendCodec('A', codec_speex, 16000, 12800, 640, 0);
598 Run(channel_a_to_b_);
599 RegisterSendCodec('A', codec_speex, 16000, 34200, 960, 0);
600 Run(channel_a_to_b_);
601 outfile_b_.Close();
niklase@google.com470e71d2011-07-07 08:21:25 +0000602#endif
tina.legrand@webrtc.orgdf697752012-02-08 10:22:21 +0000603#ifdef WEBRTC_CODEC_CELT
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +0000604 if (test_mode_ != 0) {
605 printf("===============================================================\n");
606 }
607 test_count_++;
608 OpenOutFile(test_count_);
609 char codec_celt[] = "CELT";
610 RegisterSendCodec('A', codec_celt, 32000, 48000, 640, 0);
611 Run(channel_a_to_b_);
612 RegisterSendCodec('A', codec_celt, 32000, 64000, 640, 0);
613 Run(channel_a_to_b_);
614 RegisterSendCodec('A', codec_celt, 32000, 128000, 640, 0);
615 Run(channel_a_to_b_);
616 outfile_b_.Close();
tina.legrand@webrtc.orgdf697752012-02-08 10:22:21 +0000617#endif
tina.legrand@webrtc.orga7d83872012-10-18 10:00:52 +0000618#ifdef WEBRTC_CODEC_OPUS
619 if (test_mode_ != 0) {
620 printf("===============================================================\n");
621 }
622 test_count_++;
623 OpenOutFile(test_count_);
624 char codec_opus[] = "OPUS";
tina.legrand@webrtc.org46d90dc2013-02-01 14:20:06 +0000625 RegisterSendCodec('A', codec_opus, 48000, 6000, 480, -1);
tina.legrand@webrtc.orga7d83872012-10-18 10:00:52 +0000626 Run(channel_a_to_b_);
tina.legrand@webrtc.org46d90dc2013-02-01 14:20:06 +0000627 RegisterSendCodec('A', codec_opus, 48000, 20000, 480*2, -1);
tina.legrand@webrtc.orga7d83872012-10-18 10:00:52 +0000628 Run(channel_a_to_b_);
tina.legrand@webrtc.org46d90dc2013-02-01 14:20:06 +0000629 RegisterSendCodec('A', codec_opus, 48000, 32000, 480*4, -1);
tina.legrand@webrtc.orga7d83872012-10-18 10:00:52 +0000630 Run(channel_a_to_b_);
tina.legrand@webrtc.org46d90dc2013-02-01 14:20:06 +0000631 RegisterSendCodec('A', codec_opus, 48000, 48000, 480, -1);
tina.legrand@webrtc.orga7d83872012-10-18 10:00:52 +0000632 Run(channel_a_to_b_);
tina.legrand@webrtc.org46d90dc2013-02-01 14:20:06 +0000633 RegisterSendCodec('A', codec_opus, 48000, 64000, 480*4, -1);
tina.legrand@webrtc.orga7d83872012-10-18 10:00:52 +0000634 Run(channel_a_to_b_);
tina.legrand@webrtc.org46d90dc2013-02-01 14:20:06 +0000635 RegisterSendCodec('A', codec_opus, 48000, 96000, 480*6, -1);
tina.legrand@webrtc.orga7d83872012-10-18 10:00:52 +0000636 Run(channel_a_to_b_);
tina.legrand@webrtc.org46d90dc2013-02-01 14:20:06 +0000637 RegisterSendCodec('A', codec_opus, 48000, 500000, 480*2, -1);
tina.legrand@webrtc.orga7d83872012-10-18 10:00:52 +0000638 Run(channel_a_to_b_);
tina.legrand@webrtc.orgc4590582012-11-28 12:23:29 +0000639 outfile_b_.Close();
tina.legrand@webrtc.orga7d83872012-10-18 10:00:52 +0000640#endif
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +0000641 if (test_mode_ != 0) {
642 printf("===============================================================\n");
niklase@google.com470e71d2011-07-07 08:21:25 +0000643
644 /* Print out all codecs that were not tested in the run */
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +0000645 printf("The following codecs was not included in the test:\n");
646#ifndef WEBRTC_CODEC_AMR
647 printf(" GSMAMR\n");
niklase@google.com470e71d2011-07-07 08:21:25 +0000648#endif
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +0000649#ifndef WEBRTC_CODEC_AMRWB
650 printf(" GSMAMR-wb\n");
niklase@google.com470e71d2011-07-07 08:21:25 +0000651#endif
652#ifndef WEBRTC_CODEC_G722
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +0000653 printf(" G.722\n");
niklase@google.com470e71d2011-07-07 08:21:25 +0000654#endif
655#ifndef WEBRTC_CODEC_G722_1
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +0000656 printf(" G.722.1\n");
niklase@google.com470e71d2011-07-07 08:21:25 +0000657#endif
658#ifndef WEBRTC_CODEC_G722_1C
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +0000659 printf(" G.722.1C\n");
niklase@google.com470e71d2011-07-07 08:21:25 +0000660#endif
661#ifndef WEBRTC_CODEC_G729
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +0000662 printf(" G.729\n");
niklase@google.com470e71d2011-07-07 08:21:25 +0000663#endif
664#ifndef WEBRTC_CODEC_G729_1
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +0000665 printf(" G.729.1\n");
niklase@google.com470e71d2011-07-07 08:21:25 +0000666#endif
667#ifndef WEBRTC_CODEC_GSMFR
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +0000668 printf(" GSMFR\n");
niklase@google.com470e71d2011-07-07 08:21:25 +0000669#endif
670#ifndef WEBRTC_CODEC_ILBC
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +0000671 printf(" iLBC\n");
niklase@google.com470e71d2011-07-07 08:21:25 +0000672#endif
673#ifndef WEBRTC_CODEC_ISAC
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +0000674 printf(" ISAC float\n");
niklase@google.com470e71d2011-07-07 08:21:25 +0000675#endif
676#ifndef WEBRTC_CODEC_ISACFX
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +0000677 printf(" ISAC fix\n");
niklase@google.com470e71d2011-07-07 08:21:25 +0000678#endif
679#ifndef WEBRTC_CODEC_PCM16
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +0000680 printf(" PCM16\n");
niklase@google.com470e71d2011-07-07 08:21:25 +0000681#endif
682#ifndef WEBRTC_CODEC_SPEEX
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +0000683 printf(" Speex\n");
niklase@google.com470e71d2011-07-07 08:21:25 +0000684#endif
685
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +0000686 printf("\nTo complete the test, listen to the %d number of output files.\n",
687 test_count_);
688 }
niklase@google.com470e71d2011-07-07 08:21:25 +0000689}
690
691// Register Codec to use in the test
692//
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +0000693// Input: side - which ACM to use, 'A' or 'B'
694// codec_name - name to use when register the codec
695// sampling_freq_hz - sampling frequency in Herz
696// rate - bitrate in bytes
697// packet_size - packet size in samples
698// extra_byte - if extra bytes needed compared to the bitrate
niklase@google.com470e71d2011-07-07 08:21:25 +0000699// used when registering, can be an internal header
700// set to -1 if the codec is a variable rate codec
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +0000701void TestAllCodecs::RegisterSendCodec(char side, char* codec_name,
702 int32_t sampling_freq_hz, int rate,
703 int packet_size, int extra_byte) {
704 if (test_mode_ != 0) {
705 // Print out codec and settings.
706 printf("codec: %s Freq: %d Rate: %d PackSize: %d\n", codec_name,
707 sampling_freq_hz, rate, packet_size);
708 }
709
710 // Store packet-size in samples, used to validate the received packet.
711 // If G.722, store half the size to compensate for the timestamp bug in the
712 // RFC for G.722.
713 // If iSAC runs in adaptive mode, packet size in samples can change on the
714 // fly, so we exclude this test by setting |packet_size_samples_| to -1.
715 if (!strcmp(codec_name, "G722")) {
716 packet_size_samples_ = packet_size / 2;
717 } else if (!strcmp(codec_name, "ISAC") && (rate == -1)) {
718 packet_size_samples_ = -1;
719 } else {
720 packet_size_samples_ = packet_size;
721 }
722
723 // Store the expected packet size in bytes, used to validate the received
724 // packet. If variable rate codec (extra_byte == -1), set to -1 (65535).
725 if (extra_byte != -1) {
726 // Add 0.875 to always round up to a whole byte
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +0000727 packet_size_bytes_ = static_cast<uint16_t>(static_cast<float>(packet_size
728 * rate) / static_cast<float>(sampling_freq_hz * 8) + 0.875)
729 + extra_byte;
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +0000730 } else {
731 // Packets will have a variable size.
732 packet_size_bytes_ = -1;
733 }
734
735 // Set pointer to the ACM where to register the codec.
736 AudioCodingModule* my_acm = NULL;
737 switch (side) {
738 case 'A': {
739 my_acm = acm_a_;
740 break;
niklase@google.com470e71d2011-07-07 08:21:25 +0000741 }
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +0000742 case 'B': {
743 my_acm = acm_b_;
744 break;
niklase@google.com470e71d2011-07-07 08:21:25 +0000745 }
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +0000746 default: {
747 break;
niklase@google.com470e71d2011-07-07 08:21:25 +0000748 }
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +0000749 }
750 ASSERT_TRUE(my_acm != NULL);
niklase@google.com470e71d2011-07-07 08:21:25 +0000751
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +0000752 // Get all codec parameters before registering
753 CodecInst my_codec_param;
tina.legrand@webrtc.org7a7a0082013-02-21 10:27:48 +0000754 CHECK_ERROR(AudioCodingModule::Codec(codec_name, &my_codec_param,
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +0000755 sampling_freq_hz, 1));
756 my_codec_param.rate = rate;
757 my_codec_param.pacsize = packet_size;
758 CHECK_ERROR(my_acm->RegisterSendCodec(my_codec_param));
niklase@google.com470e71d2011-07-07 08:21:25 +0000759}
760
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +0000761void TestAllCodecs::Run(TestPack* channel) {
762 AudioFrame audio_frame;
niklase@google.com470e71d2011-07-07 08:21:25 +0000763
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +0000764 int32_t out_freq_hz = outfile_b_.SamplingFrequency();
765 uint16_t receive_size;
766 uint32_t timestamp_diff;
767 channel->reset_payload_size();
768 int error_count = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000769
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +0000770 int counter = 0;
771 while (!infile_a_.EndOfFile()) {
772 // Add 10 msec to ACM.
773 infile_a_.Read10MsData(audio_frame);
774 CHECK_ERROR(acm_a_->Add10MsData(audio_frame));
niklase@google.com470e71d2011-07-07 08:21:25 +0000775
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +0000776 // Run sender side of ACM.
777 CHECK_ERROR(acm_a_->Process());
niklase@google.com470e71d2011-07-07 08:21:25 +0000778
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +0000779 // Verify that the received packet size matches the settings.
780 receive_size = channel->payload_size();
781 if (receive_size) {
782 if ((receive_size != packet_size_bytes_) &&
783 (packet_size_bytes_ < 65535)) {
784 error_count++;
785 }
niklase@google.com470e71d2011-07-07 08:21:25 +0000786
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +0000787 // Verify that the timestamp is updated with expected length. The counter
788 // is used to avoid problems when switching codec or frame size in the
789 // test.
790 timestamp_diff = channel->timestamp_diff();
791 if ((counter > 10) && (timestamp_diff != packet_size_samples_) &&
792 (packet_size_samples_ < 65535))
793 error_count++;
niklase@google.com470e71d2011-07-07 08:21:25 +0000794 }
795
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +0000796 // Run received side of ACM.
tina.legrand@webrtc.org7a7a0082013-02-21 10:27:48 +0000797 CHECK_ERROR(acm_b_->PlayoutData10Ms(out_freq_hz, &audio_frame));
niklase@google.com470e71d2011-07-07 08:21:25 +0000798
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +0000799 // Write output speech to file.
800 outfile_b_.Write10MsData(audio_frame.data_,
801 audio_frame.samples_per_channel_);
802
803 // Update loop counter
804 counter++;
805 }
806
807 EXPECT_EQ(0, error_count);
808
809 if (infile_a_.EndOfFile()) {
810 infile_a_.Rewind();
811 }
niklase@google.com470e71d2011-07-07 08:21:25 +0000812}
813
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +0000814void TestAllCodecs::OpenOutFile(int test_number) {
815 std::string filename = webrtc::test::OutputPath();
816 std::ostringstream test_number_str;
817 test_number_str << test_number;
818 filename += "testallcodecs_out_";
819 filename += test_number_str.str();
820 filename += ".pcm";
tina.legrand@webrtc.orgba468042012-08-17 10:38:28 +0000821 outfile_b_.Open(filename, 32000, "wb");
niklase@google.com470e71d2011-07-07 08:21:25 +0000822}
823
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +0000824void TestAllCodecs::DisplaySendReceiveCodec() {
825 CodecInst my_codec_param;
tina.legrand@webrtc.org7a7a0082013-02-21 10:27:48 +0000826 acm_a_->SendCodec(&my_codec_param);
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +0000827 printf("%s -> ", my_codec_param.plname);
tina.legrand@webrtc.org7a7a0082013-02-21 10:27:48 +0000828 acm_b_->ReceiveCodec(&my_codec_param);
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +0000829 printf("%s\n", my_codec_param.plname);
niklase@google.com470e71d2011-07-07 08:21:25 +0000830}
831
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +0000832} // namespace webrtc
tina.legrand@webrtc.org554ae1a2011-12-16 10:09:04 +0000833