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 |
(...skipping 1330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1341 EXPECT_EQ(rtx_stats.transmitted.TotalBytes(), | 1341 EXPECT_EQ(rtx_stats.transmitted.TotalBytes(), |
1342 rtx_stats.transmitted.payload_bytes + | 1342 rtx_stats.transmitted.payload_bytes + |
1343 rtx_stats.transmitted.header_bytes + | 1343 rtx_stats.transmitted.header_bytes + |
1344 rtx_stats.transmitted.padding_bytes); | 1344 rtx_stats.transmitted.padding_bytes); |
1345 | 1345 |
1346 EXPECT_EQ(transport_.total_bytes_sent_, | 1346 EXPECT_EQ(transport_.total_bytes_sent_, |
1347 rtp_stats.transmitted.TotalBytes() + | 1347 rtp_stats.transmitted.TotalBytes() + |
1348 rtx_stats.transmitted.TotalBytes()); | 1348 rtx_stats.transmitted.TotalBytes()); |
1349 } | 1349 } |
1350 | 1350 |
1351 TEST_F(RtpSenderTest, RespectsNackBitrateLimit) { | |
1352 const int32_t kPacketSize = 1400; | |
1353 const int32_t kNumPackets = 30; | |
1354 | |
1355 rtp_sender_->SetStorePacketsStatus(true, kNumPackets); | |
1356 rtp_sender_->SetTargetBitrate(kNumPackets * kPacketSize * 8); | |
stefan-webrtc
2015/09/17 11:45:33
Comment on that you want 30 1400 bytes packets to
sprang_webrtc
2015/09/21 11:17:05
Done.
| |
1357 const uint16_t kStartSequenceNumber = rtp_sender_->SequenceNumber(); | |
1358 std::list<uint16_t> sequence_numbers; | |
1359 for (int32_t i = 0; i < kNumPackets; ++i) { | |
1360 sequence_numbers.push_back(kStartSequenceNumber + i); | |
1361 fake_clock_.AdvanceTimeMilliseconds(1); | |
1362 SendPacket(fake_clock_.TimeInMilliseconds(), kPacketSize); | |
1363 } | |
1364 EXPECT_EQ(kNumPackets, transport_.packets_sent_); | |
1365 | |
1366 fake_clock_.AdvanceTimeMilliseconds(1000 - kNumPackets); | |
1367 | |
1368 // Resending should work - brings the bandwidth up to the limit. | |
stefan-webrtc
2015/09/17 11:45:33
This surprises me a bit. You have already used the
sprang_webrtc
2015/09/21 11:17:05
The nack overhead is compensated for in media_opti
| |
1369 rtp_sender_->OnReceivedNACK(sequence_numbers, 0); | |
1370 EXPECT_EQ(kNumPackets * 2, transport_.packets_sent_); | |
1371 | |
1372 // Resending even a single packet should not work, bandwidth exceeded. | |
1373 sequence_numbers.clear(); | |
stefan-webrtc
2015/09/17 11:45:33
This isn't really necessary, as the result should
sprang_webrtc
2015/09/21 11:17:05
Done.
| |
1374 sequence_numbers.push_back(kStartSequenceNumber); | |
1375 rtp_sender_->OnReceivedNACK(sequence_numbers, 0); | |
1376 EXPECT_EQ(kNumPackets * 2, transport_.packets_sent_); | |
1377 } | |
1378 | |
1351 // Verify that all packets of a frame have CVO byte set. | 1379 // Verify that all packets of a frame have CVO byte set. |
1352 TEST_F(RtpSenderVideoTest, SendVideoWithCVO) { | 1380 TEST_F(RtpSenderVideoTest, SendVideoWithCVO) { |
1353 RTPVideoHeader hdr = {0}; | 1381 RTPVideoHeader hdr = {0}; |
1354 hdr.rotation = kVideoRotation_90; | 1382 hdr.rotation = kVideoRotation_90; |
1355 | 1383 |
1356 EXPECT_EQ(0, rtp_sender_->RegisterRtpHeaderExtension( | 1384 EXPECT_EQ(0, rtp_sender_->RegisterRtpHeaderExtension( |
1357 kRtpExtensionVideoRotation, kVideoRotationExtensionId)); | 1385 kRtpExtensionVideoRotation, kVideoRotationExtensionId)); |
1358 EXPECT_TRUE(rtp_sender_->ActivateCVORtpHeaderExtension()); | 1386 EXPECT_TRUE(rtp_sender_->ActivateCVORtpHeaderExtension()); |
1359 | 1387 |
1360 EXPECT_EQ( | 1388 EXPECT_EQ( |
(...skipping 12 matching lines...) Expand all Loading... | |
1373 reinterpret_cast<uint8_t*>(transport_.sent_packets_[0]->data()), | 1401 reinterpret_cast<uint8_t*>(transport_.sent_packets_[0]->data()), |
1374 transport_.sent_packets_[0]->size(), true, &map, kSeqNum, hdr.rotation); | 1402 transport_.sent_packets_[0]->size(), true, &map, kSeqNum, hdr.rotation); |
1375 | 1403 |
1376 // Verify that this packet does have CVO byte. | 1404 // Verify that this packet does have CVO byte. |
1377 VerifyCVOPacket( | 1405 VerifyCVOPacket( |
1378 reinterpret_cast<uint8_t*>(transport_.sent_packets_[1]->data()), | 1406 reinterpret_cast<uint8_t*>(transport_.sent_packets_[1]->data()), |
1379 transport_.sent_packets_[1]->size(), true, &map, kSeqNum + 1, | 1407 transport_.sent_packets_[1]->size(), true, &map, kSeqNum + 1, |
1380 hdr.rotation); | 1408 hdr.rotation); |
1381 } | 1409 } |
1382 } // namespace webrtc | 1410 } // namespace webrtc |
OLD | NEW |