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

Side by Side Diff: webrtc/modules/rtp_rtcp/source/rtp_format_h264_unittest.cc

Issue 1979443004: Add H264 bitstream rewriting to limit frame reordering marker in header (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Fixed compiler warning on win Created 4 years, 7 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) 2014 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2014 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 396 matching lines...) Expand 10 before | Expand all | Expand 10 after
407 EXPECT_EQ(kRtpVideoH264, payload.type.Video.codec); 407 EXPECT_EQ(kRtpVideoH264, payload.type.Video.codec);
408 EXPECT_TRUE(payload.type.Video.isFirstPacket); 408 EXPECT_TRUE(payload.type.Video.isFirstPacket);
409 EXPECT_EQ(kH264SingleNalu, 409 EXPECT_EQ(kH264SingleNalu,
410 payload.type.Video.codecHeader.H264.packetization_type); 410 payload.type.Video.codecHeader.H264.packetization_type);
411 EXPECT_EQ(kIdr, payload.type.Video.codecHeader.H264.nalu_type); 411 EXPECT_EQ(kIdr, payload.type.Video.codecHeader.H264.nalu_type);
412 } 412 }
413 413
414 TEST_F(RtpDepacketizerH264Test, TestSingleNaluSpsWithResolution) { 414 TEST_F(RtpDepacketizerH264Test, TestSingleNaluSpsWithResolution) {
415 uint8_t packet[] = {kSps, 0x7A, 0x00, 0x1F, 0xBC, 0xD9, 0x40, 0x50, 415 uint8_t packet[] = {kSps, 0x7A, 0x00, 0x1F, 0xBC, 0xD9, 0x40, 0x50,
416 0x05, 0xBA, 0x10, 0x00, 0x00, 0x03, 0x00, 0xC0, 416 0x05, 0xBA, 0x10, 0x00, 0x00, 0x03, 0x00, 0xC0,
417 0x00, 0x00, 0x2A, 0xE0, 0xF1, 0x83, 0x19, 0x60}; 417 0x00, 0x00, 0x03, 0x2A, 0xE0, 0xF1, 0x83, 0x25};
stefan-webrtc 2016/05/22 23:11:50 Why did this change?
sprang_webrtc 2016/05/25 09:06:03 Parsing revealed that VUI contained: max_num_reord
418 RtpDepacketizer::ParsedPayload payload; 418 RtpDepacketizer::ParsedPayload payload;
419 419
420 ASSERT_TRUE(depacketizer_->Parse(&payload, packet, sizeof(packet))); 420 ASSERT_TRUE(depacketizer_->Parse(&payload, packet, sizeof(packet)));
421 ExpectPacket(&payload, packet, sizeof(packet)); 421 ExpectPacket(&payload, packet, sizeof(packet));
422 EXPECT_EQ(kVideoFrameKey, payload.frame_type); 422 EXPECT_EQ(kVideoFrameKey, payload.frame_type);
423 EXPECT_EQ(kRtpVideoH264, payload.type.Video.codec); 423 EXPECT_EQ(kRtpVideoH264, payload.type.Video.codec);
424 EXPECT_TRUE(payload.type.Video.isFirstPacket); 424 EXPECT_TRUE(payload.type.Video.isFirstPacket);
425 EXPECT_EQ(kH264SingleNalu, 425 EXPECT_EQ(kH264SingleNalu,
426 payload.type.Video.codecHeader.H264.packetization_type); 426 payload.type.Video.codecHeader.H264.packetization_type);
427 EXPECT_EQ(1280u, payload.type.Video.width); 427 EXPECT_EQ(1280u, payload.type.Video.width);
(...skipping 14 matching lines...) Expand all
442 EXPECT_EQ(kRtpVideoH264, payload.type.Video.codec); 442 EXPECT_EQ(kRtpVideoH264, payload.type.Video.codec);
443 EXPECT_TRUE(payload.type.Video.isFirstPacket); 443 EXPECT_TRUE(payload.type.Video.isFirstPacket);
444 EXPECT_EQ(kH264StapA, payload.type.Video.codecHeader.H264.packetization_type); 444 EXPECT_EQ(kH264StapA, payload.type.Video.codecHeader.H264.packetization_type);
445 // NALU type for aggregated packets is the type of the first packet only. 445 // NALU type for aggregated packets is the type of the first packet only.
446 EXPECT_EQ(kSps, payload.type.Video.codecHeader.H264.nalu_type); 446 EXPECT_EQ(kSps, payload.type.Video.codecHeader.H264.nalu_type);
447 } 447 }
448 448
449 TEST_F(RtpDepacketizerH264Test, TestStapANaluSpsWithResolution) { 449 TEST_F(RtpDepacketizerH264Test, TestStapANaluSpsWithResolution) {
450 uint8_t packet[] = {kStapA, // F=0, NRI=0, Type=24. 450 uint8_t packet[] = {kStapA, // F=0, NRI=0, Type=24.
451 // Length (2 bytes), nal header, payload. 451 // Length (2 bytes), nal header, payload.
452 0, 24, kSps, 0x7A, 0x00, 0x1F, 0xBC, 0xD9, 452 0x00, 0x19, kSps, 0x7A, 0x00, 0x1F, 0xBC, 0xD9, 0x40,
453 0x40, 0x50, 0x05, 0xBA, 0x10, 0x00, 0x00, 0x03, 453 0x50, 0x05, 0xBA, 0x10, 0x00, 0x00, 0x03, 0x00, 0xC0,
454 0x00, 0xC0, 0x00, 0x00, 0x2A, 0xE0, 0xF1, 0x83, 454 0x00, 0x00, 0x03, 0x2A, 0xE0, 0xF1, 0x83, 0x25, 0x80,
455 0x19, 0x60, 0, 0x03, kIdr, 0xFF, 0x00, 0, 455 0x00, 0x03, kIdr, 0xFF, 0x00, 0x00, 0x04, kIdr, 0xFF,
456 0x04, kIdr, 0xFF, 0x00, 0x11}; 456 0x00, 0x11};
stefan-webrtc 2016/05/22 23:11:50 ... and this?
sprang_webrtc 2016/05/25 09:06:03 ...same here. How did you come up with these magic
stefan-webrtc 2016/05/26 18:08:13 I think pbos added these.
noahric 2016/05/26 18:56:52 And I think they came from my code originally, whi
457
457 RtpDepacketizer::ParsedPayload payload; 458 RtpDepacketizer::ParsedPayload payload;
458 459
459 ASSERT_TRUE(depacketizer_->Parse(&payload, packet, sizeof(packet))); 460 ASSERT_TRUE(depacketizer_->Parse(&payload, packet, sizeof(packet)));
460 ExpectPacket(&payload, packet, sizeof(packet)); 461 ExpectPacket(&payload, packet, sizeof(packet));
461 EXPECT_EQ(kVideoFrameKey, payload.frame_type); 462 EXPECT_EQ(kVideoFrameKey, payload.frame_type);
462 EXPECT_EQ(kRtpVideoH264, payload.type.Video.codec); 463 EXPECT_EQ(kRtpVideoH264, payload.type.Video.codec);
463 EXPECT_TRUE(payload.type.Video.isFirstPacket); 464 EXPECT_TRUE(payload.type.Video.isFirstPacket);
464 EXPECT_EQ(kH264StapA, payload.type.Video.codecHeader.H264.packetization_type); 465 EXPECT_EQ(kH264StapA, payload.type.Video.codecHeader.H264.packetization_type);
465 EXPECT_EQ(1280u, payload.type.Video.width); 466 EXPECT_EQ(1280u, payload.type.Video.width);
466 EXPECT_EQ(720u, payload.type.Video.height); 467 EXPECT_EQ(720u, payload.type.Video.height);
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
561 const uint8_t kPayload[] = {0x38, 0x27, 0x27}; 562 const uint8_t kPayload[] = {0x38, 0x27, 0x27};
562 RtpDepacketizer::ParsedPayload payload; 563 RtpDepacketizer::ParsedPayload payload;
563 EXPECT_FALSE(depacketizer_->Parse(&payload, kPayload, sizeof(kPayload))); 564 EXPECT_FALSE(depacketizer_->Parse(&payload, kPayload, sizeof(kPayload)));
564 } 565 }
565 566
566 TEST_F(RtpDepacketizerH264Test, TestShortSpsPacket) { 567 TEST_F(RtpDepacketizerH264Test, TestShortSpsPacket) {
567 const uint8_t kPayload[] = {0x27, 0x80, 0x00}; 568 const uint8_t kPayload[] = {0x27, 0x80, 0x00};
568 RtpDepacketizer::ParsedPayload payload; 569 RtpDepacketizer::ParsedPayload payload;
569 EXPECT_TRUE(depacketizer_->Parse(&payload, kPayload, sizeof(kPayload))); 570 EXPECT_TRUE(depacketizer_->Parse(&payload, kPayload, sizeof(kPayload)));
570 } 571 }
571 572
stefan-webrtc 2016/05/22 23:11:50 Would be good with explicit test cases for the sps
sprang_webrtc 2016/05/25 09:06:03 Yes, in the pipeline.
572 } // namespace webrtc 573 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698