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

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

Issue 2532433002: Add overhead to audio bwe min, max. (Closed)
Patch Set: Response to comments. Created 3 years, 11 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/engine/webrtcvoiceengine.cc ('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 2530 matching lines...) Expand 10 before | Expand all | Expand 10 after
2541 options.audio_network_adaptor = rtc::Optional<bool>(); 2541 options.audio_network_adaptor = rtc::Optional<bool>();
2542 // Unvalued |options.audio_network_adaptor|.should not reset audio network 2542 // Unvalued |options.audio_network_adaptor|.should not reset audio network
2543 // adaptor. 2543 // adaptor.
2544 SetAudioSend(kSsrc1, true, nullptr, &options); 2544 SetAudioSend(kSsrc1, true, nullptr, &options);
2545 // AudioSendStream not expected to be recreated. 2545 // AudioSendStream not expected to be recreated.
2546 EXPECT_EQ(initial_num, call_.GetNumCreatedSendStreams()); 2546 EXPECT_EQ(initial_num, call_.GetNumCreatedSendStreams());
2547 EXPECT_EQ(send_parameters_.options.audio_network_adaptor_config, 2547 EXPECT_EQ(send_parameters_.options.audio_network_adaptor_config,
2548 GetAudioNetworkAdaptorConfig(kSsrc1)); 2548 GetAudioNetworkAdaptorConfig(kSsrc1));
2549 } 2549 }
2550 2550
2551 class WebRtcVoiceEngineWithSendSideBweWithOverheadTest
2552 : public WebRtcVoiceEngineTestFake {
2553 public:
2554 WebRtcVoiceEngineWithSendSideBweWithOverheadTest()
2555 : WebRtcVoiceEngineTestFake(
2556 "WebRTC-Audio-SendSideBwe/Enabled/WebRTC-SendSideBwe-WithOverhead/"
2557 "Enabled/") {}
2558 };
2559
2560 TEST_F(WebRtcVoiceEngineWithSendSideBweWithOverheadTest, MinAndMaxBitrate) {
2561 EXPECT_TRUE(SetupSendStream());
2562 cricket::AudioSendParameters parameters;
2563 parameters.codecs.push_back(kOpusCodec);
2564 SetSendParameters(parameters);
2565 const int initial_num = call_.GetNumCreatedSendStreams();
2566 EXPECT_EQ(initial_num, call_.GetNumCreatedSendStreams());
2567
2568 // OverheadPerPacket = Ipv4(20B) + UDP(8B) + SRTP(10B) + RTP(12)
2569 constexpr int kOverheadPerPacket = 20 + 8 + 10 + 12;
2570 constexpr int kMinOverheadBps = kOverheadPerPacket * 8 * 1000 / 60;
2571 constexpr int kMaxOverheadBps = kOverheadPerPacket * 8 * 1000 / 10;
2572
2573 constexpr int kOpusMinBitrateBps = 6000;
2574 EXPECT_EQ(kOpusMinBitrateBps + kMinOverheadBps,
2575 GetSendStreamConfig(kSsrc1).min_bitrate_bps);
2576 constexpr int kOpusBitrateFbBps = 32000;
2577 EXPECT_EQ(kOpusBitrateFbBps + kMaxOverheadBps,
2578 GetSendStreamConfig(kSsrc1).max_bitrate_bps);
2579
2580 parameters.options.audio_network_adaptor = rtc::Optional<bool>(true);
2581 parameters.options.audio_network_adaptor_config =
2582 rtc::Optional<std::string>("1234");
2583 SetSendParameters(parameters);
2584
2585 constexpr int kMinOverheadWithAnaBps = kOverheadPerPacket * 8 * 1000 / 60;
2586 constexpr int kMaxOverheadWithAnaBps = kOverheadPerPacket * 8 * 1000 / 20;
2587
2588 EXPECT_EQ(kOpusMinBitrateBps + kMinOverheadWithAnaBps,
2589 GetSendStreamConfig(kSsrc1).min_bitrate_bps);
2590
2591 EXPECT_EQ(kOpusBitrateFbBps + kMaxOverheadWithAnaBps,
2592 GetSendStreamConfig(kSsrc1).max_bitrate_bps);
2593 }
2594
2551 // Test that we can set the outgoing SSRC properly. 2595 // Test that we can set the outgoing SSRC properly.
2552 // SSRC is set in SetupSendStream() by calling AddSendStream. 2596 // SSRC is set in SetupSendStream() by calling AddSendStream.
2553 TEST_F(WebRtcVoiceEngineTestFake, SetSendSsrc) { 2597 TEST_F(WebRtcVoiceEngineTestFake, SetSendSsrc) {
2554 EXPECT_TRUE(SetupSendStream()); 2598 EXPECT_TRUE(SetupSendStream());
2555 EXPECT_TRUE(call_.GetAudioSendStream(kSsrc1)); 2599 EXPECT_TRUE(call_.GetAudioSendStream(kSsrc1));
2556 } 2600 }
2557 2601
2558 TEST_F(WebRtcVoiceEngineTestFake, GetStats) { 2602 TEST_F(WebRtcVoiceEngineTestFake, GetStats) {
2559 // Setup. We need send codec to be set to get all stats. 2603 // Setup. We need send codec to be set to get all stats.
2560 EXPECT_TRUE(SetupSendStream()); 2604 EXPECT_TRUE(SetupSendStream());
(...skipping 1068 matching lines...) Expand 10 before | Expand all | Expand 10 after
3629 nullptr, webrtc::CreateBuiltinAudioDecoderFactory(), nullptr); 3673 nullptr, webrtc::CreateBuiltinAudioDecoderFactory(), nullptr);
3630 webrtc::RtcEventLogNullImpl event_log; 3674 webrtc::RtcEventLogNullImpl event_log;
3631 std::unique_ptr<webrtc::Call> call( 3675 std::unique_ptr<webrtc::Call> call(
3632 webrtc::Call::Create(webrtc::Call::Config(&event_log))); 3676 webrtc::Call::Create(webrtc::Call::Config(&event_log)));
3633 cricket::WebRtcVoiceMediaChannel channel(&engine, cricket::MediaConfig(), 3677 cricket::WebRtcVoiceMediaChannel channel(&engine, cricket::MediaConfig(),
3634 cricket::AudioOptions(), call.get()); 3678 cricket::AudioOptions(), call.get());
3635 cricket::AudioRecvParameters parameters; 3679 cricket::AudioRecvParameters parameters;
3636 parameters.codecs = engine.recv_codecs(); 3680 parameters.codecs = engine.recv_codecs();
3637 EXPECT_TRUE(channel.SetRecvParameters(parameters)); 3681 EXPECT_TRUE(channel.SetRecvParameters(parameters));
3638 } 3682 }
OLDNEW
« no previous file with comments | « webrtc/media/engine/webrtcvoiceengine.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698