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

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

Issue 1586523003: Fixed sending Rtp packets with non zero csrcs and certain extensions. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 11 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 | « webrtc/modules/rtp_rtcp/source/rtp_sender.cc ('k') | no next file » | 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 6bc122201adfd64881afffed7b28dae40fa29990..8f84fac69c94ed2c46e2b3d46b53063af6bde8c7 100644
--- a/webrtc/modules/rtp_rtcp/source/rtp_sender_unittest.cc
+++ b/webrtc/modules/rtp_rtcp/source/rtp_sender_unittest.cc
@@ -123,8 +123,7 @@ class RtpSenderTest : public ::testing::Test {
mock_paced_sender_(),
rtp_sender_(),
payload_(kPayload),
- transport_(),
- kMarkerBit(true) {
+ transport_() {
EXPECT_CALL(mock_paced_sender_, InsertPacket(_, _, _, _, _, _))
.WillRepeatedly(testing::Return());
}
@@ -144,20 +143,18 @@ class RtpSenderTest : public ::testing::Test {
rtc::scoped_ptr<RTPSender> rtp_sender_;
int payload_;
LoopbackTransportTest transport_;
- const bool kMarkerBit;
+ static const bool kMarkerBit = true;
uint8_t packet_[kMaxPacketLength];
- void VerifyRTPHeaderCommon(const RTPHeader& rtp_header) {
- VerifyRTPHeaderCommon(rtp_header, kMarkerBit);
- }
-
- void VerifyRTPHeaderCommon(const RTPHeader& rtp_header, bool marker_bit) {
+ void VerifyRTPHeaderCommon(const RTPHeader& rtp_header,
+ bool marker_bit = kMarkerBit,
+ uint8_t number_of_csrcs = 0) {
stefan-webrtc 2016/01/14 14:59:17 No default values please, instead pass in all argu
danilchap 2016/01/14 15:45:04 Done.
EXPECT_EQ(marker_bit, rtp_header.markerBit);
EXPECT_EQ(payload_, rtp_header.payloadType);
EXPECT_EQ(kSeqNum, rtp_header.sequenceNumber);
EXPECT_EQ(kTimestamp, rtp_header.timestamp);
EXPECT_EQ(rtp_sender_->SSRC(), rtp_header.ssrc);
- EXPECT_EQ(0, rtp_header.numCSRCs);
+ EXPECT_EQ(number_of_csrcs, rtp_header.numCSRCs);
EXPECT_EQ(0U, rtp_header.paddingLength);
}
@@ -552,6 +549,40 @@ TEST_F(RtpSenderTestWithoutPacer, BuildRTPPacketWithAudioLevelExtension) {
EXPECT_EQ(0u, rtp_header2.extension.audioLevel);
}
+TEST_F(RtpSenderTestWithoutPacer,
+ BuildRTPPacketWithCSRCAndAudioLevelExtension) {
+ EXPECT_EQ(0, rtp_sender_->RegisterRtpHeaderExtension(kRtpExtensionAudioLevel,
+ kAudioLevelExtensionId));
+ std::vector<uint32_t> csrcs;
+ csrcs.push_back(0x23456789);
+ rtp_sender_->SetCsrcs(csrcs);
stefan-webrtc 2016/01/14 14:59:17 Shouldn't you use at least 2 CSRCs to trigger this
danilchap 2016/01/14 15:45:04 No, one is enough. I checked test was red before c
+ size_t length = static_cast<size_t>(rtp_sender_->BuildRTPheader(
+ packet_, kPayload, kMarkerBit, kTimestamp, 0));
+
+ // Verify
+ webrtc::RtpUtility::RtpHeaderParser rtp_parser(packet_, length);
+ webrtc::RTPHeader rtp_header;
+
+ // Updating audio level is done in RTPSenderAudio, so simulate it here.
+ rtp_parser.Parse(&rtp_header);
+ EXPECT_TRUE(rtp_sender_->UpdateAudioLevel(packet_, length, rtp_header, true,
+ kAudioLevel));
+
+ RtpHeaderExtensionMap map;
+ map.Register(kRtpExtensionAudioLevel, kAudioLevelExtensionId);
+ const bool valid_rtp_header = rtp_parser.Parse(&rtp_header, &map);
+
+ ASSERT_TRUE(valid_rtp_header);
+ ASSERT_FALSE(rtp_parser.RTCP());
+ VerifyRTPHeaderCommon(rtp_header, kMarkerBit, csrcs.size());
+ EXPECT_EQ(length, rtp_header.headerLength);
+ EXPECT_TRUE(rtp_header.extension.hasAudioLevel);
+ EXPECT_TRUE(rtp_header.extension.voiceActivity);
+ EXPECT_EQ(kAudioLevel, rtp_header.extension.audioLevel);
+ EXPECT_EQ(1u, rtp_header.numCSRCs);
+ EXPECT_EQ(csrcs[0], rtp_header.arrOfCSRCs[0]);
+}
+
TEST_F(RtpSenderTestWithoutPacer, BuildRTPPacketWithHeaderExtensions) {
EXPECT_EQ(0, rtp_sender_->SetTransmissionTimeOffset(kTimeOffset));
EXPECT_EQ(0, rtp_sender_->SetAbsoluteSendTime(kAbsoluteSendTime));
« no previous file with comments | « webrtc/modules/rtp_rtcp/source/rtp_sender.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698