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

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

Issue 2381233004: Revert of Use sps and pps to determine decodability of H.264 frames. (Closed)
Patch Set: Created 4 years, 2 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 753 matching lines...) Expand 10 before | Expand all | Expand 10 after
764 payload = RtpDepacketizer::ParsedPayload(); 764 payload = RtpDepacketizer::ParsedPayload();
765 ASSERT_TRUE(depacketizer_->Parse(&payload, packet2, sizeof(packet2))); 765 ASSERT_TRUE(depacketizer_->Parse(&payload, packet2, sizeof(packet2)));
766 ExpectPacket(&payload, kExpected2, sizeof(kExpected2)); 766 ExpectPacket(&payload, kExpected2, sizeof(kExpected2));
767 EXPECT_EQ(kVideoFrameKey, payload.frame_type); 767 EXPECT_EQ(kVideoFrameKey, payload.frame_type);
768 EXPECT_EQ(kRtpVideoH264, payload.type.Video.codec); 768 EXPECT_EQ(kRtpVideoH264, payload.type.Video.codec);
769 EXPECT_FALSE(payload.type.Video.isFirstPacket); 769 EXPECT_FALSE(payload.type.Video.isFirstPacket);
770 { 770 {
771 const RTPVideoHeaderH264& h264 = payload.type.Video.codecHeader.H264; 771 const RTPVideoHeaderH264& h264 = payload.type.Video.codecHeader.H264;
772 EXPECT_EQ(kH264FuA, h264.packetization_type); 772 EXPECT_EQ(kH264FuA, h264.packetization_type);
773 EXPECT_EQ(kIdr, h264.nalu_type); 773 EXPECT_EQ(kIdr, h264.nalu_type);
774 // NALU info is only expected for the first FU-A packet. 774 ASSERT_EQ(1u, h264.nalus_length);
775 EXPECT_EQ(0u, h264.nalus_length); 775 EXPECT_EQ(static_cast<H264::NaluType>(kIdr), h264.nalus[0].type);
776 EXPECT_EQ(-1, h264.nalus[0].sps_id);
777 EXPECT_EQ(-1, h264.nalus[0].pps_id);
776 } 778 }
777 779
778 payload = RtpDepacketizer::ParsedPayload(); 780 payload = RtpDepacketizer::ParsedPayload();
779 ASSERT_TRUE(depacketizer_->Parse(&payload, packet3, sizeof(packet3))); 781 ASSERT_TRUE(depacketizer_->Parse(&payload, packet3, sizeof(packet3)));
780 ExpectPacket(&payload, kExpected3, sizeof(kExpected3)); 782 ExpectPacket(&payload, kExpected3, sizeof(kExpected3));
781 EXPECT_EQ(kVideoFrameKey, payload.frame_type); 783 EXPECT_EQ(kVideoFrameKey, payload.frame_type);
782 EXPECT_EQ(kRtpVideoH264, payload.type.Video.codec); 784 EXPECT_EQ(kRtpVideoH264, payload.type.Video.codec);
783 EXPECT_FALSE(payload.type.Video.isFirstPacket); 785 EXPECT_FALSE(payload.type.Video.isFirstPacket);
784 { 786 {
785 const RTPVideoHeaderH264& h264 = payload.type.Video.codecHeader.H264; 787 const RTPVideoHeaderH264& h264 = payload.type.Video.codecHeader.H264;
786 EXPECT_EQ(kH264FuA, h264.packetization_type); 788 EXPECT_EQ(kH264FuA, h264.packetization_type);
787 EXPECT_EQ(kIdr, h264.nalu_type); 789 EXPECT_EQ(kIdr, h264.nalu_type);
788 // NALU info is only expected for the first FU-A packet. 790 ASSERT_EQ(1u, h264.nalus_length);
789 ASSERT_EQ(0u, h264.nalus_length); 791 EXPECT_EQ(static_cast<H264::NaluType>(kIdr), h264.nalus[0].type);
792 EXPECT_EQ(-1, h264.nalus[0].sps_id);
793 EXPECT_EQ(-1, h264.nalus[0].pps_id);
790 } 794 }
791 } 795 }
792 796
793 TEST_F(RtpDepacketizerH264Test, TestEmptyPayload) { 797 TEST_F(RtpDepacketizerH264Test, TestEmptyPayload) {
794 // Using a wild pointer to crash on accesses from inside the depacketizer. 798 // Using a wild pointer to crash on accesses from inside the depacketizer.
795 uint8_t* garbage_ptr = reinterpret_cast<uint8_t*>(0x4711); 799 uint8_t* garbage_ptr = reinterpret_cast<uint8_t*>(0x4711);
796 RtpDepacketizer::ParsedPayload payload; 800 RtpDepacketizer::ParsedPayload payload;
797 EXPECT_FALSE(depacketizer_->Parse(&payload, garbage_ptr, 0)); 801 EXPECT_FALSE(depacketizer_->Parse(&payload, garbage_ptr, 0));
798 } 802 }
799 803
(...skipping 15 matching lines...) Expand all
815 EXPECT_FALSE(depacketizer_->Parse(&payload, kPayload, sizeof(kPayload))); 819 EXPECT_FALSE(depacketizer_->Parse(&payload, kPayload, sizeof(kPayload)));
816 } 820 }
817 821
818 TEST_F(RtpDepacketizerH264Test, TestShortSpsPacket) { 822 TEST_F(RtpDepacketizerH264Test, TestShortSpsPacket) {
819 const uint8_t kPayload[] = {0x27, 0x80, 0x00}; 823 const uint8_t kPayload[] = {0x27, 0x80, 0x00};
820 RtpDepacketizer::ParsedPayload payload; 824 RtpDepacketizer::ParsedPayload payload;
821 EXPECT_TRUE(depacketizer_->Parse(&payload, kPayload, sizeof(kPayload))); 825 EXPECT_TRUE(depacketizer_->Parse(&payload, kPayload, sizeof(kPayload)));
822 } 826 }
823 827
824 } // namespace webrtc 828 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/rtp_rtcp/source/rtp_format_h264.cc ('k') | webrtc/modules/video_coding/decoding_state.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698