| OLD | NEW |
| 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 2453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2464 options.audio_network_adaptor = rtc::Optional<bool>(); | 2464 options.audio_network_adaptor = rtc::Optional<bool>(); |
| 2465 // Unvalued |options.audio_network_adaptor|.should not reset audio network | 2465 // Unvalued |options.audio_network_adaptor|.should not reset audio network |
| 2466 // adaptor. | 2466 // adaptor. |
| 2467 SetAudioSend(kSsrc1, true, nullptr, &options); | 2467 SetAudioSend(kSsrc1, true, nullptr, &options); |
| 2468 // AudioSendStream not expected to be recreated. | 2468 // AudioSendStream not expected to be recreated. |
| 2469 EXPECT_EQ(initial_num, call_.GetNumCreatedSendStreams()); | 2469 EXPECT_EQ(initial_num, call_.GetNumCreatedSendStreams()); |
| 2470 EXPECT_EQ(send_parameters_.options.audio_network_adaptor_config, | 2470 EXPECT_EQ(send_parameters_.options.audio_network_adaptor_config, |
| 2471 GetAudioNetworkAdaptorConfig(kSsrc1)); | 2471 GetAudioNetworkAdaptorConfig(kSsrc1)); |
| 2472 } | 2472 } |
| 2473 | 2473 |
| 2474 class WebRtcVoiceEngineWithSendSideBweWithOverheadTest |
| 2475 : public WebRtcVoiceEngineTestFake { |
| 2476 public: |
| 2477 WebRtcVoiceEngineWithSendSideBweWithOverheadTest() |
| 2478 : WebRtcVoiceEngineTestFake( |
| 2479 "WebRTC-Audio-SendSideBwe/Enabled/WebRTC-SendSideBwe-WithOverhead/" |
| 2480 "Enabled/") {} |
| 2481 }; |
| 2482 |
| 2483 TEST_F(WebRtcVoiceEngineWithSendSideBweWithOverheadTest, MinAndMaxBitrate) { |
| 2484 EXPECT_TRUE(SetupSendStream()); |
| 2485 cricket::AudioSendParameters parameters; |
| 2486 parameters.codecs.push_back(kOpusCodec); |
| 2487 SetSendParameters(parameters); |
| 2488 const int initial_num = call_.GetNumCreatedSendStreams(); |
| 2489 EXPECT_EQ(initial_num, call_.GetNumCreatedSendStreams()); |
| 2490 |
| 2491 // OverheadPerPacket = Ipv4(20B) + UDP(8B) + SRTP(10B) + RTP(12) |
| 2492 constexpr int kOverheadPerPacket = 20 + 8 + 10 + 12; |
| 2493 constexpr int kMinOverheadBps = kOverheadPerPacket * 8 * 1000 / 60; |
| 2494 constexpr int kMaxOverheadBps = kOverheadPerPacket * 8 * 1000 / 20; |
| 2495 |
| 2496 constexpr int kOpusMinBitrateBps = 6000; |
| 2497 EXPECT_EQ(kOpusMinBitrateBps + kMinOverheadBps, |
| 2498 GetSendStreamConfig(kSsrc1).min_bitrate_bps); |
| 2499 constexpr int kOpusBitrateFbBps = 32000; |
| 2500 EXPECT_EQ(kOpusBitrateFbBps + kMaxOverheadBps, |
| 2501 GetSendStreamConfig(kSsrc1).max_bitrate_bps); |
| 2502 } |
| 2503 |
| 2474 // Test that we can set the outgoing SSRC properly. | 2504 // Test that we can set the outgoing SSRC properly. |
| 2475 // SSRC is set in SetupSendStream() by calling AddSendStream. | 2505 // SSRC is set in SetupSendStream() by calling AddSendStream. |
| 2476 TEST_F(WebRtcVoiceEngineTestFake, SetSendSsrc) { | 2506 TEST_F(WebRtcVoiceEngineTestFake, SetSendSsrc) { |
| 2477 EXPECT_TRUE(SetupSendStream()); | 2507 EXPECT_TRUE(SetupSendStream()); |
| 2478 EXPECT_TRUE(call_.GetAudioSendStream(kSsrc1)); | 2508 EXPECT_TRUE(call_.GetAudioSendStream(kSsrc1)); |
| 2479 } | 2509 } |
| 2480 | 2510 |
| 2481 TEST_F(WebRtcVoiceEngineTestFake, GetStats) { | 2511 TEST_F(WebRtcVoiceEngineTestFake, GetStats) { |
| 2482 // Setup. We need send codec to be set to get all stats. | 2512 // Setup. We need send codec to be set to get all stats. |
| 2483 EXPECT_TRUE(SetupSendStream()); | 2513 EXPECT_TRUE(SetupSendStream()); |
| (...skipping 1068 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3552 nullptr, webrtc::CreateBuiltinAudioDecoderFactory()); | 3582 nullptr, webrtc::CreateBuiltinAudioDecoderFactory()); |
| 3553 webrtc::RtcEventLogNullImpl event_log; | 3583 webrtc::RtcEventLogNullImpl event_log; |
| 3554 std::unique_ptr<webrtc::Call> call( | 3584 std::unique_ptr<webrtc::Call> call( |
| 3555 webrtc::Call::Create(webrtc::Call::Config(&event_log))); | 3585 webrtc::Call::Create(webrtc::Call::Config(&event_log))); |
| 3556 cricket::WebRtcVoiceMediaChannel channel(&engine, cricket::MediaConfig(), | 3586 cricket::WebRtcVoiceMediaChannel channel(&engine, cricket::MediaConfig(), |
| 3557 cricket::AudioOptions(), call.get()); | 3587 cricket::AudioOptions(), call.get()); |
| 3558 cricket::AudioRecvParameters parameters; | 3588 cricket::AudioRecvParameters parameters; |
| 3559 parameters.codecs = engine.recv_codecs(); | 3589 parameters.codecs = engine.recv_codecs(); |
| 3560 EXPECT_TRUE(channel.SetRecvParameters(parameters)); | 3590 EXPECT_TRUE(channel.SetRecvParameters(parameters)); |
| 3561 } | 3591 } |
| OLD | NEW |