OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2016 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 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 | 205 |
206 ASSERT_EQ(1UL, frames_from_callback_.size()); | 206 ASSERT_EQ(1UL, frames_from_callback_.size()); |
207 CheckFrame(seq_num); | 207 CheckFrame(seq_num); |
208 } | 208 } |
209 | 209 |
210 TEST_F(TestPacketBuffer, ExpandBufferOverflow) { | 210 TEST_F(TestPacketBuffer, ExpandBufferOverflow) { |
211 const uint16_t seq_num = Rand(); | 211 const uint16_t seq_num = Rand(); |
212 | 212 |
213 for (int i = 0; i < kMaxSize; ++i) | 213 for (int i = 0; i < kMaxSize; ++i) |
214 EXPECT_TRUE(Insert(seq_num + i, kKeyFrame, kFirst, kLast)); | 214 EXPECT_TRUE(Insert(seq_num + i, kKeyFrame, kFirst, kLast)); |
215 EXPECT_FALSE(Insert(seq_num + kMaxSize + 1, kKeyFrame, kFirst, kLast)); | 215 EXPECT_TRUE(Insert(seq_num + kMaxSize + 1, kKeyFrame, kFirst, kLast)); |
216 } | 216 } |
217 | 217 |
218 TEST_F(TestPacketBuffer, OnePacketOneFrame) { | 218 TEST_F(TestPacketBuffer, OnePacketOneFrame) { |
219 const uint16_t seq_num = Rand(); | 219 const uint16_t seq_num = Rand(); |
220 EXPECT_TRUE(Insert(seq_num, kKeyFrame, kFirst, kLast)); | 220 EXPECT_TRUE(Insert(seq_num, kKeyFrame, kFirst, kLast)); |
221 ASSERT_EQ(1UL, frames_from_callback_.size()); | 221 ASSERT_EQ(1UL, frames_from_callback_.size()); |
222 CheckFrame(seq_num); | 222 CheckFrame(seq_num); |
223 } | 223 } |
224 | 224 |
225 TEST_F(TestPacketBuffer, TwoPacketsTwoFrames) { | 225 TEST_F(TestPacketBuffer, TwoPacketsTwoFrames) { |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
458 EXPECT_TRUE(Insert(2, kKeyFrame, kFirst, kNotLast, 5, data1)); | 458 EXPECT_TRUE(Insert(2, kKeyFrame, kFirst, kNotLast, 5, data1)); |
459 | 459 |
460 // Expect to free data2 upon insertion. | 460 // Expect to free data2 upon insertion. |
461 EXPECT_TRUE(Insert(2, kKeyFrame, kFirst, kNotLast, 5, data2)); | 461 EXPECT_TRUE(Insert(2, kKeyFrame, kFirst, kNotLast, 5, data2)); |
462 | 462 |
463 // Expect to free data3 upon insertion (old packet). | 463 // Expect to free data3 upon insertion (old packet). |
464 packet_buffer_->ClearTo(1); | 464 packet_buffer_->ClearTo(1); |
465 EXPECT_FALSE(Insert(1, kKeyFrame, kFirst, kNotLast, 5, data3)); | 465 EXPECT_FALSE(Insert(1, kKeyFrame, kFirst, kNotLast, 5, data3)); |
466 | 466 |
467 // Expect to free data4 upon insertion (packet buffer is full). | 467 // Expect to free data4 upon insertion (packet buffer is full). |
468 EXPECT_FALSE(Insert(2 + kMaxSize, kKeyFrame, kFirst, kNotLast, 5, data4)); | 468 EXPECT_TRUE(Insert(2 + kMaxSize, kKeyFrame, kFirst, kNotLast, 5, data4)); |
469 } | 469 } |
470 | 470 |
471 TEST_F(TestPacketBuffer, ContinuousSeqNumDoubleMarkerBit) { | 471 TEST_F(TestPacketBuffer, ContinuousSeqNumDoubleMarkerBit) { |
472 Insert(2, kKeyFrame, kNotFirst, kNotLast); | 472 Insert(2, kKeyFrame, kNotFirst, kNotLast); |
473 Insert(1, kKeyFrame, kFirst, kLast); | 473 Insert(1, kKeyFrame, kFirst, kLast); |
474 frames_from_callback_.clear(); | 474 frames_from_callback_.clear(); |
475 Insert(3, kKeyFrame, kNotFirst, kLast); | 475 Insert(3, kKeyFrame, kNotFirst, kLast); |
476 | 476 |
477 EXPECT_EQ(0UL, frames_from_callback_.size()); | 477 EXPECT_EQ(0UL, frames_from_callback_.size()); |
478 } | 478 } |
479 | 479 |
480 } // namespace video_coding | 480 } // namespace video_coding |
481 } // namespace webrtc | 481 } // namespace webrtc |
OLD | NEW |