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

Side by Side Diff: webrtc/modules/video_coding/packet_buffer_unittest.cc

Issue 1988653002: PacketBuffer now can save how many times a packet has been nacked. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 7 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 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 258
259 TEST_F(TestPacketBuffer, InsertDuplicatePacket) { 259 TEST_F(TestPacketBuffer, InsertDuplicatePacket) {
260 VCMPacket packet; 260 VCMPacket packet;
261 packet.seqNum = Rand(); 261 packet.seqNum = Rand();
262 EXPECT_TRUE(packet_buffer_->InsertPacket(packet)); 262 EXPECT_TRUE(packet_buffer_->InsertPacket(packet));
263 ++packet.seqNum; 263 ++packet.seqNum;
264 EXPECT_TRUE(packet_buffer_->InsertPacket(packet)); 264 EXPECT_TRUE(packet_buffer_->InsertPacket(packet));
265 EXPECT_TRUE(packet_buffer_->InsertPacket(packet)); 265 EXPECT_TRUE(packet_buffer_->InsertPacket(packet));
266 } 266 }
267 267
268 TEST_F(TestPacketBuffer, NackCount) {
269 uint16_t seq_num = Rand();
270
271 VCMPacket packet;
272 packet.codec = kVideoCodecGeneric;
273 packet.seqNum = seq_num;
274 packet.frameType = kVideoFrameKey;
275 packet.isFirstPacket = true;
276 packet.markerBit = false;
277 packet.sizeBytes = 0;
278 packet.dataPtr = nullptr;
279
280 packet_buffer_->InsertPacket(packet, 0);
281
282 packet.seqNum++;
283 packet.isFirstPacket = false;
284 packet_buffer_->InsertPacket(packet, 1);
285
286 packet.seqNum++;
287 packet_buffer_->InsertPacket(packet, 3);
288
289 packet.seqNum++;
290 packet.markerBit = true;
291 packet_buffer_->InsertPacket(packet, 0);
292
293
294 ASSERT_EQ(1UL, frames_from_callback_.size());
295 FrameObject* frame = frames_from_callback_.begin()->second.get();
296 RtpFrameObject* rtpFrame = static_cast<RtpFrameObject*>(frame);
stefan-webrtc 2016/05/20 13:10:23 rtp_frame
philipel 2016/05/23 09:19:22 Done.
297 EXPECT_EQ(3, rtpFrame->max_nack_count());
298 }
299
300 TEST_F(TestPacketBuffer, FrameSize) {
301 uint16_t seq_num = Rand();
302 uint8_t data[] = {1, 2, 3, 4, 5};
303
304 // seq_num , kf, frst, lst, size, data
stefan-webrtc 2016/05/20 13:10:23 Not very nicely aligned with the calls below :) Ma
philipel 2016/05/23 09:19:22 Aligned!
305 InsertGeneric(seq_num , kT, kT, kF, 5, data);
306 InsertGeneric(seq_num + 1, kT, kF, kF, 5, data);
307 InsertGeneric(seq_num + 2, kT, kF, kF, 5, data);
308 InsertGeneric(seq_num + 3, kT, kF, kT, 5, data);
309
310 ASSERT_EQ(1UL, frames_from_callback_.size());
311 EXPECT_EQ(20UL, frames_from_callback_.begin()->second->size);
312 }
313
268 TEST_F(TestPacketBuffer, ExpandBuffer) { 314 TEST_F(TestPacketBuffer, ExpandBuffer) {
269 uint16_t seq_num = Rand(); 315 uint16_t seq_num = Rand();
270 316
271 for (int i = 0; i < kStartSize + 1; ++i) { 317 for (int i = 0; i < kStartSize + 1; ++i) {
272 // seq_num , kf, frst, lst 318 // seq_num , kf, frst, lst
273 InsertGeneric(seq_num + i, kT , kT, kT); 319 InsertGeneric(seq_num + i, kT, kT , kT);
274 } 320 }
275 } 321 }
276 322
277 TEST_F(TestPacketBuffer, ExpandBufferOverflow) { 323 TEST_F(TestPacketBuffer, ExpandBufferOverflow) {
278 uint16_t seq_num = Rand(); 324 uint16_t seq_num = Rand();
279 325
280 for (int i = 0; i < kMaxSize; ++i) { 326 for (int i = 0; i < kMaxSize; ++i) {
281 // seq_num , kf, frst, lst 327 // seq_num , kf, frst, lst
282 InsertGeneric(seq_num + i, kT, kT , kT); 328 InsertGeneric(seq_num + i, kT, kT , kT);
283 } 329 }
(...skipping 1114 matching lines...) Expand 10 before | Expand all | Expand 10 after
1398 CheckReferencesVp9(pid + 5, 1, pid + 4); 1444 CheckReferencesVp9(pid + 5, 1, pid + 4);
1399 CheckReferencesVp9(pid + 6, 0, pid + 4); 1445 CheckReferencesVp9(pid + 6, 0, pid + 4);
1400 CheckReferencesVp9(pid + 6, 1, pid + 5); 1446 CheckReferencesVp9(pid + 6, 1, pid + 5);
1401 CheckReferencesVp9(pid + 7, 1, pid + 6); 1447 CheckReferencesVp9(pid + 7, 1, pid + 6);
1402 CheckReferencesVp9(pid + 8, 0, pid + 6); 1448 CheckReferencesVp9(pid + 8, 0, pid + 6);
1403 CheckReferencesVp9(pid + 8, 1, pid + 7); 1449 CheckReferencesVp9(pid + 8, 1, pid + 7);
1404 } 1450 }
1405 1451
1406 } // namespace video_coding 1452 } // namespace video_coding
1407 } // namespace webrtc 1453 } // 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