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

Unified Diff: webrtc/modules/rtp_rtcp/source/rtp_sender_unittest.cc

Issue 2452583002: Follow standard sending CVO rtp header extension (Closed)
Patch Set: -now unused helper 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | webrtc/modules/rtp_rtcp/source/rtp_sender_video.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/modules/rtp_rtcp/source/rtp_sender_unittest.cc
diff --git a/webrtc/modules/rtp_rtcp/source/rtp_sender_unittest.cc b/webrtc/modules/rtp_rtcp/source/rtp_sender_unittest.cc
index cdaca2a829a3d5d3b6a9d55ba297bc96fa445d49..8fa21d931d01cd63ec7299b2381d07a940b4983b 100644
--- a/webrtc/modules/rtp_rtcp/source/rtp_sender_unittest.cc
+++ b/webrtc/modules/rtp_rtcp/source/rtp_sender_unittest.cc
@@ -242,21 +242,6 @@ class RtpSenderVideoTest : public RtpSenderTest {
new RTPSenderVideo(&fake_clock_, rtp_sender_.get()));
}
std::unique_ptr<RTPSenderVideo> rtp_sender_video_;
-
- void VerifyCVOPacket(const RtpPacketReceived& rtp_packet,
- bool expect_cvo,
- uint16_t seq_num,
- VideoRotation expected_rotation) {
- EXPECT_EQ(payload_, rtp_packet.PayloadType());
- EXPECT_EQ(seq_num, rtp_packet.SequenceNumber());
- EXPECT_EQ(kTimestamp, rtp_packet.Timestamp());
- EXPECT_EQ(rtp_sender_->SSRC(), rtp_packet.Ssrc());
- EXPECT_EQ(0U, rtp_packet.Csrcs().size());
- EXPECT_EQ(0U, rtp_packet.padding_size());
- VideoRotation actual_rotation;
- EXPECT_TRUE(rtp_packet.GetExtension<VideoOrientation>(&actual_rotation));
- EXPECT_EQ(expected_rotation, actual_rotation);
- }
};
TEST_F(RtpSenderTestWithoutPacer,
@@ -1324,27 +1309,64 @@ TEST_F(RtpSenderTestWithoutPacer, RespectsNackBitrateLimit) {
EXPECT_EQ(kNumPackets * 2, transport_.packets_sent());
}
-// Verify that all packets of a frame have CVO byte set.
-TEST_F(RtpSenderVideoTest, SendVideoWithCVO) {
+TEST_F(RtpSenderVideoTest, KeyFrameHasCVO) {
uint8_t kFrame[kMaxPacketLength];
- RTPVideoHeader hdr = {0};
- hdr.rotation = kVideoRotation_90;
-
EXPECT_EQ(0, rtp_sender_->RegisterRtpHeaderExtension(
kRtpExtensionVideoRotation, kVideoRotationExtensionId));
- EXPECT_EQ(
- RtpUtility::Word32Align(kRtpOneByteHeaderLength + kVideoRotationLength),
- rtp_sender_->RtpHeaderExtensionLength());
+ RTPVideoHeader hdr = {0};
+ hdr.rotation = kVideoRotation_0;
rtp_sender_video_->SendVideo(kRtpVideoGeneric, kVideoFrameKey, kPayload,
kTimestamp, 0, kFrame, sizeof(kFrame), nullptr,
&hdr);
- // Verify that this packet does have CVO byte.
- VerifyCVOPacket(transport_.sent_packets_[0], true, kSeqNum, hdr.rotation);
+ VideoRotation rotation;
+ EXPECT_TRUE(
+ transport_.last_sent_packet().GetExtension<VideoOrientation>(&rotation));
+ EXPECT_EQ(kVideoRotation_0, rotation);
+}
+
+TEST_F(RtpSenderVideoTest, DeltaFrameHasCVOWhenChanged) {
+ uint8_t kFrame[kMaxPacketLength];
+ EXPECT_EQ(0, rtp_sender_->RegisterRtpHeaderExtension(
+ kRtpExtensionVideoRotation, kVideoRotationExtensionId));
+
+ RTPVideoHeader hdr = {0};
+ hdr.rotation = kVideoRotation_90;
+ EXPECT_TRUE(rtp_sender_video_->SendVideo(kRtpVideoGeneric, kVideoFrameKey,
+ kPayload, kTimestamp, 0, kFrame,
+ sizeof(kFrame), nullptr, &hdr));
+
+ hdr.rotation = kVideoRotation_0;
+ EXPECT_TRUE(rtp_sender_video_->SendVideo(kRtpVideoGeneric, kVideoFrameDelta,
+ kPayload, kTimestamp + 1, 0, kFrame,
+ sizeof(kFrame), nullptr, &hdr));
+
+ VideoRotation rotation;
+ EXPECT_TRUE(
+ transport_.last_sent_packet().GetExtension<VideoOrientation>(&rotation));
+ EXPECT_EQ(kVideoRotation_0, rotation);
+}
+
+TEST_F(RtpSenderVideoTest, DeltaFrameHasCVOWhenNonZero) {
+ uint8_t kFrame[kMaxPacketLength];
+ EXPECT_EQ(0, rtp_sender_->RegisterRtpHeaderExtension(
+ kRtpExtensionVideoRotation, kVideoRotationExtensionId));
- // Verify that this packet does have CVO byte.
- VerifyCVOPacket(transport_.sent_packets_[1], true, kSeqNum + 1, hdr.rotation);
+ RTPVideoHeader hdr = {0};
+ hdr.rotation = kVideoRotation_90;
+ EXPECT_TRUE(rtp_sender_video_->SendVideo(kRtpVideoGeneric, kVideoFrameKey,
+ kPayload, kTimestamp, 0, kFrame,
+ sizeof(kFrame), nullptr, &hdr));
+
+ EXPECT_TRUE(rtp_sender_video_->SendVideo(kRtpVideoGeneric, kVideoFrameDelta,
+ kPayload, kTimestamp + 1, 0, kFrame,
+ sizeof(kFrame), nullptr, &hdr));
+
+ VideoRotation rotation;
+ EXPECT_TRUE(
+ transport_.last_sent_packet().GetExtension<VideoOrientation>(&rotation));
+ EXPECT_EQ(kVideoRotation_90, rotation);
}
// Make sure rotation is parsed correctly when the Camera (C) and Flip (F) bits
« no previous file with comments | « no previous file | webrtc/modules/rtp_rtcp/source/rtp_sender_video.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698