Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(407)

Side by Side Diff: webrtc/modules/audio_coding/test/EncodeDecodeTest.cc

Issue 2388153004: Stop using old AudioCodingModule::RegisterReceiveCodec overloads (Closed)
Patch Set: rebase Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 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 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 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
11 #include "webrtc/modules/audio_coding/test/EncodeDecodeTest.h" 11 #include "webrtc/modules/audio_coding/test/EncodeDecodeTest.h"
12 12
13 #include <memory> 13 #include <memory>
14 #include <sstream> 14 #include <sstream>
15 #include <stdio.h> 15 #include <stdio.h>
16 #include <stdlib.h> 16 #include <stdlib.h>
17 17
18 #include "webrtc/common_types.h" 18 #include "webrtc/common_types.h"
19 #include "webrtc/modules/audio_coding/acm2/acm_common_defs.h" 19 #include "webrtc/modules/audio_coding/acm2/acm_common_defs.h"
20 #include "webrtc/modules/audio_coding/codecs/audio_format_conversion.h"
20 #include "webrtc/modules/audio_coding/include/audio_coding_module.h" 21 #include "webrtc/modules/audio_coding/include/audio_coding_module.h"
21 #include "webrtc/modules/audio_coding/test/utility.h" 22 #include "webrtc/modules/audio_coding/test/utility.h"
22 #include "webrtc/system_wrappers/include/trace.h" 23 #include "webrtc/system_wrappers/include/trace.h"
23 #include "webrtc/test/gtest.h" 24 #include "webrtc/test/gtest.h"
24 #include "webrtc/test/testsupport/fileutils.h" 25 #include "webrtc/test/testsupport/fileutils.h"
25 26
26 namespace webrtc { 27 namespace webrtc {
27 28
28 TestPacketization::TestPacketization(RTPStream *rtpStream, uint16_t frequency) 29 TestPacketization::TestPacketization(RTPStream *rtpStream, uint16_t frequency)
29 : _rtpStream(rtpStream), 30 : _rtpStream(rtpStream),
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 void Receiver::Setup(AudioCodingModule *acm, RTPStream *rtpStream, 126 void Receiver::Setup(AudioCodingModule *acm, RTPStream *rtpStream,
126 std::string out_file_name, size_t channels) { 127 std::string out_file_name, size_t channels) {
127 struct CodecInst recvCodec = CodecInst(); 128 struct CodecInst recvCodec = CodecInst();
128 int noOfCodecs; 129 int noOfCodecs;
129 EXPECT_EQ(0, acm->InitializeReceiver()); 130 EXPECT_EQ(0, acm->InitializeReceiver());
130 131
131 noOfCodecs = acm->NumberOfCodecs(); 132 noOfCodecs = acm->NumberOfCodecs();
132 for (int i = 0; i < noOfCodecs; i++) { 133 for (int i = 0; i < noOfCodecs; i++) {
133 EXPECT_EQ(0, acm->Codec(i, &recvCodec)); 134 EXPECT_EQ(0, acm->Codec(i, &recvCodec));
134 if (recvCodec.channels == channels) 135 if (recvCodec.channels == channels)
135 EXPECT_EQ(0, acm->RegisterReceiveCodec(recvCodec)); 136 EXPECT_EQ(true, acm->RegisterReceiveCodec(recvCodec.pltype,
137 CodecInstToSdp(recvCodec)));
136 // Forces mono/stereo for Opus. 138 // Forces mono/stereo for Opus.
137 if (!strcmp(recvCodec.plname, "opus")) { 139 if (!strcmp(recvCodec.plname, "opus")) {
138 recvCodec.channels = channels; 140 recvCodec.channels = channels;
139 EXPECT_EQ(0, acm->RegisterReceiveCodec(recvCodec)); 141 EXPECT_EQ(true, acm->RegisterReceiveCodec(recvCodec.pltype,
142 CodecInstToSdp(recvCodec)));
140 } 143 }
141 } 144 }
142 145
143 int playSampFreq; 146 int playSampFreq;
144 std::string file_name; 147 std::string file_name;
145 std::stringstream file_stream; 148 std::stringstream file_stream;
146 file_stream << webrtc::test::OutputPath() << out_file_name 149 file_stream << webrtc::test::OutputPath() << out_file_name
147 << static_cast<int>(codeId) << ".pcm"; 150 << static_cast<int>(codeId) << ".pcm";
148 file_name = file_stream.str(); 151 file_name = file_stream.str();
149 _rtpStream = rtpStream; 152 _rtpStream = rtpStream;
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 if (acm->SendCodec()) { 353 if (acm->SendCodec()) {
351 _sender.Run(); 354 _sender.Run();
352 } 355 }
353 _sender.Teardown(); 356 _sender.Teardown();
354 rtpFile.Close(); 357 rtpFile.Close();
355 358
356 return fileName; 359 return fileName;
357 } 360 }
358 361
359 } // namespace webrtc 362 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698