OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 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 <memory> | 11 #include <memory> |
12 | 12 |
13 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
14 | 14 |
| 15 #include "webrtc/base/rate_limiter.h" |
15 #include "webrtc/common_types.h" | 16 #include "webrtc/common_types.h" |
16 #include "webrtc/modules/remote_bitrate_estimator/include/bwe_defines.h" | 17 #include "webrtc/modules/remote_bitrate_estimator/include/bwe_defines.h" |
17 #include "webrtc/modules/remote_bitrate_estimator/include/mock/mock_remote_bitra
te_observer.h" | 18 #include "webrtc/modules/remote_bitrate_estimator/include/mock/mock_remote_bitra
te_observer.h" |
18 #include "webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_singl
e_stream.h" | 19 #include "webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_singl
e_stream.h" |
19 #include "webrtc/modules/rtp_rtcp/source/rtcp_receiver.h" | 20 #include "webrtc/modules/rtp_rtcp/source/rtcp_receiver.h" |
20 #include "webrtc/modules/rtp_rtcp/source/rtcp_sender.h" | 21 #include "webrtc/modules/rtp_rtcp/source/rtcp_sender.h" |
21 #include "webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl.h" | 22 #include "webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl.h" |
22 #include "webrtc/modules/rtp_rtcp/source/rtp_utility.h" | 23 #include "webrtc/modules/rtp_rtcp/source/rtp_utility.h" |
23 #include "webrtc/test/null_transport.h" | 24 #include "webrtc/test/null_transport.h" |
24 #include "webrtc/typedefs.h" | 25 #include "webrtc/typedefs.h" |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 : over_use_detector_options_(), | 63 : over_use_detector_options_(), |
63 system_clock_(Clock::GetRealTimeClock()), | 64 system_clock_(Clock::GetRealTimeClock()), |
64 dummy_rtp_rtcp_impl_(nullptr), | 65 dummy_rtp_rtcp_impl_(nullptr), |
65 receive_statistics_(ReceiveStatistics::Create(system_clock_)), | 66 receive_statistics_(ReceiveStatistics::Create(system_clock_)), |
66 rtcp_sender_(nullptr), | 67 rtcp_sender_(nullptr), |
67 rtcp_receiver_(nullptr), | 68 rtcp_receiver_(nullptr), |
68 test_transport_(nullptr), | 69 test_transport_(nullptr), |
69 remote_bitrate_observer_(), | 70 remote_bitrate_observer_(), |
70 remote_bitrate_estimator_( | 71 remote_bitrate_estimator_( |
71 new RemoteBitrateEstimatorSingleStream(&remote_bitrate_observer_, | 72 new RemoteBitrateEstimatorSingleStream(&remote_bitrate_observer_, |
72 system_clock_)) {} | 73 system_clock_)), |
| 74 retransmission_rate_limiter_(Clock::GetRealTimeClock(), 1000) {} |
73 void SetUp() override; | 75 void SetUp() override; |
74 void TearDown() override; | 76 void TearDown() override; |
75 | 77 |
76 OverUseDetectorOptions over_use_detector_options_; | 78 OverUseDetectorOptions over_use_detector_options_; |
77 Clock* system_clock_; | 79 Clock* system_clock_; |
78 ModuleRtpRtcpImpl* dummy_rtp_rtcp_impl_; | 80 ModuleRtpRtcpImpl* dummy_rtp_rtcp_impl_; |
79 std::unique_ptr<ReceiveStatistics> receive_statistics_; | 81 std::unique_ptr<ReceiveStatistics> receive_statistics_; |
80 RTCPSender* rtcp_sender_; | 82 RTCPSender* rtcp_sender_; |
81 RTCPReceiver* rtcp_receiver_; | 83 RTCPReceiver* rtcp_receiver_; |
82 TestTransport* test_transport_; | 84 TestTransport* test_transport_; |
83 test::NullTransport null_transport_; | 85 test::NullTransport null_transport_; |
84 MockRemoteBitrateObserver remote_bitrate_observer_; | 86 MockRemoteBitrateObserver remote_bitrate_observer_; |
85 std::unique_ptr<RemoteBitrateEstimator> remote_bitrate_estimator_; | 87 std::unique_ptr<RemoteBitrateEstimator> remote_bitrate_estimator_; |
| 88 RateLimiter retransmission_rate_limiter_; |
86 }; | 89 }; |
87 | 90 |
88 void RtcpFormatRembTest::SetUp() { | 91 void RtcpFormatRembTest::SetUp() { |
89 RtpRtcp::Configuration configuration; | 92 RtpRtcp::Configuration configuration; |
90 configuration.audio = false; | 93 configuration.audio = false; |
91 configuration.clock = system_clock_; | 94 configuration.clock = system_clock_; |
92 configuration.remote_bitrate_estimator = remote_bitrate_estimator_.get(); | 95 configuration.remote_bitrate_estimator = remote_bitrate_estimator_.get(); |
93 configuration.outgoing_transport = &null_transport_; | 96 configuration.outgoing_transport = &null_transport_; |
| 97 configuration.retransmission_rate_limiter = &retransmission_rate_limiter_; |
94 dummy_rtp_rtcp_impl_ = new ModuleRtpRtcpImpl(configuration); | 98 dummy_rtp_rtcp_impl_ = new ModuleRtpRtcpImpl(configuration); |
95 rtcp_receiver_ = new RTCPReceiver(system_clock_, false, nullptr, nullptr, | 99 rtcp_receiver_ = new RTCPReceiver(system_clock_, false, nullptr, nullptr, |
96 nullptr, nullptr, dummy_rtp_rtcp_impl_); | 100 nullptr, nullptr, dummy_rtp_rtcp_impl_); |
97 test_transport_ = new TestTransport(rtcp_receiver_); | 101 test_transport_ = new TestTransport(rtcp_receiver_); |
98 rtcp_sender_ = new RTCPSender(false, system_clock_, receive_statistics_.get(), | 102 rtcp_sender_ = new RTCPSender(false, system_clock_, receive_statistics_.get(), |
99 nullptr, nullptr, test_transport_); | 103 nullptr, nullptr, test_transport_); |
100 } | 104 } |
101 | 105 |
102 void RtcpFormatRembTest::TearDown() { | 106 void RtcpFormatRembTest::TearDown() { |
103 delete rtcp_sender_; | 107 delete rtcp_sender_; |
(...skipping 22 matching lines...) Expand all Loading... |
126 TEST_F(RtcpFormatRembTest, TestCompund) { | 130 TEST_F(RtcpFormatRembTest, TestCompund) { |
127 uint32_t SSRCs[2] = {456789, 98765}; | 131 uint32_t SSRCs[2] = {456789, 98765}; |
128 rtcp_sender_->SetRTCPStatus(RtcpMode::kCompound); | 132 rtcp_sender_->SetRTCPStatus(RtcpMode::kCompound); |
129 rtcp_sender_->SetREMBData(1234, std::vector<uint32_t>(SSRCs, SSRCs + 2)); | 133 rtcp_sender_->SetREMBData(1234, std::vector<uint32_t>(SSRCs, SSRCs + 2)); |
130 RTCPSender::FeedbackState feedback_state = | 134 RTCPSender::FeedbackState feedback_state = |
131 dummy_rtp_rtcp_impl_->GetFeedbackState(); | 135 dummy_rtp_rtcp_impl_->GetFeedbackState(); |
132 EXPECT_EQ(0, rtcp_sender_->SendRTCP(feedback_state, kRtcpRemb)); | 136 EXPECT_EQ(0, rtcp_sender_->SendRTCP(feedback_state, kRtcpRemb)); |
133 } | 137 } |
134 } // namespace | 138 } // namespace |
135 } // namespace webrtc | 139 } // namespace webrtc |
OLD | NEW |