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 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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; | |
sprang_webrtc
2017/01/18 09:34:05
Looks like you don't really need a vector here. If
johan
2017/01/18 10:42:55
Acknowledged.
| |
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}); | |
sprang_webrtc
2017/01/18 09:34:05
Is there any data baked in here that's worth check
johan
2017/01/18 10:42:55
SpsPpsTracker itself checks only the nalu headers.
| |
272 tracker_.InsertSpsPpsNalus(sps, pps); | |
273 | |
274 // Insert first packet of the IDR | |
sprang_webrtc
2017/01/18 09:34:05
Nit: End with comments with period.
johan
2017/01/18 10:42:55
Acknowledged.
| |
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 |
OLD | NEW |