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

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

Issue 2740783006: Support removing b=AS bandwidth constraints. (Closed)
Patch Set: Created 3 years, 9 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 377 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 resulting_parameters.encodings[0].max_bitrate_bps); 388 resulting_parameters.encodings[0].max_bitrate_bps);
389 389
390 // Verify that the codec settings have the expected bitrate. 390 // Verify that the codec settings have the expected bitrate.
391 EXPECT_EQ(expected_codec_bitrate, GetCodecBitrate(kSsrcX)); 391 EXPECT_EQ(expected_codec_bitrate, GetCodecBitrate(kSsrcX));
392 } 392 }
393 393
394 void SetSendCodecsShouldWorkForBitrates(const char* min_bitrate_kbps, 394 void SetSendCodecsShouldWorkForBitrates(const char* min_bitrate_kbps,
395 int expected_min_bitrate_bps, 395 int expected_min_bitrate_bps,
396 const char* start_bitrate_kbps, 396 const char* start_bitrate_kbps,
397 int expected_start_bitrate_bps, 397 int expected_start_bitrate_bps,
398 const char* max_bitrate_kbps, 398 const char* max_bitrate_kbps) {
399 int expected_max_bitrate_bps) {
400 EXPECT_TRUE(SetupSendStream()); 399 EXPECT_TRUE(SetupSendStream());
401 auto& codecs = send_parameters_.codecs; 400 auto& codecs = send_parameters_.codecs;
402 codecs.clear(); 401 codecs.clear();
403 codecs.push_back(kOpusCodec); 402 codecs.push_back(kOpusCodec);
404 codecs[0].params[cricket::kCodecParamMinBitrate] = min_bitrate_kbps; 403 codecs[0].params[cricket::kCodecParamMinBitrate] = min_bitrate_kbps;
405 codecs[0].params[cricket::kCodecParamStartBitrate] = start_bitrate_kbps; 404 codecs[0].params[cricket::kCodecParamStartBitrate] = start_bitrate_kbps;
406 codecs[0].params[cricket::kCodecParamMaxBitrate] = max_bitrate_kbps; 405 codecs[0].params[cricket::kCodecParamMaxBitrate] = max_bitrate_kbps;
407 SetSendParameters(send_parameters_); 406 SetSendParameters(send_parameters_);
408 407
409 EXPECT_EQ(expected_min_bitrate_bps, 408 EXPECT_EQ(expected_min_bitrate_bps,
410 call_.GetConfig().bitrate_config.min_bitrate_bps); 409 call_.GetConfig().bitrate_config.min_bitrate_bps);
411 EXPECT_EQ(expected_start_bitrate_bps, 410 EXPECT_EQ(expected_start_bitrate_bps,
412 call_.GetConfig().bitrate_config.start_bitrate_bps); 411 call_.GetConfig().bitrate_config.start_bitrate_bps);
413 EXPECT_EQ(expected_max_bitrate_bps,
414 call_.GetConfig().bitrate_config.max_bitrate_bps);
415 } 412 }
416 413
417 void TestSetSendRtpHeaderExtensions(const std::string& ext) { 414 void TestSetSendRtpHeaderExtensions(const std::string& ext) {
418 EXPECT_TRUE(SetupSendStream()); 415 EXPECT_TRUE(SetupSendStream());
419 416
420 // Ensure extensions are off by default. 417 // Ensure extensions are off by default.
421 EXPECT_EQ(0u, GetSendStreamConfig(kSsrcX).rtp.extensions.size()); 418 EXPECT_EQ(0u, GetSendStreamConfig(kSsrcX).rtp.extensions.size());
422 419
423 // Ensure unknown extensions won't cause an error. 420 // Ensure unknown extensions won't cause an error.
424 send_parameters_.extensions.push_back( 421 send_parameters_.extensions.push_back(
(...skipping 1054 matching lines...) Expand 10 before | Expand all | Expand 10 after
1479 parameters.codecs[0].params["maxaveragebitrate"] = "510001"; 1476 parameters.codecs[0].params["maxaveragebitrate"] = "510001";
1480 SetSendParameters(parameters); 1477 SetSendParameters(parameters);
1481 EXPECT_EQ(510000, GetCodecBitrate(kSsrcX)); 1478 EXPECT_EQ(510000, GetCodecBitrate(kSsrcX));
1482 1479
1483 parameters.codecs[0].params["maxaveragebitrate"] = "200000"; 1480 parameters.codecs[0].params["maxaveragebitrate"] = "200000";
1484 SetSendParameters(parameters); 1481 SetSendParameters(parameters);
1485 EXPECT_EQ(200000, GetCodecBitrate(kSsrcX)); 1482 EXPECT_EQ(200000, GetCodecBitrate(kSsrcX));
1486 } 1483 }
1487 1484
1488 TEST_F(WebRtcVoiceEngineTestFake, SetSendCodecsWithBitrates) { 1485 TEST_F(WebRtcVoiceEngineTestFake, SetSendCodecsWithBitrates) {
1489 SetSendCodecsShouldWorkForBitrates("100", 100000, "150", 150000, "200", 1486 SetSendCodecsShouldWorkForBitrates("100", 100000, "150", 150000, "200");
1490 200000);
1491 } 1487 }
1492 1488
1493 TEST_F(WebRtcVoiceEngineTestFake, SetSendCodecsWithHighMaxBitrate) { 1489 TEST_F(WebRtcVoiceEngineTestFake, SetSendCodecsWithHighMaxBitrate) {
1494 SetSendCodecsShouldWorkForBitrates("", 0, "", -1, "10000", 10000000); 1490 SetSendCodecsShouldWorkForBitrates("", 0, "", -1, "10000");
1495 } 1491 }
1496 1492
1497 TEST_F(WebRtcVoiceEngineTestFake, 1493 TEST_F(WebRtcVoiceEngineTestFake,
1498 SetSendCodecsWithoutBitratesUsesCorrectDefaults) { 1494 SetSendCodecsWithoutBitratesUsesCorrectDefaults) {
1499 SetSendCodecsShouldWorkForBitrates("", 0, "", -1, "", -1); 1495 SetSendCodecsShouldWorkForBitrates("", 0, "", -1, "");
1500 } 1496 }
1501 1497
1502 TEST_F(WebRtcVoiceEngineTestFake, SetSendCodecsCapsMinAndStartBitrate) { 1498 TEST_F(WebRtcVoiceEngineTestFake, SetSendCodecsCapsMinAndStartBitrate) {
1503 SetSendCodecsShouldWorkForBitrates("-1", 0, "-100", -1, "", -1); 1499 SetSendCodecsShouldWorkForBitrates("-1", 0, "-100", -1, "");
1504 } 1500 }
1505 1501
1506 TEST_F(WebRtcVoiceEngineTestFake, 1502 TEST_F(WebRtcVoiceEngineTestFake,
1507 SetMaxSendBandwidthShouldPreserveOtherBitrates) { 1503 SetMaxSendBandwidthShouldPreserveOtherBitrates) {
1508 SetSendCodecsShouldWorkForBitrates("100", 100000, "150", 150000, "200", 1504 SetSendCodecsShouldWorkForBitrates("100", 100000, "150", 150000, "200");
1509 200000);
1510 send_parameters_.max_bandwidth_bps = 300000; 1505 send_parameters_.max_bandwidth_bps = 300000;
1511 SetSendParameters(send_parameters_); 1506 SetSendParameters(send_parameters_);
1512 EXPECT_EQ(100000, call_.GetConfig().bitrate_config.min_bitrate_bps) 1507 EXPECT_EQ(100000, call_.GetConfig().bitrate_config.min_bitrate_bps)
1513 << "Setting max bitrate should keep previous min bitrate."; 1508 << "Setting max bitrate should keep previous min bitrate.";
1514 EXPECT_EQ(-1, call_.GetConfig().bitrate_config.start_bitrate_bps) 1509 EXPECT_EQ(-1, call_.GetConfig().bitrate_config.start_bitrate_bps)
1515 << "Setting max bitrate should not reset start bitrate."; 1510 << "Setting max bitrate should not reset start bitrate.";
1516 EXPECT_EQ(300000, call_.GetConfig().bitrate_config.max_bitrate_bps); 1511 EXPECT_EQ(300000, call_.GetConfig().bitrate_config.max_bitrate_bps);
1517 } 1512 }
1518 1513
1519 // Test that we can enable NACK with opus as caller. 1514 // Test that we can enable NACK with opus as caller.
(...skipping 2275 matching lines...) Expand 10 before | Expand all | Expand 10 after
3795 // Without this cast, the comparison turned unsigned and, thus, failed for -1. 3790 // Without this cast, the comparison turned unsigned and, thus, failed for -1.
3796 const int num_specs = static_cast<int>(specs.size()); 3791 const int num_specs = static_cast<int>(specs.size());
3797 EXPECT_GE(find_codec({"cn", 8000, 1}), num_specs); 3792 EXPECT_GE(find_codec({"cn", 8000, 1}), num_specs);
3798 EXPECT_GE(find_codec({"cn", 16000, 1}), num_specs); 3793 EXPECT_GE(find_codec({"cn", 16000, 1}), num_specs);
3799 EXPECT_EQ(find_codec({"cn", 32000, 1}), -1); 3794 EXPECT_EQ(find_codec({"cn", 32000, 1}), -1);
3800 EXPECT_GE(find_codec({"telephone-event", 8000, 1}), num_specs); 3795 EXPECT_GE(find_codec({"telephone-event", 8000, 1}), num_specs);
3801 EXPECT_GE(find_codec({"telephone-event", 16000, 1}), num_specs); 3796 EXPECT_GE(find_codec({"telephone-event", 16000, 1}), num_specs);
3802 EXPECT_GE(find_codec({"telephone-event", 32000, 1}), num_specs); 3797 EXPECT_GE(find_codec({"telephone-event", 32000, 1}), num_specs);
3803 EXPECT_GE(find_codec({"telephone-event", 48000, 1}), num_specs); 3798 EXPECT_GE(find_codec({"telephone-event", 48000, 1}), num_specs);
3804 } 3799 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698