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

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

Issue 2589783003: Revert of Rename RTPVideoHeader.isFirstPacket to .is_first_packet_in_frame. (Closed)
Patch Set: Created 4 years 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 bool Insert(uint16_t seq_num, // packet sequence number 52 bool Insert(uint16_t seq_num, // packet sequence number
53 IsKeyFrame keyframe, // is keyframe 53 IsKeyFrame keyframe, // is keyframe
54 IsFirst first, // is first packet of frame 54 IsFirst first, // is first packet of frame
55 IsLast last, // is last packet of frame 55 IsLast last, // is last packet of frame
56 int data_size = 0, // size of data 56 int data_size = 0, // size of data
57 uint8_t* data = nullptr) { // data pointer 57 uint8_t* data = nullptr) { // data pointer
58 VCMPacket packet; 58 VCMPacket packet;
59 packet.codec = kVideoCodecGeneric; 59 packet.codec = kVideoCodecGeneric;
60 packet.seqNum = seq_num; 60 packet.seqNum = seq_num;
61 packet.frameType = keyframe ? kVideoFrameKey : kVideoFrameDelta; 61 packet.frameType = keyframe ? kVideoFrameKey : kVideoFrameDelta;
62 packet.is_first_packet_in_frame = first == kFirst; 62 packet.isFirstPacket = first == kFirst;
63 packet.markerBit = last == kLast; 63 packet.markerBit = last == kLast;
64 packet.sizeBytes = data_size; 64 packet.sizeBytes = data_size;
65 packet.dataPtr = data; 65 packet.dataPtr = data;
66 66
67 return packet_buffer_->InsertPacket(&packet); 67 return packet_buffer_->InsertPacket(&packet);
68 } 68 }
69 69
70 void CheckFrame(uint16_t first_seq_num) { 70 void CheckFrame(uint16_t first_seq_num) {
71 auto frame_it = frames_from_callback_.find(first_seq_num); 71 auto frame_it = frames_from_callback_.find(first_seq_num);
72 ASSERT_FALSE(frame_it == frames_from_callback_.end()) 72 ASSERT_FALSE(frame_it == frames_from_callback_.end())
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 ASSERT_EQ(2UL, frames_from_callback_.size()); 131 ASSERT_EQ(2UL, frames_from_callback_.size());
132 } 132 }
133 133
134 TEST_F(TestPacketBuffer, NackCount) { 134 TEST_F(TestPacketBuffer, NackCount) {
135 const uint16_t seq_num = Rand(); 135 const uint16_t seq_num = Rand();
136 136
137 VCMPacket packet; 137 VCMPacket packet;
138 packet.codec = kVideoCodecGeneric; 138 packet.codec = kVideoCodecGeneric;
139 packet.seqNum = seq_num; 139 packet.seqNum = seq_num;
140 packet.frameType = kVideoFrameKey; 140 packet.frameType = kVideoFrameKey;
141 packet.is_first_packet_in_frame = true; 141 packet.isFirstPacket = true;
142 packet.markerBit = false; 142 packet.markerBit = false;
143 packet.timesNacked = 0; 143 packet.timesNacked = 0;
144 144
145 packet_buffer_->InsertPacket(&packet); 145 packet_buffer_->InsertPacket(&packet);
146 146
147 packet.seqNum++; 147 packet.seqNum++;
148 packet.is_first_packet_in_frame = false; 148 packet.isFirstPacket = false;
149 packet.timesNacked = 1; 149 packet.timesNacked = 1;
150 packet_buffer_->InsertPacket(&packet); 150 packet_buffer_->InsertPacket(&packet);
151 151
152 packet.seqNum++; 152 packet.seqNum++;
153 packet.timesNacked = 3; 153 packet.timesNacked = 3;
154 packet_buffer_->InsertPacket(&packet); 154 packet_buffer_->InsertPacket(&packet);
155 155
156 packet.seqNum++; 156 packet.seqNum++;
157 packet.markerBit = true; 157 packet.markerBit = true;
158 packet.timesNacked = 1; 158 packet.timesNacked = 1;
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
356 std::unique_ptr<uint8_t[]> result( 356 std::unique_ptr<uint8_t[]> result(
357 new uint8_t[sizeof(data_data) + EncodedImage::kBufferPaddingBytesH264]); 357 new uint8_t[sizeof(data_data) + EncodedImage::kBufferPaddingBytesH264]);
358 358
359 VCMPacket packet; 359 VCMPacket packet;
360 packet.seqNum = seq_num; 360 packet.seqNum = seq_num;
361 packet.codec = kVideoCodecH264; 361 packet.codec = kVideoCodecH264;
362 packet.insertStartCode = true; 362 packet.insertStartCode = true;
363 packet.video_header.codecHeader.H264.packetization_type = kH264SingleNalu; 363 packet.video_header.codecHeader.H264.packetization_type = kH264SingleNalu;
364 packet.dataPtr = data; 364 packet.dataPtr = data;
365 packet.sizeBytes = sizeof(data_data); 365 packet.sizeBytes = sizeof(data_data);
366 packet.is_first_packet_in_frame = true; 366 packet.isFirstPacket = true;
367 packet.markerBit = true; 367 packet.markerBit = true;
368 packet_buffer_->InsertPacket(&packet); 368 packet_buffer_->InsertPacket(&packet);
369 369
370 ASSERT_EQ(1UL, frames_from_callback_.size()); 370 ASSERT_EQ(1UL, frames_from_callback_.size());
371 EXPECT_EQ(frames_from_callback_[seq_num]->EncodedImage()._length, 371 EXPECT_EQ(frames_from_callback_[seq_num]->EncodedImage()._length,
372 sizeof(data_data)); 372 sizeof(data_data));
373 EXPECT_EQ(frames_from_callback_[seq_num]->EncodedImage()._size, 373 EXPECT_EQ(frames_from_callback_[seq_num]->EncodedImage()._size,
374 sizeof(data_data) + EncodedImage::kBufferPaddingBytesH264); 374 sizeof(data_data) + EncodedImage::kBufferPaddingBytesH264);
375 EXPECT_TRUE(frames_from_callback_[seq_num]->GetBitstream(result.get())); 375 EXPECT_TRUE(frames_from_callback_[seq_num]->GetBitstream(result.get()));
376 EXPECT_EQ(memcmp(result.get(), data, sizeof(data_data)), 0); 376 EXPECT_EQ(memcmp(result.get(), data, sizeof(data_data)), 0);
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
455 // Expect to free data3 upon insertion (old packet). 455 // Expect to free data3 upon insertion (old packet).
456 packet_buffer_->ClearTo(1); 456 packet_buffer_->ClearTo(1);
457 EXPECT_FALSE(Insert(1, kKeyFrame, kFirst, kNotLast, 5, data3)); 457 EXPECT_FALSE(Insert(1, kKeyFrame, kFirst, kNotLast, 5, data3));
458 458
459 // Expect to free data4 upon insertion (packet buffer is full). 459 // Expect to free data4 upon insertion (packet buffer is full).
460 EXPECT_FALSE(Insert(2 + kMaxSize, kKeyFrame, kFirst, kNotLast, 5, data4)); 460 EXPECT_FALSE(Insert(2 + kMaxSize, kKeyFrame, kFirst, kNotLast, 5, data4));
461 } 461 }
462 462
463 } // namespace video_coding 463 } // namespace video_coding
464 } // namespace webrtc 464 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698