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

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

Powered by Google App Engine
This is Rietveld 408576698