OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2015 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 671 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
682 ParseAndCheckPacket(packet, expected_, kHeaderLength, sizeof(packet)); | 682 ParseAndCheckPacket(packet, expected_, kHeaderLength, sizeof(packet)); |
683 } | 683 } |
684 | 684 |
685 TEST_F(RtpDepacketizerVp9Test, ParseFirstPacketInKeyFrame) { | 685 TEST_F(RtpDepacketizerVp9Test, ParseFirstPacketInKeyFrame) { |
686 uint8_t packet[2] = {0}; | 686 uint8_t packet[2] = {0}; |
687 packet[0] = 0x08; // I:0 P:0 L:0 F:0 B:1 E:0 V:0 R:0 | 687 packet[0] = 0x08; // I:0 P:0 L:0 F:0 B:1 E:0 V:0 R:0 |
688 | 688 |
689 RtpDepacketizer::ParsedPayload parsed; | 689 RtpDepacketizer::ParsedPayload parsed; |
690 ASSERT_TRUE(depacketizer_->Parse(&parsed, packet, sizeof(packet))); | 690 ASSERT_TRUE(depacketizer_->Parse(&parsed, packet, sizeof(packet))); |
691 EXPECT_EQ(kVideoFrameKey, parsed.frame_type); | 691 EXPECT_EQ(kVideoFrameKey, parsed.frame_type); |
692 EXPECT_TRUE(parsed.type.Video.is_first_packet_in_frame); | 692 EXPECT_TRUE(parsed.type.Video.isFirstPacket); |
693 } | 693 } |
694 | 694 |
695 TEST_F(RtpDepacketizerVp9Test, ParseLastPacketInDeltaFrame) { | 695 TEST_F(RtpDepacketizerVp9Test, ParseLastPacketInDeltaFrame) { |
696 uint8_t packet[2] = {0}; | 696 uint8_t packet[2] = {0}; |
697 packet[0] = 0x44; // I:0 P:1 L:0 F:0 B:0 E:1 V:0 R:0 | 697 packet[0] = 0x44; // I:0 P:1 L:0 F:0 B:0 E:1 V:0 R:0 |
698 | 698 |
699 RtpDepacketizer::ParsedPayload parsed; | 699 RtpDepacketizer::ParsedPayload parsed; |
700 ASSERT_TRUE(depacketizer_->Parse(&parsed, packet, sizeof(packet))); | 700 ASSERT_TRUE(depacketizer_->Parse(&parsed, packet, sizeof(packet))); |
701 EXPECT_EQ(kVideoFrameDelta, parsed.frame_type); | 701 EXPECT_EQ(kVideoFrameDelta, parsed.frame_type); |
702 EXPECT_FALSE(parsed.type.Video.is_first_packet_in_frame); | 702 EXPECT_FALSE(parsed.type.Video.isFirstPacket); |
703 } | 703 } |
704 | 704 |
705 TEST_F(RtpDepacketizerVp9Test, ParseResolution) { | 705 TEST_F(RtpDepacketizerVp9Test, ParseResolution) { |
706 const uint16_t kWidth[2] = {640, 1280}; | 706 const uint16_t kWidth[2] = {640, 1280}; |
707 const uint16_t kHeight[2] = {360, 720}; | 707 const uint16_t kHeight[2] = {360, 720}; |
708 uint8_t packet[20] = {0}; | 708 uint8_t packet[20] = {0}; |
709 packet[0] = 0x0A; // I:0 P:0 L:0 F:0 B:1 E:0 V:1 R:0 | 709 packet[0] = 0x0A; // I:0 P:0 L:0 F:0 B:1 E:0 V:1 R:0 |
710 packet[1] = (1 << 5) | (1 << 4) | 0; // N_S:1 Y:1 G:0 | 710 packet[1] = (1 << 5) | (1 << 4) | 0; // N_S:1 Y:1 G:0 |
711 packet[2] = kWidth[0] >> 8; | 711 packet[2] = kWidth[0] >> 8; |
712 packet[3] = kWidth[0] & 0xFF; | 712 packet[3] = kWidth[0] & 0xFF; |
(...skipping 17 matching lines...) Expand all Loading... |
730 } | 730 } |
731 | 731 |
732 TEST_F(RtpDepacketizerVp9Test, ParseFailsForTooShortBufferToFitPayload) { | 732 TEST_F(RtpDepacketizerVp9Test, ParseFailsForTooShortBufferToFitPayload) { |
733 const uint8_t kHeaderLength = 1; | 733 const uint8_t kHeaderLength = 1; |
734 uint8_t packet[kHeaderLength] = {0}; | 734 uint8_t packet[kHeaderLength] = {0}; |
735 RtpDepacketizer::ParsedPayload parsed; | 735 RtpDepacketizer::ParsedPayload parsed; |
736 EXPECT_FALSE(depacketizer_->Parse(&parsed, packet, sizeof(packet))); | 736 EXPECT_FALSE(depacketizer_->Parse(&parsed, packet, sizeof(packet))); |
737 } | 737 } |
738 | 738 |
739 } // namespace webrtc | 739 } // namespace webrtc |
OLD | NEW |