| 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(ConvertVideoRotationToCVOByte(rotation), | 265     EXPECT_EQ(rotation, rtp_header.extension.videoRotation); | 
| 266               rtp_header.extension.videoRotation); |  | 
| 267   } | 266   } | 
| 268 }; | 267 }; | 
| 269 | 268 | 
| 270 TEST_F(RtpSenderTestWithoutPacer, | 269 TEST_F(RtpSenderTestWithoutPacer, | 
| 271        RegisterRtpTransmissionTimeOffsetHeaderExtension) { | 270        RegisterRtpTransmissionTimeOffsetHeaderExtension) { | 
| 272   EXPECT_EQ(0u, rtp_sender_->RtpHeaderExtensionLength()); | 271   EXPECT_EQ(0u, rtp_sender_->RtpHeaderExtensionLength()); | 
| 273   EXPECT_EQ(0, rtp_sender_->RegisterRtpHeaderExtension( | 272   EXPECT_EQ(0, rtp_sender_->RegisterRtpHeaderExtension( | 
| 274                    kRtpExtensionTransmissionTimeOffset, | 273                    kRtpExtensionTransmissionTimeOffset, | 
| 275                    kTransmissionTimeOffsetExtensionId)); | 274                    kTransmissionTimeOffsetExtensionId)); | 
| 276   EXPECT_EQ(kRtpOneByteHeaderLength + kTransmissionTimeOffsetLength, | 275   EXPECT_EQ(kRtpOneByteHeaderLength + kTransmissionTimeOffsetLength, | 
| (...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 570 | 569 | 
| 571   // Verify | 570   // Verify | 
| 572   webrtc::RtpUtility::RtpHeaderParser rtp_parser(packet_, length); | 571   webrtc::RtpUtility::RtpHeaderParser rtp_parser(packet_, length); | 
| 573   webrtc::RTPHeader rtp_header; | 572   webrtc::RTPHeader rtp_header; | 
| 574 | 573 | 
| 575   ASSERT_TRUE(rtp_parser.Parse(&rtp_header, &map)); | 574   ASSERT_TRUE(rtp_parser.Parse(&rtp_header, &map)); | 
| 576   ASSERT_FALSE(rtp_parser.RTCP()); | 575   ASSERT_FALSE(rtp_parser.RTCP()); | 
| 577   VerifyRTPHeaderCommon(rtp_header); | 576   VerifyRTPHeaderCommon(rtp_header); | 
| 578   EXPECT_EQ(length, rtp_header.headerLength); | 577   EXPECT_EQ(length, rtp_header.headerLength); | 
| 579   EXPECT_TRUE(rtp_header.extension.hasVideoRotation); | 578   EXPECT_TRUE(rtp_header.extension.hasVideoRotation); | 
| 580   EXPECT_EQ(ConvertVideoRotationToCVOByte(kRotation), | 579   EXPECT_EQ(kRotation, rtp_header.extension.videoRotation); | 
| 581             rtp_header.extension.videoRotation); |  | 
| 582 } | 580 } | 
| 583 | 581 | 
| 584 // Test CVO header extension is not set when marker bit is false. | 582 // Test CVO header extension is not set when marker bit is false. | 
| 585 TEST_F(RtpSenderTestWithoutPacer, | 583 TEST_F(RtpSenderTestWithoutPacer, | 
| 586        DISABLED_BuildRTPPacketWithVideoRotation_NoMarkerBit) { | 584        DISABLED_BuildRTPPacketWithVideoRotation_NoMarkerBit) { | 
| 587   rtp_sender_->SetVideoRotation(kRotation); | 585   rtp_sender_->SetVideoRotation(kRotation); | 
| 588   EXPECT_EQ(0, rtp_sender_->RegisterRtpHeaderExtension( | 586   EXPECT_EQ(0, rtp_sender_->RegisterRtpHeaderExtension( | 
| 589                    kRtpExtensionVideoRotation, kVideoRotationExtensionId)); | 587                    kRtpExtensionVideoRotation, kVideoRotationExtensionId)); | 
| 590   EXPECT_TRUE(rtp_sender_->ActivateCVORtpHeaderExtension()); | 588   EXPECT_TRUE(rtp_sender_->ActivateCVORtpHeaderExtension()); | 
| 591 | 589 | 
| (...skipping 1092 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1684   VerifyCVOPacket( | 1682   VerifyCVOPacket( | 
| 1685       reinterpret_cast<uint8_t*>(transport_.sent_packets_[0]->data()), | 1683       reinterpret_cast<uint8_t*>(transport_.sent_packets_[0]->data()), | 
| 1686       transport_.sent_packets_[0]->size(), true, &map, kSeqNum, hdr.rotation); | 1684       transport_.sent_packets_[0]->size(), true, &map, kSeqNum, hdr.rotation); | 
| 1687 | 1685 | 
| 1688   // Verify that this packet does have CVO byte. | 1686   // Verify that this packet does have CVO byte. | 
| 1689   VerifyCVOPacket( | 1687   VerifyCVOPacket( | 
| 1690       reinterpret_cast<uint8_t*>(transport_.sent_packets_[1]->data()), | 1688       reinterpret_cast<uint8_t*>(transport_.sent_packets_[1]->data()), | 
| 1691       transport_.sent_packets_[1]->size(), true, &map, kSeqNum + 1, | 1689       transport_.sent_packets_[1]->size(), true, &map, kSeqNum + 1, | 
| 1692       hdr.rotation); | 1690       hdr.rotation); | 
| 1693 } | 1691 } | 
|  | 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 | 
| 1694 }  // namespace webrtc | 1714 }  // namespace webrtc | 
| OLD | NEW | 
|---|