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

Unified Diff: webrtc/modules/video_coding/video_packet_buffer_unittest.cc

Issue 2987013002: Don't clear newer packets from the video_coding::PacketBuffer when calling ClearTo; (Closed)
Patch Set: Created 3 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: webrtc/modules/video_coding/video_packet_buffer_unittest.cc
diff --git a/webrtc/modules/video_coding/video_packet_buffer_unittest.cc b/webrtc/modules/video_coding/video_packet_buffer_unittest.cc
index e2537b8dc29b718bfa064b0e24746b4911e141a8..b4043a66fa4d9247eea2e3246579c70cf3dea60d 100644
--- a/webrtc/modules/video_coding/video_packet_buffer_unittest.cc
+++ b/webrtc/modules/video_coding/video_packet_buffer_unittest.cc
@@ -303,6 +303,30 @@ TEST_F(TestPacketBuffer, ClearSinglePacket) {
EXPECT_TRUE(Insert(seq_num + kMaxSize, kDeltaFrame, kFirst, kLast));
}
+TEST_F(TestPacketBuffer, ClearFullBuffer) {
+ for (int i = 0; i < kMaxSize; ++i)
+ EXPECT_TRUE(Insert(i, kDeltaFrame, kFirst, kLast));
+
+ packet_buffer_->ClearTo(kMaxSize - 1);
+
+ for (int i = kMaxSize; i < 2 * kMaxSize; ++i)
+ EXPECT_TRUE(Insert(i, kDeltaFrame, kFirst, kLast));
+}
+
+TEST_F(TestPacketBuffer, DontClearNewerPacket) {
+ EXPECT_TRUE(Insert(0, kKeyFrame, kFirst, kLast));
+ packet_buffer_->ClearTo(0);
+ EXPECT_TRUE(Insert(2 * kStartSize, kKeyFrame, kFirst, kLast));
+ EXPECT_TRUE(Insert(3 * kStartSize + 1, kKeyFrame, kFirst, kNotLast));
+ packet_buffer_->ClearTo(2 * kStartSize);
+ EXPECT_TRUE(Insert(3 * kStartSize + 2, kKeyFrame, kNotFirst, kLast));
+
+ ASSERT_EQ(3UL, frames_from_callback_.size());
+ CheckFrame(0);
+ CheckFrame(2 * kStartSize);
+ CheckFrame(3 * kStartSize + 1);
+}
+
TEST_F(TestPacketBuffer, OneIncompleteFrame) {
const uint16_t seq_num = Rand();
« webrtc/modules/video_coding/packet_buffer.cc ('K') | « webrtc/modules/video_coding/packet_buffer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698