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

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

Issue 2916433003: Check H264 NALUs for frametype and insert SPS/PPS packets into the PacketBuffer. (Closed)
Patch Set: Created 3 years, 6 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
« no previous file with comments | « webrtc/modules/video_coding/h264_sps_pps_tracker.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 191
192 TEST_F(TestH264SpsPpsTracker, SpsPpsPacketThenIdrFirstPacket) { 192 TEST_F(TestH264SpsPpsTracker, SpsPpsPacketThenIdrFirstPacket) {
193 std::vector<uint8_t> data; 193 std::vector<uint8_t> data;
194 VCMPacket sps_pps_packet = GetDefaultPacket(); 194 VCMPacket sps_pps_packet = GetDefaultPacket();
195 195
196 // Insert SPS/PPS 196 // Insert SPS/PPS
197 AddSps(&sps_pps_packet, 0, &data); 197 AddSps(&sps_pps_packet, 0, &data);
198 AddPps(&sps_pps_packet, 0, 1, &data); 198 AddPps(&sps_pps_packet, 0, 1, &data);
199 sps_pps_packet.dataPtr = data.data(); 199 sps_pps_packet.dataPtr = data.data();
200 sps_pps_packet.sizeBytes = data.size(); 200 sps_pps_packet.sizeBytes = data.size();
201 EXPECT_EQ(H264SpsPpsTracker::kDrop, 201 EXPECT_EQ(H264SpsPpsTracker::kInsert,
202 tracker_.CopyAndFixBitstream(&sps_pps_packet)); 202 tracker_.CopyAndFixBitstream(&sps_pps_packet));
203 data.clear(); 203 data.clear();
204 204
205 // Insert first packet of the IDR 205 // Insert first packet of the IDR
206 VCMPacket idr_packet = GetDefaultPacket(); 206 VCMPacket idr_packet = GetDefaultPacket();
207 idr_packet.video_header.is_first_packet_in_frame = true; 207 idr_packet.video_header.is_first_packet_in_frame = true;
208 AddIdr(&idr_packet, 1); 208 AddIdr(&idr_packet, 1);
209 data.insert(data.end(), {1, 2, 3}); 209 data.insert(data.end(), {1, 2, 3});
210 idr_packet.dataPtr = data.data(); 210 idr_packet.dataPtr = data.data();
211 idr_packet.sizeBytes = data.size(); 211 idr_packet.sizeBytes = data.size();
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 idr_packet.sizeBytes = sizeof(kData); 328 idr_packet.sizeBytes = sizeof(kData);
329 EXPECT_EQ(H264SpsPpsTracker::kRequestKeyframe, 329 EXPECT_EQ(H264SpsPpsTracker::kRequestKeyframe,
330 tracker_.CopyAndFixBitstream(&idr_packet)); 330 tracker_.CopyAndFixBitstream(&idr_packet));
331 } 331 }
332 332
333 TEST_F(TestH264SpsPpsTracker, SaveRestoreWidthHeight) { 333 TEST_F(TestH264SpsPpsTracker, SaveRestoreWidthHeight) {
334 std::vector<uint8_t> data; 334 std::vector<uint8_t> data;
335 335
336 // Insert an SPS/PPS packet with width/height and make sure 336 // Insert an SPS/PPS packet with width/height and make sure
337 // that information is set on the first IDR packet. 337 // that information is set on the first IDR packet.
338 VCMPacket sps_pps_packet1 = GetDefaultPacket(); 338 VCMPacket sps_pps_packet = GetDefaultPacket();
339 AddSps(&sps_pps_packet1, 0, &data); 339 AddSps(&sps_pps_packet, 0, &data);
340 AddPps(&sps_pps_packet1, 0, 1, &data); 340 AddPps(&sps_pps_packet, 0, 1, &data);
341 sps_pps_packet1.dataPtr = data.data(); 341 sps_pps_packet.dataPtr = data.data();
342 sps_pps_packet1.sizeBytes = data.size(); 342 sps_pps_packet.sizeBytes = data.size();
343 sps_pps_packet1.width = 320; 343 sps_pps_packet.width = 320;
344 sps_pps_packet1.height = 240; 344 sps_pps_packet.height = 240;
345 EXPECT_EQ(H264SpsPpsTracker::kDrop, 345 EXPECT_EQ(H264SpsPpsTracker::kInsert,
346 tracker_.CopyAndFixBitstream(&sps_pps_packet1)); 346 tracker_.CopyAndFixBitstream(&sps_pps_packet));
347 347
348 VCMPacket idr_packet1 = GetDefaultPacket(); 348 VCMPacket idr_packet = GetDefaultPacket();
349 idr_packet1.video_header.is_first_packet_in_frame = true; 349 idr_packet.video_header.is_first_packet_in_frame = true;
350 AddIdr(&idr_packet1, 1); 350 AddIdr(&idr_packet, 1);
351 data.insert(data.end(), {1, 2, 3}); 351 data.insert(data.end(), {1, 2, 3});
352 idr_packet1.dataPtr = data.data(); 352 idr_packet.dataPtr = data.data();
353 idr_packet1.sizeBytes = data.size(); 353 idr_packet.sizeBytes = data.size();
354 EXPECT_EQ(H264SpsPpsTracker::kInsert, 354 EXPECT_EQ(H264SpsPpsTracker::kInsert,
355 tracker_.CopyAndFixBitstream(&idr_packet1)); 355 tracker_.CopyAndFixBitstream(&idr_packet));
356 356
357 EXPECT_EQ(320, idr_packet1.width); 357 EXPECT_EQ(320, idr_packet.width);
358 EXPECT_EQ(240, idr_packet1.height); 358 EXPECT_EQ(240, idr_packet.height);
359 delete[] idr_packet1.dataPtr; 359 delete[] idr_packet.dataPtr;
360 } 360 }
361 361
362 } // namespace video_coding 362 } // namespace video_coding
363 } // namespace webrtc 363 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/video_coding/h264_sps_pps_tracker.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698