| Index: webrtc/modules/video_coding/h264_sps_pps_tracker_unittest.cc
|
| diff --git a/webrtc/modules/video_coding/h264_sps_pps_tracker_unittest.cc b/webrtc/modules/video_coding/h264_sps_pps_tracker_unittest.cc
|
| index 9d4d64f97e7bba301b3aa740186ece176b2d2a4c..a7cec21e619ca5a8434cd43c3d20176fdc67e6ec 100644
|
| --- a/webrtc/modules/video_coding/h264_sps_pps_tracker_unittest.cc
|
| +++ b/webrtc/modules/video_coding/h264_sps_pps_tracker_unittest.cc
|
| @@ -265,6 +265,7 @@ TEST_F(TestH264SpsPpsTracker, SpsPpsOutOfBand) {
|
| constexpr uint8_t kData[] = {1, 2, 3};
|
|
|
| // Generated by "ffmpeg -r 30 -f avfoundation -i "default" out.h264" on macos.
|
| + // width: 320, height: 240
|
| const std::vector<uint8_t> sps(
|
| {0x67, 0x7a, 0x00, 0x0d, 0xbc, 0xd9, 0x41, 0x41, 0xfa, 0x10, 0x00, 0x00,
|
| 0x03, 0x00, 0x10, 0x00, 0x00, 0x03, 0x03, 0xc0, 0xf1, 0x42, 0x99, 0x60});
|
| @@ -279,6 +280,8 @@ TEST_F(TestH264SpsPpsTracker, SpsPpsOutOfBand) {
|
| idr_packet.sizeBytes = sizeof(kData);
|
| EXPECT_EQ(H264SpsPpsTracker::kInsert,
|
| tracker_.CopyAndFixBitstream(&idr_packet));
|
| + EXPECT_EQ(320, idr_packet.width);
|
| + EXPECT_EQ(240, idr_packet.height);
|
| if (idr_packet.dataPtr != kData) {
|
| // In case CopyAndFixBitStream() prepends SPS/PPS nalus to the packet, it
|
| // uses new uint8_t[] to allocate memory. Caller of CopyAndFixBitStream()
|
| @@ -327,5 +330,34 @@ TEST_F(TestH264SpsPpsTracker, SpsPpsOutOfBandIncompleteNalu) {
|
| tracker_.CopyAndFixBitstream(&idr_packet));
|
| }
|
|
|
| +TEST_F(TestH264SpsPpsTracker, SaveRestoreWidthHeight) {
|
| + std::vector<uint8_t> data;
|
| +
|
| + // Insert an SPS/PPS packet with width/height and make sure
|
| + // that information is set on the first IDR packet.
|
| + VCMPacket sps_pps_packet1 = GetDefaultPacket();
|
| + AddSps(&sps_pps_packet1, 0, &data);
|
| + AddPps(&sps_pps_packet1, 0, 1, &data);
|
| + sps_pps_packet1.dataPtr = data.data();
|
| + sps_pps_packet1.sizeBytes = data.size();
|
| + sps_pps_packet1.width = 320;
|
| + sps_pps_packet1.height = 240;
|
| + EXPECT_EQ(H264SpsPpsTracker::kDrop,
|
| + tracker_.CopyAndFixBitstream(&sps_pps_packet1));
|
| +
|
| + VCMPacket idr_packet1 = GetDefaultPacket();
|
| + idr_packet1.video_header.is_first_packet_in_frame = true;
|
| + AddIdr(&idr_packet1, 1);
|
| + data.insert(data.end(), {1, 2, 3});
|
| + idr_packet1.dataPtr = data.data();
|
| + idr_packet1.sizeBytes = data.size();
|
| + EXPECT_EQ(H264SpsPpsTracker::kInsert,
|
| + tracker_.CopyAndFixBitstream(&idr_packet1));
|
| +
|
| + EXPECT_EQ(320, idr_packet1.width);
|
| + EXPECT_EQ(240, idr_packet1.height);
|
| + delete[] idr_packet1.dataPtr;
|
| +}
|
| +
|
| } // namespace video_coding
|
| } // namespace webrtc
|
|
|