OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2015 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 |
11 #include <list> | 11 #include <list> |
12 #include <map> | 12 #include <map> |
13 #include <memory> | 13 #include <memory> |
14 #include <utility> | 14 #include <utility> |
15 | 15 |
16 #include "webrtc/api/test/mock_audio_mixer.h" | 16 #include "webrtc/api/test/mock_audio_mixer.h" |
17 #include "webrtc/call/audio_state.h" | 17 #include "webrtc/call/audio_state.h" |
18 #include "webrtc/call/call.h" | 18 #include "webrtc/call/call.h" |
19 #include "webrtc/call/fake_rtp_transport_controller_send.h" | 19 #include "webrtc/call/fake_rtp_transport_controller_send.h" |
20 #include "webrtc/logging/rtc_event_log/rtc_event_log.h" | 20 #include "webrtc/logging/rtc_event_log/rtc_event_log.h" |
21 #include "webrtc/modules/audio_device/include/mock_audio_device.h" | 21 #include "webrtc/modules/audio_device/include/mock_audio_device.h" |
22 #include "webrtc/modules/audio_mixer/audio_mixer_impl.h" | 22 #include "webrtc/modules/audio_mixer/audio_mixer_impl.h" |
23 #include "webrtc/modules/congestion_controller/include/mock/mock_send_side_conge
stion_controller.h" | 23 #include "webrtc/modules/congestion_controller/include/mock/mock_send_side_conge
stion_controller.h" |
| 24 #include "webrtc/modules/pacing/mock/mock_paced_sender.h" |
24 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp.h" | 25 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp.h" |
25 #include "webrtc/rtc_base/ptr_util.h" | 26 #include "webrtc/rtc_base/ptr_util.h" |
26 #include "webrtc/test/fake_encoder.h" | 27 #include "webrtc/test/fake_encoder.h" |
27 #include "webrtc/test/gtest.h" | 28 #include "webrtc/test/gtest.h" |
28 #include "webrtc/test/mock_audio_decoder_factory.h" | 29 #include "webrtc/test/mock_audio_decoder_factory.h" |
29 #include "webrtc/test/mock_transport.h" | 30 #include "webrtc/test/mock_transport.h" |
30 #include "webrtc/test/mock_voice_engine.h" | 31 #include "webrtc/test/mock_voice_engine.h" |
31 | 32 |
32 namespace { | 33 namespace { |
33 | 34 |
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
317 for (auto s : streams) { | 318 for (auto s : streams) { |
318 call->DestroyFlexfecReceiveStream(s); | 319 call->DestroyFlexfecReceiveStream(s); |
319 } | 320 } |
320 } | 321 } |
321 | 322 |
322 namespace { | 323 namespace { |
323 struct CallBitrateHelper { | 324 struct CallBitrateHelper { |
324 CallBitrateHelper() : CallBitrateHelper(Call::Config::BitrateConfig()) {} | 325 CallBitrateHelper() : CallBitrateHelper(Call::Config::BitrateConfig()) {} |
325 | 326 |
326 explicit CallBitrateHelper(const Call::Config::BitrateConfig& bitrate_config) | 327 explicit CallBitrateHelper(const Call::Config::BitrateConfig& bitrate_config) |
327 : mock_cc_(Clock::GetRealTimeClock(), &event_log_, &packet_router_) { | 328 : mock_cc_(Clock::GetRealTimeClock(), &event_log_, &pacer_) { |
328 Call::Config config(&event_log_); | 329 Call::Config config(&event_log_); |
329 config.bitrate_config = bitrate_config; | 330 config.bitrate_config = bitrate_config; |
330 call_.reset( | 331 call_.reset( |
331 Call::Create(config, rtc::MakeUnique<FakeRtpTransportControllerSend>( | 332 Call::Create(config, rtc::MakeUnique<FakeRtpTransportControllerSend>( |
332 &packet_router_, &mock_cc_))); | 333 &packet_router_, &pacer_, &mock_cc_))); |
333 } | 334 } |
334 | 335 |
335 webrtc::Call* operator->() { return call_.get(); } | 336 webrtc::Call* operator->() { return call_.get(); } |
336 testing::NiceMock<test::MockSendSideCongestionController>& mock_cc() { | 337 testing::NiceMock<test::MockSendSideCongestionController>& mock_cc() { |
337 return mock_cc_; | 338 return mock_cc_; |
338 } | 339 } |
339 | 340 |
340 private: | 341 private: |
341 webrtc::RtcEventLogNullImpl event_log_; | 342 webrtc::RtcEventLogNullImpl event_log_; |
342 PacketRouter packet_router_; | 343 PacketRouter packet_router_; |
| 344 testing::NiceMock<MockPacedSender> pacer_; |
343 testing::NiceMock<test::MockSendSideCongestionController> mock_cc_; | 345 testing::NiceMock<test::MockSendSideCongestionController> mock_cc_; |
344 std::unique_ptr<Call> call_; | 346 std::unique_ptr<Call> call_; |
345 }; | 347 }; |
346 } // namespace | 348 } // namespace |
347 | 349 |
348 TEST(CallBitrateTest, SetBitrateConfigWithValidConfigCallsSetBweBitrates) { | 350 TEST(CallBitrateTest, SetBitrateConfigWithValidConfigCallsSetBweBitrates) { |
349 CallBitrateHelper call; | 351 CallBitrateHelper call; |
350 | 352 |
351 Call::Config::BitrateConfig bitrate_config; | 353 Call::Config::BitrateConfig bitrate_config; |
352 bitrate_config.min_bitrate_bps = 1; | 354 bitrate_config.min_bitrate_bps = 1; |
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
707 mask.min_bitrate_bps = rtc::Optional<int>(2000); | 709 mask.min_bitrate_bps = rtc::Optional<int>(2000); |
708 EXPECT_CALL(call.mock_cc(), SetBweBitrates(1000, -1, 1000)); | 710 EXPECT_CALL(call.mock_cc(), SetBweBitrates(1000, -1, 1000)); |
709 call->SetBitrateConfigMask(mask); | 711 call->SetBitrateConfigMask(mask); |
710 | 712 |
711 // Set min to 3000; the clamped value stays the same so nothing happens. | 713 // Set min to 3000; the clamped value stays the same so nothing happens. |
712 mask.min_bitrate_bps = rtc::Optional<int>(3000); | 714 mask.min_bitrate_bps = rtc::Optional<int>(3000); |
713 call->SetBitrateConfigMask(mask); | 715 call->SetBitrateConfigMask(mask); |
714 } | 716 } |
715 | 717 |
716 } // namespace webrtc | 718 } // namespace webrtc |
OLD | NEW |