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

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

Issue 2641463002: Unit test out of band H264 SPS,PPS within RtpStreamReceiver. (Closed)
Patch Set: Created 3 years, 11 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 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 expected.insert(expected.end(), {H264::NaluType::kSps, 13}); 254 expected.insert(expected.end(), {H264::NaluType::kSps, 13});
255 expected.insert(expected.end(), start_code, start_code + sizeof(start_code)); 255 expected.insert(expected.end(), start_code, start_code + sizeof(start_code));
256 expected.insert(expected.end(), {H264::NaluType::kPps, 27}); 256 expected.insert(expected.end(), {H264::NaluType::kPps, 27});
257 expected.insert(expected.end(), start_code, start_code + sizeof(start_code)); 257 expected.insert(expected.end(), start_code, start_code + sizeof(start_code));
258 expected.insert(expected.end(), {1, 2, 3, 2, 1}); 258 expected.insert(expected.end(), {1, 2, 3, 2, 1});
259 259
260 EXPECT_EQ(memcmp(packet.dataPtr, expected.data(), expected.size()), 0); 260 EXPECT_EQ(memcmp(packet.dataPtr, expected.data(), expected.size()), 0);
261 delete[] packet.dataPtr; 261 delete[] packet.dataPtr;
262 } 262 }
263 263
264 TEST_F(TestH264SpsPpsTracker, SpsPpsOutOfBand) {
265 std::vector<uint8_t> data;
266
267 // Generated by "ffmpeg -r 30 -f avfoundation -i "default" out.h264" on macos.
268 const std::vector<uint8_t> sps(
269 {0x67, 0x7a, 0x00, 0x0d, 0xbc, 0xd9, 0x41, 0x41, 0xfa, 0x10, 0x00, 0x00,
270 0x03, 0x00, 0x10, 0x00, 0x00, 0x03, 0x03, 0xc0, 0xf1, 0x42, 0x99, 0x60});
271 const std::vector<uint8_t> pps({0x68, 0xeb, 0xe3, 0xcb, 0x22, 0xc0});
272 tracker_.InsertSpsPpsNalus(sps, pps);
273
274 // Insert first packet of the IDR
275 VCMPacket idr_packet = GetDefaultPacket();
276 idr_packet.video_header.is_first_packet_in_frame = true;
277 AddIdr(&idr_packet, 0);
278 data.insert(data.end(), {1, 2, 3});
279 idr_packet.dataPtr = data.data();
280 idr_packet.sizeBytes = data.size();
281 ASSERT_EQ(H264SpsPpsTracker::kInsert,
282 tracker_.CopyAndFixBitstream(&idr_packet));
283 delete[] idr_packet.dataPtr;
284 }
285
264 } // namespace video_coding 286 } // namespace video_coding
265 } // namespace webrtc 287 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698