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

Side by Side Diff: webrtc/modules/audio_coding/neteq/neteq_impl_unittest.cc

Issue 2365653004: AudioCodingModule: Specify decoders using SdpAudioFormat (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
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 204
205 205
206 // This tests the interface class NetEq. 206 // This tests the interface class NetEq.
207 // TODO(hlundin): Move to separate file? 207 // TODO(hlundin): Move to separate file?
208 TEST(NetEq, CreateAndDestroy) { 208 TEST(NetEq, CreateAndDestroy) {
209 NetEq::Config config; 209 NetEq::Config config;
210 NetEq* neteq = NetEq::Create(config, CreateBuiltinAudioDecoderFactory()); 210 NetEq* neteq = NetEq::Create(config, CreateBuiltinAudioDecoderFactory());
211 delete neteq; 211 delete neteq;
212 } 212 }
213 213
214 TEST_F(NetEqImplTest, RegisterPayloadType) { 214 TEST_F(NetEqImplTest, RegisterPayloadTypeNetEqDecoder) {
215 CreateInstance(); 215 CreateInstance();
216 uint8_t rtp_payload_type = 0; 216 uint8_t rtp_payload_type = 0;
217 NetEqDecoder codec_type = NetEqDecoder::kDecoderPCMu; 217 NetEqDecoder codec_type = NetEqDecoder::kDecoderPCMu;
218 const std::string kCodecName = "Robert\'); DROP TABLE Students;"; 218 const std::string kCodecName = "Robert\'); DROP TABLE Students;";
219 EXPECT_CALL(*mock_decoder_database_, 219 EXPECT_CALL(*mock_decoder_database_,
220 RegisterPayload(rtp_payload_type, codec_type, kCodecName)); 220 RegisterPayload(rtp_payload_type, codec_type, kCodecName));
221 neteq_->RegisterPayloadType(codec_type, kCodecName, rtp_payload_type); 221 neteq_->RegisterPayloadType(codec_type, kCodecName, rtp_payload_type);
222 } 222 }
223 223
224 TEST_F(NetEqImplTest, RegisterPayloadType) {
225 CreateInstance();
226 constexpr int rtp_payload_type = 0;
hlundin-webrtc 2016/10/05 13:39:14 Compile-time constant => kRtpPayloadType.
kwiberg-webrtc 2016/10/06 09:20:46 That naming rule is mandatory only for variables w
227 const SdpAudioFormat format("pcmu", 8000, 1);
228 EXPECT_CALL(*mock_decoder_database_,
229 RegisterPayload(rtp_payload_type, format));
230 neteq_->RegisterPayloadType(rtp_payload_type, format);
231 }
232
224 TEST_F(NetEqImplTest, RemovePayloadType) { 233 TEST_F(NetEqImplTest, RemovePayloadType) {
225 CreateInstance(); 234 CreateInstance();
226 uint8_t rtp_payload_type = 0; 235 uint8_t rtp_payload_type = 0;
227 EXPECT_CALL(*mock_decoder_database_, Remove(rtp_payload_type)) 236 EXPECT_CALL(*mock_decoder_database_, Remove(rtp_payload_type))
228 .WillOnce(Return(DecoderDatabase::kDecoderNotFound)); 237 .WillOnce(Return(DecoderDatabase::kDecoderNotFound));
229 // Check that kFail is returned when database returns kDecoderNotFound. 238 // Check that kFail is returned when database returns kDecoderNotFound.
230 EXPECT_EQ(NetEq::kFail, neteq_->RemovePayloadType(rtp_payload_type)); 239 EXPECT_EQ(NetEq::kFail, neteq_->RemovePayloadType(rtp_payload_type));
231 } 240 }
232 241
233 TEST_F(NetEqImplTest, RemoveAllPayloadTypes) { 242 TEST_F(NetEqImplTest, RemoveAllPayloadTypes) {
(...skipping 1182 matching lines...) Expand 10 before | Expand all | Expand 10 after
1416 EXPECT_CALL(*mock_delay_manager_, BufferLimits(_, _)) 1425 EXPECT_CALL(*mock_delay_manager_, BufferLimits(_, _))
1417 .Times(1) 1426 .Times(1)
1418 .WillOnce(DoAll(SetArgPointee<0>(1), SetArgPointee<1>(2))); 1427 .WillOnce(DoAll(SetArgPointee<0>(1), SetArgPointee<1>(2)));
1419 1428
1420 bool muted; 1429 bool muted;
1421 EXPECT_EQ(NetEq::kOK, neteq_->GetAudio(&output_, &muted)); 1430 EXPECT_EQ(NetEq::kOK, neteq_->GetAudio(&output_, &muted));
1422 EXPECT_EQ(kAccelerate, neteq_->last_operation_for_test()); 1431 EXPECT_EQ(kAccelerate, neteq_->last_operation_for_test());
1423 } 1432 }
1424 1433
1425 }// namespace webrtc 1434 }// namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698