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

Side by Side Diff: webrtc/media/engine/webrtcvoiceengine_unittest.cc

Issue 2707133007: Pick a matching CN codec, rather than the first CN codec. (Closed)
Patch Set: Created 3 years, 10 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) 2008 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2008 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 1225 matching lines...) Expand 10 before | Expand all | Expand 10 after
1236 parameters.codecs[0].id = 96; 1236 parameters.codecs[0].id = 96;
1237 parameters.codecs[0].bitrate = 48000; 1237 parameters.codecs[0].bitrate = 48000;
1238 const int initial_num = call_.GetNumCreatedSendStreams(); 1238 const int initial_num = call_.GetNumCreatedSendStreams();
1239 SetSendParameters(parameters); 1239 SetSendParameters(parameters);
1240 EXPECT_EQ(initial_num + 1, call_.GetNumCreatedSendStreams()); 1240 EXPECT_EQ(initial_num + 1, call_.GetNumCreatedSendStreams());
1241 const auto& send_codec_spec = GetSendStreamConfig(kSsrc1).send_codec_spec; 1241 const auto& send_codec_spec = GetSendStreamConfig(kSsrc1).send_codec_spec;
1242 EXPECT_EQ(96, send_codec_spec.codec_inst.pltype); 1242 EXPECT_EQ(96, send_codec_spec.codec_inst.pltype);
1243 EXPECT_EQ(48000, send_codec_spec.codec_inst.rate); 1243 EXPECT_EQ(48000, send_codec_spec.codec_inst.rate);
1244 EXPECT_STREQ("ISAC", send_codec_spec.codec_inst.plname); 1244 EXPECT_STREQ("ISAC", send_codec_spec.codec_inst.plname);
1245 EXPECT_NE(send_codec_spec.codec_inst.plfreq, send_codec_spec.cng_plfreq); 1245 EXPECT_NE(send_codec_spec.codec_inst.plfreq, send_codec_spec.cng_plfreq);
1246 EXPECT_EQ(13, send_codec_spec.cng_payload_type); 1246 EXPECT_EQ(-1, send_codec_spec.cng_payload_type);
1247 EXPECT_EQ(webrtc::kFreq8000Hz, send_codec_spec.cng_plfreq);
1248 EXPECT_FALSE(channel_->CanInsertDtmf()); 1247 EXPECT_FALSE(channel_->CanInsertDtmf());
1249 } 1248 }
1250 1249
1251 // Test that VoE Channel doesn't call SetSendCodec again if same codec is tried 1250 // Test that VoE Channel doesn't call SetSendCodec again if same codec is tried
1252 // to apply. 1251 // to apply.
1253 TEST_F(WebRtcVoiceEngineTestFake, DontResetSetSendCodec) { 1252 TEST_F(WebRtcVoiceEngineTestFake, DontResetSetSendCodec) {
1254 EXPECT_TRUE(SetupSendStream()); 1253 EXPECT_TRUE(SetupSendStream());
1255 cricket::AudioSendParameters parameters; 1254 cricket::AudioSendParameters parameters;
1256 parameters.codecs.push_back(kIsacCodec); 1255 parameters.codecs.push_back(kIsacCodec);
1257 parameters.codecs.push_back(kPcmuCodec); 1256 parameters.codecs.push_back(kPcmuCodec);
(...skipping 1084 matching lines...) Expand 10 before | Expand all | Expand 10 after
2342 } 2341 }
2343 2342
2344 // Change to PCMU(8K) and CN(16K). 2343 // Change to PCMU(8K) and CN(16K).
2345 parameters.codecs[0] = kPcmuCodec; 2344 parameters.codecs[0] = kPcmuCodec;
2346 SetSendParameters(parameters); 2345 SetSendParameters(parameters);
2347 for (uint32_t ssrc : kSsrcs4) { 2346 for (uint32_t ssrc : kSsrcs4) {
2348 ASSERT_TRUE(call_.GetAudioSendStream(ssrc) != nullptr); 2347 ASSERT_TRUE(call_.GetAudioSendStream(ssrc) != nullptr);
2349 const auto& send_codec_spec = 2348 const auto& send_codec_spec =
2350 call_.GetAudioSendStream(ssrc)->GetConfig().send_codec_spec; 2349 call_.GetAudioSendStream(ssrc)->GetConfig().send_codec_spec;
2351 EXPECT_STREQ("PCMU", send_codec_spec.codec_inst.plname); 2350 EXPECT_STREQ("PCMU", send_codec_spec.codec_inst.plname);
2352 EXPECT_NE(send_codec_spec.codec_inst.plfreq, send_codec_spec.cng_plfreq); 2351 EXPECT_EQ(-1, send_codec_spec.cng_payload_type);
2353 EXPECT_EQ(97, send_codec_spec.cng_payload_type);
2354 EXPECT_EQ(webrtc::kFreq16000Hz, send_codec_spec.cng_plfreq);
2355 } 2352 }
2356 } 2353 }
2357 2354
2358 // Test we can SetSend on all send streams correctly. 2355 // Test we can SetSend on all send streams correctly.
2359 TEST_F(WebRtcVoiceEngineTestFake, SetSendWithMultipleSendStreams) { 2356 TEST_F(WebRtcVoiceEngineTestFake, SetSendWithMultipleSendStreams) {
2360 SetupForMultiSendStream(); 2357 SetupForMultiSendStream();
2361 2358
2362 // Create the send channels and they should be a "not sending" date. 2359 // Create the send channels and they should be a "not sending" date.
2363 for (uint32_t ssrc : kSsrcs4) { 2360 for (uint32_t ssrc : kSsrcs4) {
2364 EXPECT_TRUE(channel_->AddSendStream( 2361 EXPECT_TRUE(channel_->AddSendStream(
(...skipping 1362 matching lines...) Expand 10 before | Expand all | Expand 10 after
3727 // Without this cast, the comparison turned unsigned and, thus, failed for -1. 3724 // Without this cast, the comparison turned unsigned and, thus, failed for -1.
3728 const int num_specs = static_cast<int>(specs.size()); 3725 const int num_specs = static_cast<int>(specs.size());
3729 EXPECT_GE(find_codec({"cn", 8000, 1}), num_specs); 3726 EXPECT_GE(find_codec({"cn", 8000, 1}), num_specs);
3730 EXPECT_GE(find_codec({"cn", 16000, 1}), num_specs); 3727 EXPECT_GE(find_codec({"cn", 16000, 1}), num_specs);
3731 EXPECT_EQ(find_codec({"cn", 32000, 1}), -1); 3728 EXPECT_EQ(find_codec({"cn", 32000, 1}), -1);
3732 EXPECT_GE(find_codec({"telephone-event", 8000, 1}), num_specs); 3729 EXPECT_GE(find_codec({"telephone-event", 8000, 1}), num_specs);
3733 EXPECT_GE(find_codec({"telephone-event", 16000, 1}), num_specs); 3730 EXPECT_GE(find_codec({"telephone-event", 16000, 1}), num_specs);
3734 EXPECT_GE(find_codec({"telephone-event", 32000, 1}), num_specs); 3731 EXPECT_GE(find_codec({"telephone-event", 32000, 1}), num_specs);
3735 EXPECT_GE(find_codec({"telephone-event", 48000, 1}), num_specs); 3732 EXPECT_GE(find_codec({"telephone-event", 48000, 1}), num_specs);
3736 } 3733 }
OLDNEW
« webrtc/media/engine/webrtcvoiceengine.cc ('K') | « webrtc/media/engine/webrtcvoiceengine.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698