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

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

Issue 2691343008: Fixed a couple of build-flag dependent tests of webrtcvoiceengine. (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
« no previous file with comments | « webrtc/media/BUILD.gn ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 2550 matching lines...) Expand 10 before | Expand all | Expand 10 after
2561 TEST_F(WebRtcVoiceEngineWithSendSideBweWithOverheadTest, MinAndMaxBitrate) { 2561 TEST_F(WebRtcVoiceEngineWithSendSideBweWithOverheadTest, MinAndMaxBitrate) {
2562 EXPECT_TRUE(SetupSendStream()); 2562 EXPECT_TRUE(SetupSendStream());
2563 cricket::AudioSendParameters parameters; 2563 cricket::AudioSendParameters parameters;
2564 parameters.codecs.push_back(kOpusCodec); 2564 parameters.codecs.push_back(kOpusCodec);
2565 SetSendParameters(parameters); 2565 SetSendParameters(parameters);
2566 const int initial_num = call_.GetNumCreatedSendStreams(); 2566 const int initial_num = call_.GetNumCreatedSendStreams();
2567 EXPECT_EQ(initial_num, call_.GetNumCreatedSendStreams()); 2567 EXPECT_EQ(initial_num, call_.GetNumCreatedSendStreams());
2568 2568
2569 // OverheadPerPacket = Ipv4(20B) + UDP(8B) + SRTP(10B) + RTP(12) 2569 // OverheadPerPacket = Ipv4(20B) + UDP(8B) + SRTP(10B) + RTP(12)
2570 constexpr int kOverheadPerPacket = 20 + 8 + 10 + 12; 2570 constexpr int kOverheadPerPacket = 20 + 8 + 10 + 12;
2571 #if WEBRTC_OPUS_SUPPORT_120MS_PTIME
2572 constexpr int kMinOverheadBps = kOverheadPerPacket * 8 * 1000 / 120;
2573 #else
2571 constexpr int kMinOverheadBps = kOverheadPerPacket * 8 * 1000 / 60; 2574 constexpr int kMinOverheadBps = kOverheadPerPacket * 8 * 1000 / 60;
2575 #endif
kwiberg-webrtc 2017/02/16 12:07:03 Or constexpr int kMinOverheadBps = kOverheadPer
ossu 2017/02/16 12:19:32 Alright, that also matches the implementation. Wil
2572 constexpr int kMaxOverheadBps = kOverheadPerPacket * 8 * 1000 / 10; 2576 constexpr int kMaxOverheadBps = kOverheadPerPacket * 8 * 1000 / 10;
2573 2577
2574 constexpr int kOpusMinBitrateBps = 6000; 2578 constexpr int kOpusMinBitrateBps = 6000;
2575 EXPECT_EQ(kOpusMinBitrateBps + kMinOverheadBps, 2579 EXPECT_EQ(kOpusMinBitrateBps + kMinOverheadBps,
2576 GetSendStreamConfig(kSsrc1).min_bitrate_bps); 2580 GetSendStreamConfig(kSsrc1).min_bitrate_bps);
2577 constexpr int kOpusBitrateFbBps = 32000; 2581 constexpr int kOpusBitrateFbBps = 32000;
2578 EXPECT_EQ(kOpusBitrateFbBps + kMaxOverheadBps, 2582 EXPECT_EQ(kOpusBitrateFbBps + kMaxOverheadBps,
2579 GetSendStreamConfig(kSsrc1).max_bitrate_bps); 2583 GetSendStreamConfig(kSsrc1).max_bitrate_bps);
2580 2584
2581 parameters.options.audio_network_adaptor = rtc::Optional<bool>(true); 2585 parameters.options.audio_network_adaptor = rtc::Optional<bool>(true);
2582 parameters.options.audio_network_adaptor_config = 2586 parameters.options.audio_network_adaptor_config =
2583 rtc::Optional<std::string>("1234"); 2587 rtc::Optional<std::string>("1234");
2584 SetSendParameters(parameters); 2588 SetSendParameters(parameters);
2585 2589
2590 #if WEBRTC_OPUS_SUPPORT_120MS_PTIME
2591 constexpr int kMinOverheadWithAnaBps = kOverheadPerPacket * 8 * 1000 / 120;
2592 #else
2586 constexpr int kMinOverheadWithAnaBps = kOverheadPerPacket * 8 * 1000 / 60; 2593 constexpr int kMinOverheadWithAnaBps = kOverheadPerPacket * 8 * 1000 / 60;
2594 #endif
2587 constexpr int kMaxOverheadWithAnaBps = kOverheadPerPacket * 8 * 1000 / 20; 2595 constexpr int kMaxOverheadWithAnaBps = kOverheadPerPacket * 8 * 1000 / 20;
2588 2596
2589 EXPECT_EQ(kOpusMinBitrateBps + kMinOverheadWithAnaBps, 2597 EXPECT_EQ(kOpusMinBitrateBps + kMinOverheadWithAnaBps,
2590 GetSendStreamConfig(kSsrc1).min_bitrate_bps); 2598 GetSendStreamConfig(kSsrc1).min_bitrate_bps);
2591 2599
2592 EXPECT_EQ(kOpusBitrateFbBps + kMaxOverheadWithAnaBps, 2600 EXPECT_EQ(kOpusBitrateFbBps + kMaxOverheadWithAnaBps,
2593 GetSendStreamConfig(kSsrc1).max_bitrate_bps); 2601 GetSendStreamConfig(kSsrc1).max_bitrate_bps);
2594 } 2602 }
2595 2603
2596 // Test that we can set the outgoing SSRC properly. 2604 // Test that we can set the outgoing SSRC properly.
(...skipping 947 matching lines...) Expand 10 before | Expand all | Expand 10 after
3544 delete channel; 3552 delete channel;
3545 } 3553 }
3546 } 3554 }
3547 3555
3548 // Tests that the library is configured with the codecs we want. 3556 // Tests that the library is configured with the codecs we want.
3549 TEST(WebRtcVoiceEngineTest, HasCorrectCodecs) { 3557 TEST(WebRtcVoiceEngineTest, HasCorrectCodecs) {
3550 // TODO(ossu): These tests should move into a future "builtin audio codecs" 3558 // TODO(ossu): These tests should move into a future "builtin audio codecs"
3551 // module. 3559 // module.
3552 3560
3553 // Check codecs by name. 3561 // Check codecs by name.
3562 #ifdef WEBRTC_CODEC_OPUS
3554 EXPECT_TRUE(cricket::WebRtcVoiceEngine::ToCodecInst( 3563 EXPECT_TRUE(cricket::WebRtcVoiceEngine::ToCodecInst(
3555 cricket::AudioCodec(96, "OPUS", 48000, 0, 2), nullptr)); 3564 cricket::AudioCodec(96, "OPUS", 48000, 0, 2), nullptr));
3565 #endif
3566 #if (defined(WEBRTC_CODEC_ISAC) || defined(WEBRTC_CODEC_ISACFX))
3556 EXPECT_TRUE(cricket::WebRtcVoiceEngine::ToCodecInst( 3567 EXPECT_TRUE(cricket::WebRtcVoiceEngine::ToCodecInst(
3557 cricket::AudioCodec(96, "ISAC", 16000, 0, 1), nullptr)); 3568 cricket::AudioCodec(96, "ISAC", 16000, 0, 1), nullptr));
3569 #endif
3570 #if (defined(WEBRTC_CODEC_ISAC))
3558 EXPECT_TRUE(cricket::WebRtcVoiceEngine::ToCodecInst( 3571 EXPECT_TRUE(cricket::WebRtcVoiceEngine::ToCodecInst(
3559 cricket::AudioCodec(96, "ISAC", 32000, 0, 1), nullptr)); 3572 cricket::AudioCodec(96, "ISAC", 32000, 0, 1), nullptr));
3573 #endif
3574 #ifdef WEBRTC_CODEC_ILBC
3560 // Check that name matching is case-insensitive. 3575 // Check that name matching is case-insensitive.
3561 EXPECT_TRUE(cricket::WebRtcVoiceEngine::ToCodecInst( 3576 EXPECT_TRUE(cricket::WebRtcVoiceEngine::ToCodecInst(
3562 cricket::AudioCodec(96, "ILBC", 8000, 0, 1), nullptr)); 3577 cricket::AudioCodec(96, "ILBC", 8000, 0, 1), nullptr));
3563 EXPECT_TRUE(cricket::WebRtcVoiceEngine::ToCodecInst( 3578 EXPECT_TRUE(cricket::WebRtcVoiceEngine::ToCodecInst(
3564 cricket::AudioCodec(96, "iLBC", 8000, 0, 1), nullptr)); 3579 cricket::AudioCodec(96, "iLBC", 8000, 0, 1), nullptr));
3580 #endif
3565 EXPECT_TRUE(cricket::WebRtcVoiceEngine::ToCodecInst( 3581 EXPECT_TRUE(cricket::WebRtcVoiceEngine::ToCodecInst(
3566 cricket::AudioCodec(96, "CN", 32000, 0, 1), nullptr)); 3582 cricket::AudioCodec(96, "CN", 32000, 0, 1), nullptr));
3567 EXPECT_TRUE(cricket::WebRtcVoiceEngine::ToCodecInst( 3583 EXPECT_TRUE(cricket::WebRtcVoiceEngine::ToCodecInst(
3568 cricket::AudioCodec(96, "CN", 16000, 0, 1), nullptr)); 3584 cricket::AudioCodec(96, "CN", 16000, 0, 1), nullptr));
3569 EXPECT_TRUE(cricket::WebRtcVoiceEngine::ToCodecInst( 3585 EXPECT_TRUE(cricket::WebRtcVoiceEngine::ToCodecInst(
3570 cricket::AudioCodec(96, "telephone-event", 8000, 0, 1), nullptr)); 3586 cricket::AudioCodec(96, "telephone-event", 8000, 0, 1), nullptr));
3571 EXPECT_TRUE(cricket::WebRtcVoiceEngine::ToCodecInst( 3587 EXPECT_TRUE(cricket::WebRtcVoiceEngine::ToCodecInst(
3572 cricket::AudioCodec(96, "telephone-event", 16000, 0, 1), nullptr)); 3588 cricket::AudioCodec(96, "telephone-event", 16000, 0, 1), nullptr));
3573 EXPECT_TRUE(cricket::WebRtcVoiceEngine::ToCodecInst( 3589 EXPECT_TRUE(cricket::WebRtcVoiceEngine::ToCodecInst(
3574 cricket::AudioCodec(96, "telephone-event", 32000, 0, 1), nullptr)); 3590 cricket::AudioCodec(96, "telephone-event", 32000, 0, 1), nullptr));
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
3744 // Without this cast, the comparison turned unsigned and, thus, failed for -1. 3760 // Without this cast, the comparison turned unsigned and, thus, failed for -1.
3745 const int num_specs = static_cast<int>(specs.size()); 3761 const int num_specs = static_cast<int>(specs.size());
3746 EXPECT_GE(find_codec({"cn", 8000, 1}), num_specs); 3762 EXPECT_GE(find_codec({"cn", 8000, 1}), num_specs);
3747 EXPECT_GE(find_codec({"cn", 16000, 1}), num_specs); 3763 EXPECT_GE(find_codec({"cn", 16000, 1}), num_specs);
3748 EXPECT_EQ(find_codec({"cn", 32000, 1}), -1); 3764 EXPECT_EQ(find_codec({"cn", 32000, 1}), -1);
3749 EXPECT_GE(find_codec({"telephone-event", 8000, 1}), num_specs); 3765 EXPECT_GE(find_codec({"telephone-event", 8000, 1}), num_specs);
3750 EXPECT_GE(find_codec({"telephone-event", 16000, 1}), num_specs); 3766 EXPECT_GE(find_codec({"telephone-event", 16000, 1}), num_specs);
3751 EXPECT_GE(find_codec({"telephone-event", 32000, 1}), num_specs); 3767 EXPECT_GE(find_codec({"telephone-event", 32000, 1}), num_specs);
3752 EXPECT_GE(find_codec({"telephone-event", 48000, 1}), num_specs); 3768 EXPECT_GE(find_codec({"telephone-event", 48000, 1}), num_specs);
3753 } 3769 }
OLDNEW
« no previous file with comments | « webrtc/media/BUILD.gn ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698