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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 EXPECT_TRUE(Insert(seq_num + 2, kKeyFrame, kFirst, kLast)); | 95 EXPECT_TRUE(Insert(seq_num + 2, kKeyFrame, kFirst, kLast)); |
96 EXPECT_TRUE(Insert(seq_num + 3, kKeyFrame, kFirst, kLast)); | 96 EXPECT_TRUE(Insert(seq_num + 3, kKeyFrame, kFirst, kLast)); |
97 } | 97 } |
98 | 98 |
99 TEST_F(TestPacketBuffer, InsertDuplicatePacket) { | 99 TEST_F(TestPacketBuffer, InsertDuplicatePacket) { |
100 const uint16_t seq_num = Rand(); | 100 const uint16_t seq_num = Rand(); |
101 EXPECT_TRUE(Insert(seq_num, kKeyFrame, kFirst, kLast)); | 101 EXPECT_TRUE(Insert(seq_num, kKeyFrame, kFirst, kLast)); |
102 EXPECT_TRUE(Insert(seq_num, kKeyFrame, kFirst, kLast)); | 102 EXPECT_TRUE(Insert(seq_num, kKeyFrame, kFirst, kLast)); |
103 } | 103 } |
104 | 104 |
105 TEST_F(TestPacketBuffer, SeqNumWrap) { | 105 TEST_F(TestPacketBuffer, SeqNumWrapOneFrame) { |
| 106 EXPECT_TRUE(Insert(0xFFFF, kKeyFrame, kFirst, kNotLast)); |
| 107 EXPECT_TRUE(Insert(0x0, kKeyFrame, kNotFirst, kLast)); |
| 108 |
| 109 CheckFrame(0xFFFF); |
| 110 } |
| 111 |
| 112 TEST_F(TestPacketBuffer, SeqNumWrapTwoFrames) { |
106 EXPECT_TRUE(Insert(0xFFFF, kKeyFrame, kFirst, kLast)); | 113 EXPECT_TRUE(Insert(0xFFFF, kKeyFrame, kFirst, kLast)); |
107 EXPECT_TRUE(Insert(0x0, kKeyFrame, kFirst, kLast)); | 114 EXPECT_TRUE(Insert(0x0, kKeyFrame, kFirst, kLast)); |
108 | 115 |
109 CheckFrame(0xFFFF); | 116 CheckFrame(0xFFFF); |
| 117 CheckFrame(0x0); |
110 } | 118 } |
111 | 119 |
112 TEST_F(TestPacketBuffer, InsertOldPackets) { | 120 TEST_F(TestPacketBuffer, InsertOldPackets) { |
113 const uint16_t seq_num = Rand(); | 121 const uint16_t seq_num = Rand(); |
114 | 122 |
115 EXPECT_TRUE(Insert(seq_num, kKeyFrame, kFirst, kNotLast)); | 123 EXPECT_TRUE(Insert(seq_num, kKeyFrame, kFirst, kNotLast)); |
116 EXPECT_TRUE(Insert(seq_num + 2, kDeltaFrame, kFirst, kLast)); | 124 EXPECT_TRUE(Insert(seq_num + 2, kDeltaFrame, kFirst, kLast)); |
117 EXPECT_TRUE(Insert(seq_num + 1, kKeyFrame, kNotFirst, kLast)); | 125 EXPECT_TRUE(Insert(seq_num + 1, kKeyFrame, kNotFirst, kLast)); |
118 ASSERT_EQ(2UL, frames_from_callback_.size()); | 126 ASSERT_EQ(2UL, frames_from_callback_.size()); |
119 | 127 |
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
455 // Expect to free data3 upon insertion (old packet). | 463 // Expect to free data3 upon insertion (old packet). |
456 packet_buffer_->ClearTo(1); | 464 packet_buffer_->ClearTo(1); |
457 EXPECT_FALSE(Insert(1, kKeyFrame, kFirst, kNotLast, 5, data3)); | 465 EXPECT_FALSE(Insert(1, kKeyFrame, kFirst, kNotLast, 5, data3)); |
458 | 466 |
459 // Expect to free data4 upon insertion (packet buffer is full). | 467 // Expect to free data4 upon insertion (packet buffer is full). |
460 EXPECT_FALSE(Insert(2 + kMaxSize, kKeyFrame, kFirst, kNotLast, 5, data4)); | 468 EXPECT_FALSE(Insert(2 + kMaxSize, kKeyFrame, kFirst, kNotLast, 5, data4)); |
461 } | 469 } |
462 | 470 |
463 } // namespace video_coding | 471 } // namespace video_coding |
464 } // namespace webrtc | 472 } // namespace webrtc |
OLD | NEW |