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

Side by Side Diff: webrtc/modules/rtp_rtcp/source/rtcp_sender_unittest.cc

Issue 2181383002: Add NACK rate throttling for audio channels. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Rebase Created 4 years, 4 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
OLDNEW
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/gmock/include/gmock/gmock.h" 13 #include "testing/gmock/include/gmock/gmock.h"
14 #include "testing/gtest/include/gtest/gtest.h" 14 #include "testing/gtest/include/gtest/gtest.h"
15 15
16 #include "webrtc/base/rate_limiter.h"
16 #include "webrtc/common_types.h" 17 #include "webrtc/common_types.h"
17 #include "webrtc/modules/rtp_rtcp/source/rtcp_sender.h" 18 #include "webrtc/modules/rtp_rtcp/source/rtcp_sender.h"
18 #include "webrtc/modules/rtp_rtcp/source/rtcp_utility.h" 19 #include "webrtc/modules/rtp_rtcp/source/rtcp_utility.h"
19 #include "webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl.h" 20 #include "webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl.h"
20 #include "webrtc/test/mock_transport.h" 21 #include "webrtc/test/mock_transport.h"
21 #include "webrtc/test/rtcp_packet_parser.h" 22 #include "webrtc/test/rtcp_packet_parser.h"
22 23
23 using ::testing::_; 24 using ::testing::_;
24 using ::testing::ElementsAre; 25 using ::testing::ElementsAre;
25 using ::testing::Invoke; 26 using ::testing::Invoke;
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 static const uint32_t kSenderSsrc = 0x11111111; 223 static const uint32_t kSenderSsrc = 0x11111111;
223 static const uint32_t kRemoteSsrc = 0x22222222; 224 static const uint32_t kRemoteSsrc = 0x22222222;
224 static const uint32_t kStartRtpTimestamp = 0x34567; 225 static const uint32_t kStartRtpTimestamp = 0x34567;
225 static const uint32_t kRtpTimestamp = 0x45678; 226 static const uint32_t kRtpTimestamp = 0x45678;
226 } 227 }
227 228
228 class RtcpSenderTest : public ::testing::Test { 229 class RtcpSenderTest : public ::testing::Test {
229 protected: 230 protected:
230 RtcpSenderTest() 231 RtcpSenderTest()
231 : clock_(1335900000), 232 : clock_(1335900000),
232 receive_statistics_(ReceiveStatistics::Create(&clock_)) { 233 receive_statistics_(ReceiveStatistics::Create(&clock_)),
234 retransmission_rate_limiter_(&clock_, 1000) {
233 RtpRtcp::Configuration configuration; 235 RtpRtcp::Configuration configuration;
234 configuration.audio = false; 236 configuration.audio = false;
235 configuration.clock = &clock_; 237 configuration.clock = &clock_;
236 configuration.outgoing_transport = &test_transport_; 238 configuration.outgoing_transport = &test_transport_;
239 configuration.retransmission_rate_limiter = &retransmission_rate_limiter_;
237 240
238 rtp_rtcp_impl_.reset(new ModuleRtpRtcpImpl(configuration)); 241 rtp_rtcp_impl_.reset(new ModuleRtpRtcpImpl(configuration));
239 rtcp_sender_.reset(new RTCPSender(false, &clock_, receive_statistics_.get(), 242 rtcp_sender_.reset(new RTCPSender(false, &clock_, receive_statistics_.get(),
240 nullptr, nullptr, &test_transport_)); 243 nullptr, nullptr, &test_transport_));
241 rtcp_sender_->SetSSRC(kSenderSsrc); 244 rtcp_sender_->SetSSRC(kSenderSsrc);
242 rtcp_sender_->SetRemoteSSRC(kRemoteSsrc); 245 rtcp_sender_->SetRemoteSSRC(kRemoteSsrc);
243 rtcp_sender_->SetStartTimestamp(kStartRtpTimestamp); 246 rtcp_sender_->SetStartTimestamp(kStartRtpTimestamp);
244 rtcp_sender_->SetLastRtpTime(kRtpTimestamp, clock_.TimeInMilliseconds()); 247 rtcp_sender_->SetLastRtpTime(kRtpTimestamp, clock_.TimeInMilliseconds());
245 } 248 }
246 249
(...skipping 11 matching lines...) Expand all
258 261
259 RTCPSender::FeedbackState feedback_state() { 262 RTCPSender::FeedbackState feedback_state() {
260 return rtp_rtcp_impl_->GetFeedbackState(); 263 return rtp_rtcp_impl_->GetFeedbackState();
261 } 264 }
262 265
263 SimulatedClock clock_; 266 SimulatedClock clock_;
264 TestTransport test_transport_; 267 TestTransport test_transport_;
265 std::unique_ptr<ReceiveStatistics> receive_statistics_; 268 std::unique_ptr<ReceiveStatistics> receive_statistics_;
266 std::unique_ptr<ModuleRtpRtcpImpl> rtp_rtcp_impl_; 269 std::unique_ptr<ModuleRtpRtcpImpl> rtp_rtcp_impl_;
267 std::unique_ptr<RTCPSender> rtcp_sender_; 270 std::unique_ptr<RTCPSender> rtcp_sender_;
271 RateLimiter retransmission_rate_limiter_;
268 }; 272 };
269 273
270 TEST_F(RtcpSenderTest, SetRtcpStatus) { 274 TEST_F(RtcpSenderTest, SetRtcpStatus) {
271 EXPECT_EQ(RtcpMode::kOff, rtcp_sender_->Status()); 275 EXPECT_EQ(RtcpMode::kOff, rtcp_sender_->Status());
272 rtcp_sender_->SetRTCPStatus(RtcpMode::kReducedSize); 276 rtcp_sender_->SetRTCPStatus(RtcpMode::kReducedSize);
273 EXPECT_EQ(RtcpMode::kReducedSize, rtcp_sender_->Status()); 277 EXPECT_EQ(RtcpMode::kReducedSize, rtcp_sender_->Status());
274 } 278 }
275 279
276 TEST_F(RtcpSenderTest, SetSendingStatus) { 280 TEST_F(RtcpSenderTest, SetSendingStatus) {
277 EXPECT_FALSE(rtcp_sender_->Sending()); 281 EXPECT_FALSE(rtcp_sender_->Sending());
(...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after
813 rtcp_sender_->SetLastRtpTime(kRtpTimestamp, clock_.TimeInMilliseconds()); 817 rtcp_sender_->SetLastRtpTime(kRtpTimestamp, clock_.TimeInMilliseconds());
814 818
815 // Set up XR VoIP metric to be included with BYE 819 // Set up XR VoIP metric to be included with BYE
816 rtcp_sender_->SetRTCPStatus(RtcpMode::kCompound); 820 rtcp_sender_->SetRTCPStatus(RtcpMode::kCompound);
817 RTCPVoIPMetric metric; 821 RTCPVoIPMetric metric;
818 EXPECT_EQ(0, rtcp_sender_->SetRTCPVoIPMetrics(&metric)); 822 EXPECT_EQ(0, rtcp_sender_->SetRTCPVoIPMetrics(&metric));
819 EXPECT_EQ(0, rtcp_sender_->SendRTCP(feedback_state(), kRtcpBye)); 823 EXPECT_EQ(0, rtcp_sender_->SendRTCP(feedback_state(), kRtcpBye));
820 } 824 }
821 825
822 } // namespace webrtc 826 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/rtp_rtcp/source/rtcp_receiver_unittest.cc ('k') | webrtc/modules/rtp_rtcp/source/rtp_sender.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698