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

Side by Side 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, 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
OLDNEW
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 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 TEST_F(TestPacketBuffer, ClearSinglePacket) { 296 TEST_F(TestPacketBuffer, ClearSinglePacket) {
297 const uint16_t seq_num = Rand(); 297 const uint16_t seq_num = Rand();
298 298
299 for (int i = 0; i < kMaxSize; ++i) 299 for (int i = 0; i < kMaxSize; ++i)
300 EXPECT_TRUE(Insert(seq_num + i, kDeltaFrame, kFirst, kLast)); 300 EXPECT_TRUE(Insert(seq_num + i, kDeltaFrame, kFirst, kLast));
301 301
302 packet_buffer_->ClearTo(seq_num); 302 packet_buffer_->ClearTo(seq_num);
303 EXPECT_TRUE(Insert(seq_num + kMaxSize, kDeltaFrame, kFirst, kLast)); 303 EXPECT_TRUE(Insert(seq_num + kMaxSize, kDeltaFrame, kFirst, kLast));
304 } 304 }
305 305
306 TEST_F(TestPacketBuffer, ClearFullBuffer) {
307 for (int i = 0; i < kMaxSize; ++i)
308 EXPECT_TRUE(Insert(i, kDeltaFrame, kFirst, kLast));
309
310 packet_buffer_->ClearTo(kMaxSize - 1);
311
312 for (int i = kMaxSize; i < 2 * kMaxSize; ++i)
313 EXPECT_TRUE(Insert(i, kDeltaFrame, kFirst, kLast));
314 }
315
316 TEST_F(TestPacketBuffer, DontClearNewerPacket) {
317 EXPECT_TRUE(Insert(0, kKeyFrame, kFirst, kLast));
318 packet_buffer_->ClearTo(0);
319 EXPECT_TRUE(Insert(2 * kStartSize, kKeyFrame, kFirst, kLast));
320 EXPECT_TRUE(Insert(3 * kStartSize + 1, kKeyFrame, kFirst, kNotLast));
321 packet_buffer_->ClearTo(2 * kStartSize);
322 EXPECT_TRUE(Insert(3 * kStartSize + 2, kKeyFrame, kNotFirst, kLast));
323
324 ASSERT_EQ(3UL, frames_from_callback_.size());
325 CheckFrame(0);
326 CheckFrame(2 * kStartSize);
327 CheckFrame(3 * kStartSize + 1);
328 }
329
306 TEST_F(TestPacketBuffer, OneIncompleteFrame) { 330 TEST_F(TestPacketBuffer, OneIncompleteFrame) {
307 const uint16_t seq_num = Rand(); 331 const uint16_t seq_num = Rand();
308 332
309 EXPECT_TRUE(Insert(seq_num, kDeltaFrame, kFirst, kNotLast)); 333 EXPECT_TRUE(Insert(seq_num, kDeltaFrame, kFirst, kNotLast));
310 EXPECT_TRUE(Insert(seq_num + 1, kDeltaFrame, kNotFirst, kLast)); 334 EXPECT_TRUE(Insert(seq_num + 1, kDeltaFrame, kNotFirst, kLast));
311 EXPECT_TRUE(Insert(seq_num - 1, kDeltaFrame, kNotFirst, kLast)); 335 EXPECT_TRUE(Insert(seq_num - 1, kDeltaFrame, kNotFirst, kLast));
312 336
313 ASSERT_EQ(1UL, frames_from_callback_.size()); 337 ASSERT_EQ(1UL, frames_from_callback_.size());
314 CheckFrame(seq_num); 338 CheckFrame(seq_num);
315 } 339 }
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
579 603
580 ASSERT_EQ(1UL, frames_from_callback_.size()); 604 ASSERT_EQ(1UL, frames_from_callback_.size());
581 packet_buffer_->PaddingReceived(1); 605 packet_buffer_->PaddingReceived(1);
582 ASSERT_EQ(2UL, frames_from_callback_.size()); 606 ASSERT_EQ(2UL, frames_from_callback_.size());
583 CheckFrame(0); 607 CheckFrame(0);
584 CheckFrame(2); 608 CheckFrame(2);
585 } 609 }
586 610
587 } // namespace video_coding 611 } // namespace video_coding
588 } // namespace webrtc 612 } // namespace webrtc
OLDNEW
« 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