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

Side by Side Diff: webrtc/modules/rtp_rtcp/source/rtp_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
(...skipping 995 matching lines...) Expand 10 before | Expand all | Expand 10 after
1006 const bool kIsRetransmit = true; 1006 const bool kIsRetransmit = true;
1007 rtp_sender_->TimeToSendPacket(kSeqNum, fake_clock_.TimeInMilliseconds(), 1007 rtp_sender_->TimeToSendPacket(kSeqNum, fake_clock_.TimeInMilliseconds(),
1008 kIsRetransmit, PacketInfo::kNotAProbe); 1008 kIsRetransmit, PacketInfo::kNotAProbe);
1009 EXPECT_EQ(1, transport_.packets_sent_); 1009 EXPECT_EQ(1, transport_.packets_sent_);
1010 } 1010 }
1011 1011
1012 TEST_F(RtpSenderTest, OnSendPacketNotUpdatedWithoutSeqNumAllocator) { 1012 TEST_F(RtpSenderTest, OnSendPacketNotUpdatedWithoutSeqNumAllocator) {
1013 rtp_sender_.reset(new RTPSender( 1013 rtp_sender_.reset(new RTPSender(
1014 false, &fake_clock_, &transport_, &mock_paced_sender_, 1014 false, &fake_clock_, &transport_, &mock_paced_sender_,
1015 nullptr /* TransportSequenceNumberAllocator */, nullptr, nullptr, nullptr, 1015 nullptr /* TransportSequenceNumberAllocator */, nullptr, nullptr, nullptr,
1016 nullptr, nullptr, &send_packet_observer_, nullptr)); 1016 nullptr, nullptr, &send_packet_observer_, &retransmission_rate_limiter_));
1017 EXPECT_EQ(0, rtp_sender_->RegisterRtpHeaderExtension( 1017 EXPECT_EQ(0, rtp_sender_->RegisterRtpHeaderExtension(
1018 kRtpExtensionTransportSequenceNumber, 1018 kRtpExtensionTransportSequenceNumber,
1019 kTransportSequenceNumberExtensionId)); 1019 kTransportSequenceNumberExtensionId));
1020 rtp_sender_->SetSequenceNumber(kSeqNum); 1020 rtp_sender_->SetSequenceNumber(kSeqNum);
1021 rtp_sender_->SetStorePacketsStatus(true, 10); 1021 rtp_sender_->SetStorePacketsStatus(true, 10);
1022 1022
1023 EXPECT_CALL(send_packet_observer_, OnSendPacket(_, _, _)).Times(0); 1023 EXPECT_CALL(send_packet_observer_, OnSendPacket(_, _, _)).Times(0);
1024 EXPECT_CALL(mock_paced_sender_, InsertPacket(_, _, _, _, _, _)).Times(1); 1024 EXPECT_CALL(mock_paced_sender_, InsertPacket(_, _, _, _, _, _)).Times(1);
1025 1025
1026 SendGenericPayload(); // Packet passed to pacer. 1026 SendGenericPayload(); // Packet passed to pacer.
1027 const bool kIsRetransmit = false; 1027 const bool kIsRetransmit = false;
1028 rtp_sender_->TimeToSendPacket(kSeqNum, fake_clock_.TimeInMilliseconds(), 1028 rtp_sender_->TimeToSendPacket(kSeqNum, fake_clock_.TimeInMilliseconds(),
1029 kIsRetransmit, PacketInfo::kNotAProbe); 1029 kIsRetransmit, PacketInfo::kNotAProbe);
1030 EXPECT_EQ(1, transport_.packets_sent_); 1030 EXPECT_EQ(1, transport_.packets_sent_);
1031 } 1031 }
1032 1032
1033 TEST_F(RtpSenderTest, SendRedundantPayloads) { 1033 TEST_F(RtpSenderTest, SendRedundantPayloads) {
1034 MockTransport transport; 1034 MockTransport transport;
1035 rtp_sender_.reset(new RTPSender( 1035 rtp_sender_.reset(new RTPSender(
1036 false, &fake_clock_, &transport, &mock_paced_sender_, nullptr, nullptr, 1036 false, &fake_clock_, &transport, &mock_paced_sender_, nullptr, nullptr,
1037 nullptr, nullptr, nullptr, &mock_rtc_event_log_, nullptr, nullptr)); 1037 nullptr, nullptr, nullptr, &mock_rtc_event_log_, nullptr,
1038 &retransmission_rate_limiter_));
1038 1039
1039 rtp_sender_->SetSequenceNumber(kSeqNum); 1040 rtp_sender_->SetSequenceNumber(kSeqNum);
1040 rtp_sender_->SetRtxPayloadType(kRtxPayload, kPayload); 1041 rtp_sender_->SetRtxPayloadType(kRtxPayload, kPayload);
1041 1042
1042 uint16_t seq_num = kSeqNum; 1043 uint16_t seq_num = kSeqNum;
1043 rtp_sender_->SetStorePacketsStatus(true, 10); 1044 rtp_sender_->SetStorePacketsStatus(true, 10);
1044 int32_t rtp_header_len = kRtpHeaderSize; 1045 int32_t rtp_header_len = kRtpHeaderSize;
1045 EXPECT_EQ( 1046 EXPECT_EQ(
1046 0, rtp_sender_->RegisterRtpHeaderExtension(kRtpExtensionAbsoluteSendTime, 1047 0, rtp_sender_->RegisterRtpHeaderExtension(kRtpExtensionAbsoluteSendTime,
1047 kAbsoluteSendTimeExtensionId)); 1048 kAbsoluteSendTimeExtensionId));
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
1171 ++num_calls_; 1172 ++num_calls_;
1172 ssrc_ = ssrc; 1173 ssrc_ = ssrc;
1173 frame_counts_ = frame_counts; 1174 frame_counts_ = frame_counts;
1174 } 1175 }
1175 1176
1176 uint32_t num_calls_; 1177 uint32_t num_calls_;
1177 uint32_t ssrc_; 1178 uint32_t ssrc_;
1178 FrameCounts frame_counts_; 1179 FrameCounts frame_counts_;
1179 } callback; 1180 } callback;
1180 1181
1181 rtp_sender_.reset(new RTPSender( 1182 rtp_sender_.reset(new RTPSender(false, &fake_clock_, &transport_,
1182 false, &fake_clock_, &transport_, &mock_paced_sender_, nullptr, nullptr, 1183 &mock_paced_sender_, nullptr, nullptr,
1183 nullptr, &callback, nullptr, nullptr, nullptr, nullptr)); 1184 nullptr, &callback, nullptr, nullptr, nullptr,
1185 &retransmission_rate_limiter_));
1184 1186
1185 char payload_name[RTP_PAYLOAD_NAME_SIZE] = "GENERIC"; 1187 char payload_name[RTP_PAYLOAD_NAME_SIZE] = "GENERIC";
1186 const uint8_t payload_type = 127; 1188 const uint8_t payload_type = 127;
1187 ASSERT_EQ(0, rtp_sender_->RegisterPayload(payload_name, payload_type, 90000, 1189 ASSERT_EQ(0, rtp_sender_->RegisterPayload(payload_name, payload_type, 90000,
1188 0, 1500)); 1190 0, 1500));
1189 uint8_t payload[] = {47, 11, 32, 93, 89}; 1191 uint8_t payload[] = {47, 11, 32, 93, 89};
1190 rtp_sender_->SetStorePacketsStatus(true, 1); 1192 rtp_sender_->SetStorePacketsStatus(true, 1);
1191 uint32_t ssrc = rtp_sender_->SSRC(); 1193 uint32_t ssrc = rtp_sender_->SSRC();
1192 1194
1193 EXPECT_CALL(mock_paced_sender_, InsertPacket(_, _, _, _, _, _)) 1195 EXPECT_CALL(mock_paced_sender_, InsertPacket(_, _, _, _, _, _))
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
1232 ssrc_ = ssrc; 1234 ssrc_ = ssrc;
1233 total_bitrate_ = total_bitrate; 1235 total_bitrate_ = total_bitrate;
1234 retransmit_bitrate_ = retransmit_bitrate; 1236 retransmit_bitrate_ = retransmit_bitrate;
1235 } 1237 }
1236 1238
1237 uint32_t num_calls_; 1239 uint32_t num_calls_;
1238 uint32_t ssrc_; 1240 uint32_t ssrc_;
1239 uint32_t total_bitrate_; 1241 uint32_t total_bitrate_;
1240 uint32_t retransmit_bitrate_; 1242 uint32_t retransmit_bitrate_;
1241 } callback; 1243 } callback;
1242 rtp_sender_.reset(new RTPSender(false, &fake_clock_, &transport_, nullptr, 1244 rtp_sender_.reset(new RTPSender(
1243 nullptr, nullptr, &callback, nullptr, nullptr, 1245 false, &fake_clock_, &transport_, nullptr, nullptr, nullptr, &callback,
1244 nullptr, nullptr, nullptr)); 1246 nullptr, nullptr, nullptr, nullptr, &retransmission_rate_limiter_));
1245 1247
1246 // Simulate kNumPackets sent with kPacketInterval ms intervals, with the 1248 // Simulate kNumPackets sent with kPacketInterval ms intervals, with the
1247 // number of packets selected so that we fill (but don't overflow) the one 1249 // number of packets selected so that we fill (but don't overflow) the one
1248 // second averaging window. 1250 // second averaging window.
1249 const uint32_t kWindowSizeMs = 1000; 1251 const uint32_t kWindowSizeMs = 1000;
1250 const uint32_t kPacketInterval = 20; 1252 const uint32_t kPacketInterval = 20;
1251 const uint32_t kNumPackets = 1253 const uint32_t kNumPackets =
1252 (kWindowSizeMs - kPacketInterval) / kPacketInterval; 1254 (kWindowSizeMs - kPacketInterval) / kPacketInterval;
1253 // Overhead = 12 bytes RTP header + 1 byte generic header. 1255 // Overhead = 12 bytes RTP header + 1 byte generic header.
1254 const uint32_t kPacketOverhead = 13; 1256 const uint32_t kPacketOverhead = 13;
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
1289 1291
1290 rtp_sender_.reset(); 1292 rtp_sender_.reset();
1291 } 1293 }
1292 1294
1293 class RtpSenderAudioTest : public RtpSenderTest { 1295 class RtpSenderAudioTest : public RtpSenderTest {
1294 protected: 1296 protected:
1295 RtpSenderAudioTest() {} 1297 RtpSenderAudioTest() {}
1296 1298
1297 void SetUp() override { 1299 void SetUp() override {
1298 payload_ = kAudioPayload; 1300 payload_ = kAudioPayload;
1299 rtp_sender_.reset(new RTPSender(true, &fake_clock_, &transport_, nullptr, 1301 rtp_sender_.reset(new RTPSender(
1300 nullptr, nullptr, nullptr, nullptr, nullptr, 1302 true, &fake_clock_, &transport_, nullptr, nullptr, nullptr, nullptr,
1301 nullptr, nullptr, nullptr)); 1303 nullptr, nullptr, nullptr, nullptr, &retransmission_rate_limiter_));
1302 rtp_sender_->SetSequenceNumber(kSeqNum); 1304 rtp_sender_->SetSequenceNumber(kSeqNum);
1303 } 1305 }
1304 }; 1306 };
1305 1307
1306 TEST_F(RtpSenderTestWithoutPacer, StreamDataCountersCallbacks) { 1308 TEST_F(RtpSenderTestWithoutPacer, StreamDataCountersCallbacks) {
1307 class TestCallback : public StreamDataCountersCallback { 1309 class TestCallback : public StreamDataCountersCallback {
1308 public: 1310 public:
1309 TestCallback() : StreamDataCountersCallback(), ssrc_(0), counters_() {} 1311 TestCallback() : StreamDataCountersCallback(), ssrc_(0), counters_() {}
1310 virtual ~TestCallback() {} 1312 virtual ~TestCallback() {}
1311 1313
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after
1619 reinterpret_cast<uint8_t*>(transport_.sent_packets_[0]->data()), 1621 reinterpret_cast<uint8_t*>(transport_.sent_packets_[0]->data()),
1620 transport_.sent_packets_[0]->size(), true, &map, kSeqNum, hdr.rotation); 1622 transport_.sent_packets_[0]->size(), true, &map, kSeqNum, hdr.rotation);
1621 1623
1622 // Verify that this packet does have CVO byte. 1624 // Verify that this packet does have CVO byte.
1623 VerifyCVOPacket( 1625 VerifyCVOPacket(
1624 reinterpret_cast<uint8_t*>(transport_.sent_packets_[1]->data()), 1626 reinterpret_cast<uint8_t*>(transport_.sent_packets_[1]->data()),
1625 transport_.sent_packets_[1]->size(), true, &map, kSeqNum + 1, 1627 transport_.sent_packets_[1]->size(), true, &map, kSeqNum + 1,
1626 hdr.rotation); 1628 hdr.rotation);
1627 } 1629 }
1628 } // namespace webrtc 1630 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/rtp_rtcp/source/rtp_sender.cc ('k') | webrtc/modules/rtp_rtcp/test/testAPI/test_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698