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 * This file includes unit tests for the RTPPacketHistory. | 10 * This file includes unit tests for the RTPPacketHistory. |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 CreateRtpPacket(kSeqNum, kSsrc, kPayload, kTimestamp, packet_, &len); | 72 CreateRtpPacket(kSeqNum, kSsrc, kPayload, kTimestamp, packet_, &len); |
73 EXPECT_EQ(0, hist_->PutRTPPacket(packet_, len, capture_time_ms, | 73 EXPECT_EQ(0, hist_->PutRTPPacket(packet_, len, capture_time_ms, |
74 kAllowRetransmission)); | 74 kAllowRetransmission)); |
75 // Packet should not be stored. | 75 // Packet should not be stored. |
76 len = kMaxPacketLength; | 76 len = kMaxPacketLength; |
77 int64_t time; | 77 int64_t time; |
78 EXPECT_FALSE(hist_->GetPacketAndSetSendTime(kSeqNum, 0, false, packet_, &len, | 78 EXPECT_FALSE(hist_->GetPacketAndSetSendTime(kSeqNum, 0, false, packet_, &len, |
79 &time)); | 79 &time)); |
80 } | 80 } |
81 | 81 |
82 TEST_F(RtpPacketHistoryTest, DontStore) { | |
83 hist_->SetStorePacketsStatus(true, 10); | |
84 size_t len = 0; | |
85 int64_t capture_time_ms = fake_clock_.TimeInMilliseconds(); | |
86 CreateRtpPacket(kSeqNum, kSsrc, kPayload, kTimestamp, packet_, &len); | |
87 EXPECT_EQ(0, hist_->PutRTPPacket(packet_, len, capture_time_ms, kDontStore)); | |
88 | |
89 // Packet should not be stored. | |
90 len = kMaxPacketLength; | |
91 int64_t time; | |
92 EXPECT_FALSE(hist_->GetPacketAndSetSendTime(kSeqNum, 0, false, packet_, &len, | |
93 &time)); | |
94 } | |
95 | |
96 TEST_F(RtpPacketHistoryTest, PutRtpPacket_TooLargePacketLength) { | 82 TEST_F(RtpPacketHistoryTest, PutRtpPacket_TooLargePacketLength) { |
97 hist_->SetStorePacketsStatus(true, 10); | 83 hist_->SetStorePacketsStatus(true, 10); |
98 int64_t capture_time_ms = fake_clock_.TimeInMilliseconds(); | 84 int64_t capture_time_ms = fake_clock_.TimeInMilliseconds(); |
99 EXPECT_EQ(-1, hist_->PutRTPPacket(packet_, kMaxPacketLength + 1, | 85 EXPECT_EQ(-1, hist_->PutRTPPacket(packet_, kMaxPacketLength + 1, |
100 capture_time_ms, kAllowRetransmission)); | 86 capture_time_ms, kAllowRetransmission)); |
101 } | 87 } |
102 | 88 |
103 TEST_F(RtpPacketHistoryTest, GetRtpPacket_NotStored) { | 89 TEST_F(RtpPacketHistoryTest, GetRtpPacket_NotStored) { |
104 hist_->SetStorePacketsStatus(true, 10); | 90 hist_->SetStorePacketsStatus(true, 10); |
105 size_t len = kMaxPacketLength; | 91 size_t len = kMaxPacketLength; |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 | 246 |
261 // Retransmit all packets currently in buffer. | 247 // Retransmit all packets currently in buffer. |
262 for (size_t i = 1; i < kMaxHistoryCapacity + 1; ++i) { | 248 for (size_t i = 1; i < kMaxHistoryCapacity + 1; ++i) { |
263 len = kMaxPacketLength; | 249 len = kMaxPacketLength; |
264 EXPECT_TRUE(hist_->GetPacketAndSetSendTime(kSeqNum + i, 100, false, packet_, | 250 EXPECT_TRUE(hist_->GetPacketAndSetSendTime(kSeqNum + i, 100, false, packet_, |
265 &len, &time)); | 251 &len, &time)); |
266 } | 252 } |
267 } | 253 } |
268 | 254 |
269 } // namespace webrtc | 255 } // namespace webrtc |
OLD | NEW |