OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 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 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 ASSERT_EQ(kRtpHeaderSize, length); | 255 ASSERT_EQ(kRtpHeaderSize, length); |
256 } | 256 } |
257 ASSERT_TRUE(rtp_parser.Parse(&rtp_header, map)); | 257 ASSERT_TRUE(rtp_parser.Parse(&rtp_header, map)); |
258 ASSERT_FALSE(rtp_parser.RTCP()); | 258 ASSERT_FALSE(rtp_parser.RTCP()); |
259 EXPECT_EQ(payload_, rtp_header.payloadType); | 259 EXPECT_EQ(payload_, rtp_header.payloadType); |
260 EXPECT_EQ(seq_num, rtp_header.sequenceNumber); | 260 EXPECT_EQ(seq_num, rtp_header.sequenceNumber); |
261 EXPECT_EQ(kTimestamp, rtp_header.timestamp); | 261 EXPECT_EQ(kTimestamp, rtp_header.timestamp); |
262 EXPECT_EQ(rtp_sender_->SSRC(), rtp_header.ssrc); | 262 EXPECT_EQ(rtp_sender_->SSRC(), rtp_header.ssrc); |
263 EXPECT_EQ(0, rtp_header.numCSRCs); | 263 EXPECT_EQ(0, rtp_header.numCSRCs); |
264 EXPECT_EQ(0U, rtp_header.paddingLength); | 264 EXPECT_EQ(0U, rtp_header.paddingLength); |
265 EXPECT_EQ(rotation, rtp_header.extension.videoRotation); | 265 EXPECT_EQ(ConvertVideoRotationToCVOByte(rotation), |
| 266 rtp_header.extension.videoRotation); |
266 } | 267 } |
267 }; | 268 }; |
268 | 269 |
269 TEST_F(RtpSenderTestWithoutPacer, | 270 TEST_F(RtpSenderTestWithoutPacer, |
270 RegisterRtpTransmissionTimeOffsetHeaderExtension) { | 271 RegisterRtpTransmissionTimeOffsetHeaderExtension) { |
271 EXPECT_EQ(0u, rtp_sender_->RtpHeaderExtensionLength()); | 272 EXPECT_EQ(0u, rtp_sender_->RtpHeaderExtensionLength()); |
272 EXPECT_EQ(0, rtp_sender_->RegisterRtpHeaderExtension( | 273 EXPECT_EQ(0, rtp_sender_->RegisterRtpHeaderExtension( |
273 kRtpExtensionTransmissionTimeOffset, | 274 kRtpExtensionTransmissionTimeOffset, |
274 kTransmissionTimeOffsetExtensionId)); | 275 kTransmissionTimeOffsetExtensionId)); |
275 EXPECT_EQ(kRtpOneByteHeaderLength + kTransmissionTimeOffsetLength, | 276 EXPECT_EQ(kRtpOneByteHeaderLength + kTransmissionTimeOffsetLength, |
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
569 | 570 |
570 // Verify | 571 // Verify |
571 webrtc::RtpUtility::RtpHeaderParser rtp_parser(packet_, length); | 572 webrtc::RtpUtility::RtpHeaderParser rtp_parser(packet_, length); |
572 webrtc::RTPHeader rtp_header; | 573 webrtc::RTPHeader rtp_header; |
573 | 574 |
574 ASSERT_TRUE(rtp_parser.Parse(&rtp_header, &map)); | 575 ASSERT_TRUE(rtp_parser.Parse(&rtp_header, &map)); |
575 ASSERT_FALSE(rtp_parser.RTCP()); | 576 ASSERT_FALSE(rtp_parser.RTCP()); |
576 VerifyRTPHeaderCommon(rtp_header); | 577 VerifyRTPHeaderCommon(rtp_header); |
577 EXPECT_EQ(length, rtp_header.headerLength); | 578 EXPECT_EQ(length, rtp_header.headerLength); |
578 EXPECT_TRUE(rtp_header.extension.hasVideoRotation); | 579 EXPECT_TRUE(rtp_header.extension.hasVideoRotation); |
579 EXPECT_EQ(kRotation, rtp_header.extension.videoRotation); | 580 EXPECT_EQ(ConvertVideoRotationToCVOByte(kRotation), |
| 581 rtp_header.extension.videoRotation); |
580 } | 582 } |
581 | 583 |
582 // Test CVO header extension is not set when marker bit is false. | 584 // Test CVO header extension is not set when marker bit is false. |
583 TEST_F(RtpSenderTestWithoutPacer, | 585 TEST_F(RtpSenderTestWithoutPacer, |
584 DISABLED_BuildRTPPacketWithVideoRotation_NoMarkerBit) { | 586 DISABLED_BuildRTPPacketWithVideoRotation_NoMarkerBit) { |
585 rtp_sender_->SetVideoRotation(kRotation); | 587 rtp_sender_->SetVideoRotation(kRotation); |
586 EXPECT_EQ(0, rtp_sender_->RegisterRtpHeaderExtension( | 588 EXPECT_EQ(0, rtp_sender_->RegisterRtpHeaderExtension( |
587 kRtpExtensionVideoRotation, kVideoRotationExtensionId)); | 589 kRtpExtensionVideoRotation, kVideoRotationExtensionId)); |
588 EXPECT_TRUE(rtp_sender_->ActivateCVORtpHeaderExtension()); | 590 EXPECT_TRUE(rtp_sender_->ActivateCVORtpHeaderExtension()); |
589 | 591 |
(...skipping 1092 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1682 VerifyCVOPacket( | 1684 VerifyCVOPacket( |
1683 reinterpret_cast<uint8_t*>(transport_.sent_packets_[0]->data()), | 1685 reinterpret_cast<uint8_t*>(transport_.sent_packets_[0]->data()), |
1684 transport_.sent_packets_[0]->size(), true, &map, kSeqNum, hdr.rotation); | 1686 transport_.sent_packets_[0]->size(), true, &map, kSeqNum, hdr.rotation); |
1685 | 1687 |
1686 // Verify that this packet does have CVO byte. | 1688 // Verify that this packet does have CVO byte. |
1687 VerifyCVOPacket( | 1689 VerifyCVOPacket( |
1688 reinterpret_cast<uint8_t*>(transport_.sent_packets_[1]->data()), | 1690 reinterpret_cast<uint8_t*>(transport_.sent_packets_[1]->data()), |
1689 transport_.sent_packets_[1]->size(), true, &map, kSeqNum + 1, | 1691 transport_.sent_packets_[1]->size(), true, &map, kSeqNum + 1, |
1690 hdr.rotation); | 1692 hdr.rotation); |
1691 } | 1693 } |
1692 | |
1693 // Make sure rotation is parsed correctly when the Camera (C) and Flip (F) bits | |
1694 // are set in the CVO byte. | |
1695 TEST_F(RtpSenderVideoTest, SendVideoWithCameraAndFlipCVO) { | |
1696 // Test extracting rotation when Camera (C) and Flip (F) bits are zero. | |
1697 EXPECT_EQ(kVideoRotation_0, ConvertCVOByteToVideoRotation(0)); | |
1698 EXPECT_EQ(kVideoRotation_90, ConvertCVOByteToVideoRotation(1)); | |
1699 EXPECT_EQ(kVideoRotation_180, ConvertCVOByteToVideoRotation(2)); | |
1700 EXPECT_EQ(kVideoRotation_270, ConvertCVOByteToVideoRotation(3)); | |
1701 // Test extracting rotation when Camera (C) and Flip (F) bits are set. | |
1702 const int flip_bit = 1 << 2; | |
1703 const int camera_bit = 1 << 3; | |
1704 EXPECT_EQ(kVideoRotation_0, | |
1705 ConvertCVOByteToVideoRotation(flip_bit | camera_bit | 0)); | |
1706 EXPECT_EQ(kVideoRotation_90, | |
1707 ConvertCVOByteToVideoRotation(flip_bit | camera_bit | 1)); | |
1708 EXPECT_EQ(kVideoRotation_180, | |
1709 ConvertCVOByteToVideoRotation(flip_bit | camera_bit | 2)); | |
1710 EXPECT_EQ(kVideoRotation_270, | |
1711 ConvertCVOByteToVideoRotation(flip_bit | camera_bit | 3)); | |
1712 } | |
1713 | |
1714 } // namespace webrtc | 1694 } // namespace webrtc |
OLD | NEW |