OLD | NEW |
---|---|
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 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
320 // Insert first packet of the IDR. | 320 // Insert first packet of the IDR. |
321 VCMPacket idr_packet = GetDefaultPacket(); | 321 VCMPacket idr_packet = GetDefaultPacket(); |
322 idr_packet.video_header.is_first_packet_in_frame = true; | 322 idr_packet.video_header.is_first_packet_in_frame = true; |
323 AddIdr(&idr_packet, 0); | 323 AddIdr(&idr_packet, 0); |
324 idr_packet.dataPtr = kData; | 324 idr_packet.dataPtr = kData; |
325 idr_packet.sizeBytes = sizeof(kData); | 325 idr_packet.sizeBytes = sizeof(kData); |
326 EXPECT_EQ(H264SpsPpsTracker::kRequestKeyframe, | 326 EXPECT_EQ(H264SpsPpsTracker::kRequestKeyframe, |
327 tracker_.CopyAndFixBitstream(&idr_packet)); | 327 tracker_.CopyAndFixBitstream(&idr_packet)); |
328 } | 328 } |
329 | 329 |
330 TEST_F(TestH264SpsPpsTracker, SaveRestoreWidthHeight) { | |
331 std::vector<uint8_t> data; | |
332 | |
333 // Insert an SPS/PPS packet with widht/height and make sure | |
stefan-webrtc
2017/03/14 10:32:20
width
philipel
2017/03/14 11:51:12
Done.
| |
334 // that information is set on the first IDR packet. | |
335 VCMPacket sps_pps_packet1 = GetDefaultPacket(); | |
336 AddSps(&sps_pps_packet1, 0, &data); | |
337 AddPps(&sps_pps_packet1, 0, 1, &data); | |
338 sps_pps_packet1.dataPtr = data.data(); | |
339 sps_pps_packet1.sizeBytes = data.size(); | |
340 sps_pps_packet1.width = 320; | |
341 sps_pps_packet1.height = 240; | |
342 EXPECT_EQ(H264SpsPpsTracker::kDrop, | |
stefan-webrtc
2017/03/14 10:32:20
Can you clarify why this is dropped?
philipel
2017/03/14 11:51:12
Since this packet only contains SPS/PPS we don't w
| |
343 tracker_.CopyAndFixBitstream(&sps_pps_packet1)); | |
344 | |
345 VCMPacket idr_packet1 = GetDefaultPacket(); | |
346 idr_packet1.video_header.is_first_packet_in_frame = true; | |
347 AddIdr(&idr_packet1, 1); | |
348 data.insert(data.end(), {1, 2, 3}); | |
349 idr_packet1.dataPtr = data.data(); | |
350 idr_packet1.sizeBytes = data.size(); | |
351 EXPECT_EQ(H264SpsPpsTracker::kInsert, | |
352 tracker_.CopyAndFixBitstream(&idr_packet1)); | |
353 | |
354 EXPECT_EQ(320, idr_packet1.width); | |
355 EXPECT_EQ(240, idr_packet1.height); | |
356 delete[] idr_packet1.dataPtr; | |
357 | |
358 // Insert an SPS/PPS packet without widht/height and make sure | |
359 // widht/height is not overwritten by the tracker. | |
stefan-webrtc
2017/03/14 10:32:20
width
philipel
2017/03/14 11:51:12
Done.
| |
360 VCMPacket sps_pps_packet2 = GetDefaultPacket(); | |
361 AddSps(&sps_pps_packet2, 1, &data); | |
362 AddPps(&sps_pps_packet2, 1, 2, &data); | |
363 sps_pps_packet2.dataPtr = data.data(); | |
364 sps_pps_packet2.sizeBytes = data.size(); | |
365 EXPECT_EQ(H264SpsPpsTracker::kDrop, | |
366 tracker_.CopyAndFixBitstream(&sps_pps_packet2)); | |
367 | |
368 VCMPacket idr_packet2 = GetDefaultPacket(); | |
369 idr_packet2.video_header.is_first_packet_in_frame = true; | |
370 AddIdr(&idr_packet2, 2); | |
371 data.insert(data.end(), {1, 2, 3}); | |
372 idr_packet2.dataPtr = data.data(); | |
373 idr_packet2.sizeBytes = data.size(); | |
374 idr_packet2.width = 1280; | |
375 idr_packet2.height = 720; | |
376 EXPECT_EQ(H264SpsPpsTracker::kInsert, | |
377 tracker_.CopyAndFixBitstream(&idr_packet2)); | |
378 | |
379 EXPECT_EQ(1280, idr_packet2.width); | |
380 EXPECT_EQ(720, idr_packet2.height); | |
381 delete[] idr_packet2.dataPtr; | |
382 } | |
383 | |
330 } // namespace video_coding | 384 } // namespace video_coding |
331 } // namespace webrtc | 385 } // namespace webrtc |
OLD | NEW |