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

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

Issue 2276833003: Change RtpSender::OnReceiveNACK name and signature (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: -one more <list> include 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
« no previous file with comments | « webrtc/modules/rtp_rtcp/source/rtp_sender.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <list>
12 #include <memory> 11 #include <memory>
13 #include <vector> 12 #include <vector>
14 13
15 #include "testing/gmock/include/gmock/gmock.h" 14 #include "testing/gmock/include/gmock/gmock.h"
16 #include "testing/gtest/include/gtest/gtest.h" 15 #include "testing/gtest/include/gtest/gtest.h"
17 #include "webrtc/base/buffer.h" 16 #include "webrtc/base/buffer.h"
18 #include "webrtc/base/rate_limiter.h" 17 #include "webrtc/base/rate_limiter.h"
19 #include "webrtc/call/mock/mock_rtc_event_log.h" 18 #include "webrtc/call/mock/mock_rtc_event_log.h"
20 #include "webrtc/modules/rtp_rtcp/include/rtp_cvo.h" 19 #include "webrtc/modules/rtp_rtcp/include/rtp_cvo.h"
21 #include "webrtc/modules/rtp_rtcp/include/rtp_header_parser.h" 20 #include "webrtc/modules/rtp_rtcp/include/rtp_header_parser.h"
(...skipping 1608 matching lines...) Expand 10 before | Expand all | Expand 10 after
1630 } 1629 }
1631 1630
1632 TEST_F(RtpSenderTestWithoutPacer, RespectsNackBitrateLimit) { 1631 TEST_F(RtpSenderTestWithoutPacer, RespectsNackBitrateLimit) {
1633 const int32_t kPacketSize = 1400; 1632 const int32_t kPacketSize = 1400;
1634 const int32_t kNumPackets = 30; 1633 const int32_t kNumPackets = 30;
1635 1634
1636 retransmission_rate_limiter_.SetMaxRate(kPacketSize * kNumPackets * 8); 1635 retransmission_rate_limiter_.SetMaxRate(kPacketSize * kNumPackets * 8);
1637 1636
1638 rtp_sender_->SetStorePacketsStatus(true, kNumPackets); 1637 rtp_sender_->SetStorePacketsStatus(true, kNumPackets);
1639 const uint16_t kStartSequenceNumber = rtp_sender_->SequenceNumber(); 1638 const uint16_t kStartSequenceNumber = rtp_sender_->SequenceNumber();
1640 std::list<uint16_t> sequence_numbers; 1639 std::vector<uint16_t> sequence_numbers;
1641 for (int32_t i = 0; i < kNumPackets; ++i) { 1640 for (int32_t i = 0; i < kNumPackets; ++i) {
1642 sequence_numbers.push_back(kStartSequenceNumber + i); 1641 sequence_numbers.push_back(kStartSequenceNumber + i);
1643 fake_clock_.AdvanceTimeMilliseconds(1); 1642 fake_clock_.AdvanceTimeMilliseconds(1);
1644 SendPacket(fake_clock_.TimeInMilliseconds(), kPacketSize); 1643 SendPacket(fake_clock_.TimeInMilliseconds(), kPacketSize);
1645 } 1644 }
1646 EXPECT_EQ(kNumPackets, transport_.packets_sent_); 1645 EXPECT_EQ(kNumPackets, transport_.packets_sent_);
1647 1646
1648 fake_clock_.AdvanceTimeMilliseconds(1000 - kNumPackets); 1647 fake_clock_.AdvanceTimeMilliseconds(1000 - kNumPackets);
1649 1648
1650 // Resending should work - brings the bandwidth up to the limit. 1649 // Resending should work - brings the bandwidth up to the limit.
1651 // NACK bitrate is capped to the same bitrate as the encoder, since the max 1650 // NACK bitrate is capped to the same bitrate as the encoder, since the max
1652 // protection overhead is 50% (see MediaOptimization::SetTargetRates). 1651 // protection overhead is 50% (see MediaOptimization::SetTargetRates).
1653 rtp_sender_->OnReceivedNACK(sequence_numbers, 0); 1652 rtp_sender_->OnReceivedNack(sequence_numbers, 0);
1654 EXPECT_EQ(kNumPackets * 2, transport_.packets_sent_); 1653 EXPECT_EQ(kNumPackets * 2, transport_.packets_sent_);
1655 1654
1656 // Must be at least 5ms in between retransmission attempts. 1655 // Must be at least 5ms in between retransmission attempts.
1657 fake_clock_.AdvanceTimeMilliseconds(5); 1656 fake_clock_.AdvanceTimeMilliseconds(5);
1658 1657
1659 // Resending should not work, bandwidth exceeded. 1658 // Resending should not work, bandwidth exceeded.
1660 rtp_sender_->OnReceivedNACK(sequence_numbers, 0); 1659 rtp_sender_->OnReceivedNack(sequence_numbers, 0);
1661 EXPECT_EQ(kNumPackets * 2, transport_.packets_sent_); 1660 EXPECT_EQ(kNumPackets * 2, transport_.packets_sent_);
1662 } 1661 }
1663 1662
1664 // Verify that all packets of a frame have CVO byte set. 1663 // Verify that all packets of a frame have CVO byte set.
1665 TEST_F(RtpSenderVideoTest, SendVideoWithCVO) { 1664 TEST_F(RtpSenderVideoTest, SendVideoWithCVO) {
1666 RTPVideoHeader hdr = {0}; 1665 RTPVideoHeader hdr = {0};
1667 hdr.rotation = kVideoRotation_90; 1666 hdr.rotation = kVideoRotation_90;
1668 1667
1669 EXPECT_EQ(0, rtp_sender_->RegisterRtpHeaderExtension( 1668 EXPECT_EQ(0, rtp_sender_->RegisterRtpHeaderExtension(
1670 kRtpExtensionVideoRotation, kVideoRotationExtensionId)); 1669 kRtpExtensionVideoRotation, kVideoRotationExtensionId));
(...skipping 15 matching lines...) Expand all
1686 reinterpret_cast<uint8_t*>(transport_.sent_packets_[0]->data()), 1685 reinterpret_cast<uint8_t*>(transport_.sent_packets_[0]->data()),
1687 transport_.sent_packets_[0]->size(), true, &map, kSeqNum, hdr.rotation); 1686 transport_.sent_packets_[0]->size(), true, &map, kSeqNum, hdr.rotation);
1688 1687
1689 // Verify that this packet does have CVO byte. 1688 // Verify that this packet does have CVO byte.
1690 VerifyCVOPacket( 1689 VerifyCVOPacket(
1691 reinterpret_cast<uint8_t*>(transport_.sent_packets_[1]->data()), 1690 reinterpret_cast<uint8_t*>(transport_.sent_packets_[1]->data()),
1692 transport_.sent_packets_[1]->size(), true, &map, kSeqNum + 1, 1691 transport_.sent_packets_[1]->size(), true, &map, kSeqNum + 1,
1693 hdr.rotation); 1692 hdr.rotation);
1694 } 1693 }
1695 } // namespace webrtc 1694 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/rtp_rtcp/source/rtp_sender.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698