| 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 / 10; |
| 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 parameters.options.audio_network_adaptor = rtc::Optional<bool>(true); |
| 2504 parameters.options.audio_network_adaptor_config = |
| 2505 rtc::Optional<std::string>("1234"); |
| 2506 SetSendParameters(parameters); |
| 2507 |
| 2508 constexpr int kMinOverheadWithAnaBps = kOverheadPerPacket * 8 * 1000 / 60; |
| 2509 constexpr int kMaxOverheadWithAnaBps = kOverheadPerPacket * 8 * 1000 / 20; |
| 2510 |
| 2511 EXPECT_EQ(kOpusMinBitrateBps + kMinOverheadWithAnaBps, |
| 2512 GetSendStreamConfig(kSsrc1).min_bitrate_bps); |
| 2513 |
| 2514 EXPECT_EQ(kOpusBitrateFbBps + kMaxOverheadWithAnaBps, |
| 2515 GetSendStreamConfig(kSsrc1).max_bitrate_bps); |
| 2516 } |
| 2517 |
| 2474 // Test that we can set the outgoing SSRC properly. | 2518 // Test that we can set the outgoing SSRC properly. |
| 2475 // SSRC is set in SetupSendStream() by calling AddSendStream. | 2519 // SSRC is set in SetupSendStream() by calling AddSendStream. |
| 2476 TEST_F(WebRtcVoiceEngineTestFake, SetSendSsrc) { | 2520 TEST_F(WebRtcVoiceEngineTestFake, SetSendSsrc) { |
| 2477 EXPECT_TRUE(SetupSendStream()); | 2521 EXPECT_TRUE(SetupSendStream()); |
| 2478 EXPECT_TRUE(call_.GetAudioSendStream(kSsrc1)); | 2522 EXPECT_TRUE(call_.GetAudioSendStream(kSsrc1)); |
| 2479 } | 2523 } |
| 2480 | 2524 |
| 2481 TEST_F(WebRtcVoiceEngineTestFake, GetStats) { | 2525 TEST_F(WebRtcVoiceEngineTestFake, GetStats) { |
| 2482 // Setup. We need send codec to be set to get all stats. | 2526 // Setup. We need send codec to be set to get all stats. |
| 2483 EXPECT_TRUE(SetupSendStream()); | 2527 EXPECT_TRUE(SetupSendStream()); |
| (...skipping 1068 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3552 nullptr, webrtc::CreateBuiltinAudioDecoderFactory()); | 3596 nullptr, webrtc::CreateBuiltinAudioDecoderFactory()); |
| 3553 webrtc::RtcEventLogNullImpl event_log; | 3597 webrtc::RtcEventLogNullImpl event_log; |
| 3554 std::unique_ptr<webrtc::Call> call( | 3598 std::unique_ptr<webrtc::Call> call( |
| 3555 webrtc::Call::Create(webrtc::Call::Config(&event_log))); | 3599 webrtc::Call::Create(webrtc::Call::Config(&event_log))); |
| 3556 cricket::WebRtcVoiceMediaChannel channel(&engine, cricket::MediaConfig(), | 3600 cricket::WebRtcVoiceMediaChannel channel(&engine, cricket::MediaConfig(), |
| 3557 cricket::AudioOptions(), call.get()); | 3601 cricket::AudioOptions(), call.get()); |
| 3558 cricket::AudioRecvParameters parameters; | 3602 cricket::AudioRecvParameters parameters; |
| 3559 parameters.codecs = engine.recv_codecs(); | 3603 parameters.codecs = engine.recv_codecs(); |
| 3560 EXPECT_TRUE(channel.SetRecvParameters(parameters)); | 3604 EXPECT_TRUE(channel.SetRecvParameters(parameters)); |
| 3561 } | 3605 } |
| OLD | NEW |