Index: webrtc/modules/rtp_rtcp/source/rtcp_receiver_unittest.cc |
diff --git a/webrtc/modules/rtp_rtcp/source/rtcp_receiver_unittest.cc b/webrtc/modules/rtp_rtcp/source/rtcp_receiver_unittest.cc |
index 1082b3020bb0348cd8a89aed216603b950cddea4..ad1970ce7cf2c404510f62d2272b6fc7c3ee2c75 100644 |
--- a/webrtc/modules/rtp_rtcp/source/rtcp_receiver_unittest.cc |
+++ b/webrtc/modules/rtp_rtcp/source/rtcp_receiver_unittest.cc |
@@ -155,8 +155,8 @@ TEST_F(RtcpReceiverTest, InjectSrPacket) { |
const uint32_t kSenderSsrc = 0x10203; |
rtcp::SenderReport sr; |
sr.From(kSenderSsrc); |
- rtcp::RawPacket p = sr.Build(); |
- EXPECT_EQ(0, InjectRtcpPacket(p.buffer(), p.buffer_length())); |
+ rtc::scoped_ptr<rtcp::RawPacket> packet(sr.Build()); |
+ EXPECT_EQ(0, InjectRtcpPacket(packet->Buffer(), packet->Length())); |
// The parser will note the remote SSRC on a SR from other than his |
// expected peer, but will not flag that he's gotten a packet. |
EXPECT_EQ(kSenderSsrc, rtcp_packet_info_.remoteSSRC); |
@@ -169,8 +169,8 @@ TEST_F(RtcpReceiverTest, InjectSrPacketFromExpectedPeer) { |
rtcp_receiver_->SetRemoteSSRC(kSenderSsrc); |
rtcp::SenderReport sr; |
sr.From(kSenderSsrc); |
- rtcp::RawPacket p = sr.Build(); |
- EXPECT_EQ(0, InjectRtcpPacket(p.buffer(), p.buffer_length())); |
+ rtc::scoped_ptr<rtcp::RawPacket> packet(sr.Build()); |
+ EXPECT_EQ(0, InjectRtcpPacket(packet->Buffer(), packet->Length())); |
EXPECT_EQ(kSenderSsrc, rtcp_packet_info_.remoteSSRC); |
EXPECT_EQ(kRtcpSr, rtcp_packet_info_.rtcpPacketTypeFlags); |
} |
@@ -179,8 +179,8 @@ TEST_F(RtcpReceiverTest, InjectRrPacket) { |
const uint32_t kSenderSsrc = 0x10203; |
rtcp::ReceiverReport rr; |
rr.From(kSenderSsrc); |
- rtcp::RawPacket p = rr.Build(); |
- EXPECT_EQ(0, InjectRtcpPacket(p.buffer(), p.buffer_length())); |
+ rtc::scoped_ptr<rtcp::RawPacket> packet(rr.Build()); |
+ EXPECT_EQ(0, InjectRtcpPacket(packet->Buffer(), packet->Length())); |
EXPECT_EQ(kSenderSsrc, rtcp_packet_info_.remoteSSRC); |
EXPECT_EQ(kRtcpRr, rtcp_packet_info_.rtcpPacketTypeFlags); |
ASSERT_EQ(0u, rtcp_packet_info_.report_blocks.size()); |
@@ -198,8 +198,8 @@ TEST_F(RtcpReceiverTest, InjectRrPacketWithReportBlockNotToUsIgnored) { |
rtcp::ReceiverReport rr; |
rr.From(kSenderSsrc); |
rr.WithReportBlock(&rb); |
- rtcp::RawPacket p = rr.Build(); |
- EXPECT_EQ(0, InjectRtcpPacket(p.buffer(), p.buffer_length())); |
+ rtc::scoped_ptr<rtcp::RawPacket> packet(rr.Build()); |
+ EXPECT_EQ(0, InjectRtcpPacket(packet->Buffer(), packet->Length())); |
EXPECT_EQ(kSenderSsrc, rtcp_packet_info_.remoteSSRC); |
EXPECT_EQ(kRtcpRr, rtcp_packet_info_.rtcpPacketTypeFlags); |
ASSERT_EQ(0u, rtcp_packet_info_.report_blocks.size()); |
@@ -221,8 +221,8 @@ TEST_F(RtcpReceiverTest, InjectRrPacketWithOneReportBlock) { |
rtcp::ReceiverReport rr; |
rr.From(kSenderSsrc); |
rr.WithReportBlock(&rb); |
- rtcp::RawPacket p = rr.Build(); |
- EXPECT_EQ(0, InjectRtcpPacket(p.buffer(), p.buffer_length())); |
+ rtc::scoped_ptr<rtcp::RawPacket> packet(rr.Build()); |
+ EXPECT_EQ(0, InjectRtcpPacket(packet->Buffer(), packet->Length())); |
EXPECT_EQ(kSenderSsrc, rtcp_packet_info_.remoteSSRC); |
EXPECT_EQ(kRtcpRr, rtcp_packet_info_.rtcpPacketTypeFlags); |
ASSERT_EQ(1u, rtcp_packet_info_.report_blocks.size()); |
@@ -258,8 +258,8 @@ TEST_F(RtcpReceiverTest, InjectRrPacketWithTwoReportBlocks) { |
rr1.WithReportBlock(&rb1); |
rr1.WithReportBlock(&rb2); |
- rtcp::RawPacket p1 = rr1.Build(); |
- EXPECT_EQ(0, InjectRtcpPacket(p1.buffer(), p1.buffer_length())); |
+ rtc::scoped_ptr<rtcp::RawPacket> p1(rr1.Build()); |
+ EXPECT_EQ(0, InjectRtcpPacket(p1->Buffer(), p1->Length())); |
ASSERT_EQ(2u, rtcp_packet_info_.report_blocks.size()); |
EXPECT_EQ(10, rtcp_packet_info_.report_blocks.front().fractionLost); |
EXPECT_EQ(0, rtcp_packet_info_.report_blocks.back().fractionLost); |
@@ -281,8 +281,8 @@ TEST_F(RtcpReceiverTest, InjectRrPacketWithTwoReportBlocks) { |
rr2.WithReportBlock(&rb3); |
rr2.WithReportBlock(&rb4); |
- rtcp::RawPacket p2 = rr2.Build(); |
- EXPECT_EQ(0, InjectRtcpPacket(p2.buffer(), p2.buffer_length())); |
+ rtc::scoped_ptr<rtcp::RawPacket> p2(rr2.Build()); |
+ EXPECT_EQ(0, InjectRtcpPacket(p2->Buffer(), p2->Length())); |
ASSERT_EQ(2u, rtcp_packet_info_.report_blocks.size()); |
EXPECT_EQ(kFracLost[0], rtcp_packet_info_.report_blocks.front().fractionLost); |
EXPECT_EQ(kFracLost[1], rtcp_packet_info_.report_blocks.back().fractionLost); |
@@ -320,8 +320,8 @@ TEST_F(RtcpReceiverTest, InjectRrPacketsFromTwoRemoteSsrcs) { |
rr1.From(kSenderSsrc1); |
rr1.WithReportBlock(&rb1); |
- rtcp::RawPacket p1 = rr1.Build(); |
- EXPECT_EQ(0, InjectRtcpPacket(p1.buffer(), p1.buffer_length())); |
+ rtc::scoped_ptr<rtcp::RawPacket> p1(rr1.Build()); |
+ EXPECT_EQ(0, InjectRtcpPacket(p1->Buffer(), p1->Length())); |
ASSERT_EQ(1u, rtcp_packet_info_.report_blocks.size()); |
EXPECT_EQ(kFracLost[0], rtcp_packet_info_.report_blocks.front().fractionLost); |
@@ -342,8 +342,8 @@ TEST_F(RtcpReceiverTest, InjectRrPacketsFromTwoRemoteSsrcs) { |
rtcp::ReceiverReport rr2; |
rr2.From(kSenderSsrc2); |
rr2.WithReportBlock(&rb2); |
- rtcp::RawPacket p2 = rr2.Build(); |
- EXPECT_EQ(0, InjectRtcpPacket(p2.buffer(), p2.buffer_length())); |
+ rtc::scoped_ptr<rtcp::RawPacket> p2(rr2.Build()); |
+ EXPECT_EQ(0, InjectRtcpPacket(p2->Buffer(), p2->Length())); |
ASSERT_EQ(1u, rtcp_packet_info_.report_blocks.size()); |
EXPECT_EQ(kFracLost[1], rtcp_packet_info_.report_blocks.front().fractionLost); |
@@ -375,8 +375,8 @@ TEST_F(RtcpReceiverTest, GetRtt) { |
rtcp::ReceiverReport rr; |
rr.From(kSenderSsrc); |
rr.WithReportBlock(&rb); |
- rtcp::RawPacket p = rr.Build(); |
- EXPECT_EQ(0, InjectRtcpPacket(p.buffer(), p.buffer_length())); |
+ rtc::scoped_ptr<rtcp::RawPacket> packet(rr.Build()); |
+ EXPECT_EQ(0, InjectRtcpPacket(packet->Buffer(), packet->Length())); |
EXPECT_EQ(kSenderSsrc, rtcp_packet_info_.remoteSSRC); |
EXPECT_EQ(kRtcpRr, rtcp_packet_info_.rtcpPacketTypeFlags); |
EXPECT_EQ(1u, rtcp_packet_info_.report_blocks.size()); |
@@ -388,8 +388,8 @@ TEST_F(RtcpReceiverTest, GetRtt) { |
TEST_F(RtcpReceiverTest, InjectIjWithNoItem) { |
rtcp::Ij ij; |
- rtcp::RawPacket p = ij.Build(); |
- EXPECT_EQ(0, InjectRtcpPacket(p.buffer(), p.buffer_length())); |
+ rtc::scoped_ptr<rtcp::RawPacket> packet(ij.Build()); |
+ EXPECT_EQ(0, InjectRtcpPacket(packet->Buffer(), packet->Length())); |
EXPECT_EQ(0U, rtcp_packet_info_.rtcpPacketTypeFlags); |
} |
@@ -397,8 +397,8 @@ TEST_F(RtcpReceiverTest, InjectIjWithOneItem) { |
rtcp::Ij ij; |
ij.WithJitterItem(0x11111111); |
- rtcp::RawPacket p = ij.Build(); |
- EXPECT_EQ(0, InjectRtcpPacket(p.buffer(), p.buffer_length())); |
+ rtc::scoped_ptr<rtcp::RawPacket> packet(ij.Build()); |
+ EXPECT_EQ(0, InjectRtcpPacket(packet->Buffer(), packet->Length())); |
EXPECT_EQ(kRtcpTransmissionTimeOffset, rtcp_packet_info_.rtcpPacketTypeFlags); |
EXPECT_EQ(0x11111111U, rtcp_packet_info_.interArrivalJitter); |
} |
@@ -412,8 +412,8 @@ TEST_F(RtcpReceiverTest, InjectAppWithNoData) { |
name += 'e'; |
app.WithName(name); |
- rtcp::RawPacket p = app.Build(); |
- EXPECT_EQ(0, InjectRtcpPacket(p.buffer(), p.buffer_length())); |
+ rtc::scoped_ptr<rtcp::RawPacket> packet(app.Build()); |
+ EXPECT_EQ(0, InjectRtcpPacket(packet->Buffer(), packet->Length())); |
EXPECT_EQ(kRtcpApp, rtcp_packet_info_.rtcpPacketTypeFlags); |
EXPECT_EQ(30, rtcp_packet_info_.applicationSubType); |
EXPECT_EQ(name, rtcp_packet_info_.applicationName); |
@@ -432,8 +432,8 @@ TEST_F(RtcpReceiverTest, InjectAppWithData) { |
const size_t kDataLength = sizeof(kData) / sizeof(kData[0]); |
app.WithData((const uint8_t*)kData, kDataLength); |
- rtcp::RawPacket p = app.Build(); |
- EXPECT_EQ(0, InjectRtcpPacket(p.buffer(), p.buffer_length())); |
+ rtc::scoped_ptr<rtcp::RawPacket> packet(app.Build()); |
+ EXPECT_EQ(0, InjectRtcpPacket(packet->Buffer(), packet->Length())); |
EXPECT_EQ(kRtcpApp, rtcp_packet_info_.rtcpPacketTypeFlags); |
EXPECT_EQ(30, rtcp_packet_info_.applicationSubType); |
EXPECT_EQ(name, rtcp_packet_info_.applicationName); |
@@ -445,8 +445,8 @@ TEST_F(RtcpReceiverTest, InjectSdesWithOneChunk) { |
rtcp::Sdes sdes; |
sdes.WithCName(kSenderSsrc, "alice@host"); |
- rtcp::RawPacket p = sdes.Build(); |
- EXPECT_EQ(0, InjectRtcpPacket(p.buffer(), p.buffer_length())); |
+ rtc::scoped_ptr<rtcp::RawPacket> packet(sdes.Build()); |
+ EXPECT_EQ(0, InjectRtcpPacket(packet->Buffer(), packet->Length())); |
char cName[RTCP_CNAME_SIZE]; |
EXPECT_EQ(0, rtcp_receiver_->CNAME(kSenderSsrc, cName)); |
EXPECT_EQ(0, strncmp(cName, "alice@host", RTCP_CNAME_SIZE)); |
@@ -457,16 +457,16 @@ TEST_F(RtcpReceiverTest, InjectByePacket_RemovesCname) { |
rtcp::Sdes sdes; |
sdes.WithCName(kSenderSsrc, "alice@host"); |
- rtcp::RawPacket p = sdes.Build(); |
- EXPECT_EQ(0, InjectRtcpPacket(p.buffer(), p.buffer_length())); |
+ rtc::scoped_ptr<rtcp::RawPacket> packet(sdes.Build()); |
+ EXPECT_EQ(0, InjectRtcpPacket(packet->Buffer(), packet->Length())); |
char cName[RTCP_CNAME_SIZE]; |
EXPECT_EQ(0, rtcp_receiver_->CNAME(kSenderSsrc, cName)); |
// Verify that BYE removes the CNAME. |
rtcp::Bye bye; |
bye.From(kSenderSsrc); |
- rtcp::RawPacket p2 = bye.Build(); |
- EXPECT_EQ(0, InjectRtcpPacket(p2.buffer(), p2.buffer_length())); |
+ rtc::scoped_ptr<rtcp::RawPacket> p2(bye.Build()); |
+ EXPECT_EQ(0, InjectRtcpPacket(p2->Buffer(), p2->Length())); |
EXPECT_EQ(-1, rtcp_receiver_->CNAME(kSenderSsrc, cName)); |
} |
@@ -487,8 +487,8 @@ TEST_F(RtcpReceiverTest, InjectByePacket_RemovesReportBlocks) { |
rr.WithReportBlock(&rb1); |
rr.WithReportBlock(&rb2); |
- rtcp::RawPacket p1 = rr.Build(); |
- EXPECT_EQ(0, InjectRtcpPacket(p1.buffer(), p1.buffer_length())); |
+ rtc::scoped_ptr<rtcp::RawPacket> p1(rr.Build()); |
+ EXPECT_EQ(0, InjectRtcpPacket(p1->Buffer(), p1->Length())); |
ASSERT_EQ(2u, rtcp_packet_info_.report_blocks.size()); |
std::vector<RTCPReportBlock> received_blocks; |
rtcp_receiver_->StatisticsReceived(&received_blocks); |
@@ -497,14 +497,14 @@ TEST_F(RtcpReceiverTest, InjectByePacket_RemovesReportBlocks) { |
// Verify that BYE removes the report blocks. |
rtcp::Bye bye; |
bye.From(kSenderSsrc); |
- rtcp::RawPacket p2 = bye.Build(); |
- EXPECT_EQ(0, InjectRtcpPacket(p2.buffer(), p2.buffer_length())); |
+ rtc::scoped_ptr<rtcp::RawPacket> p2(bye.Build()); |
+ EXPECT_EQ(0, InjectRtcpPacket(p2->Buffer(), p2->Length())); |
received_blocks.clear(); |
rtcp_receiver_->StatisticsReceived(&received_blocks); |
EXPECT_TRUE(received_blocks.empty()); |
// Inject packet. |
- EXPECT_EQ(0, InjectRtcpPacket(p1.buffer(), p1.buffer_length())); |
+ EXPECT_EQ(0, InjectRtcpPacket(p1->Buffer(), p1->Length())); |
ASSERT_EQ(2u, rtcp_packet_info_.report_blocks.size()); |
received_blocks.clear(); |
rtcp_receiver_->StatisticsReceived(&received_blocks); |
@@ -519,8 +519,8 @@ TEST_F(RtcpReceiverTest, InjectPliPacket) { |
rtcp::Pli pli; |
pli.To(kSourceSsrc); |
- rtcp::RawPacket p = pli.Build(); |
- EXPECT_EQ(0, InjectRtcpPacket(p.buffer(), p.buffer_length())); |
+ rtc::scoped_ptr<rtcp::RawPacket> packet(pli.Build()); |
+ EXPECT_EQ(0, InjectRtcpPacket(packet->Buffer(), packet->Length())); |
EXPECT_EQ(kRtcpPli, rtcp_packet_info_.rtcpPacketTypeFlags); |
} |
@@ -532,8 +532,8 @@ TEST_F(RtcpReceiverTest, PliPacketNotToUsIgnored) { |
rtcp::Pli pli; |
pli.To(kSourceSsrc + 1); |
- rtcp::RawPacket p = pli.Build(); |
- EXPECT_EQ(0, InjectRtcpPacket(p.buffer(), p.buffer_length())); |
+ rtc::scoped_ptr<rtcp::RawPacket> packet(pli.Build()); |
+ EXPECT_EQ(0, InjectRtcpPacket(packet->Buffer(), packet->Length())); |
EXPECT_EQ(0U, rtcp_packet_info_.rtcpPacketTypeFlags); |
} |
@@ -545,8 +545,8 @@ TEST_F(RtcpReceiverTest, InjectFirPacket) { |
rtcp::Fir fir; |
fir.To(kSourceSsrc); |
- rtcp::RawPacket p = fir.Build(); |
- EXPECT_EQ(0, InjectRtcpPacket(p.buffer(), p.buffer_length())); |
+ rtc::scoped_ptr<rtcp::RawPacket> packet(fir.Build()); |
+ EXPECT_EQ(0, InjectRtcpPacket(packet->Buffer(), packet->Length())); |
EXPECT_EQ(kRtcpFir, rtcp_packet_info_.rtcpPacketTypeFlags); |
} |
@@ -558,16 +558,16 @@ TEST_F(RtcpReceiverTest, FirPacketNotToUsIgnored) { |
rtcp::Fir fir; |
fir.To(kSourceSsrc + 1); |
- rtcp::RawPacket p = fir.Build(); |
- EXPECT_EQ(0, InjectRtcpPacket(p.buffer(), p.buffer_length())); |
+ rtc::scoped_ptr<rtcp::RawPacket> packet(fir.Build()); |
+ EXPECT_EQ(0, InjectRtcpPacket(packet->Buffer(), packet->Length())); |
EXPECT_EQ(0U, rtcp_packet_info_.rtcpPacketTypeFlags); |
} |
TEST_F(RtcpReceiverTest, InjectSliPacket) { |
rtcp::Sli sli; |
sli.WithPictureId(40); |
- rtcp::RawPacket p = sli.Build(); |
- EXPECT_EQ(0, InjectRtcpPacket(p.buffer(), p.buffer_length())); |
+ rtc::scoped_ptr<rtcp::RawPacket> packet(sli.Build()); |
+ EXPECT_EQ(0, InjectRtcpPacket(packet->Buffer(), packet->Length())); |
EXPECT_EQ(kRtcpSli, rtcp_packet_info_.rtcpPacketTypeFlags); |
EXPECT_EQ(40, rtcp_packet_info_.sliPictureId); |
} |
@@ -575,8 +575,8 @@ TEST_F(RtcpReceiverTest, InjectSliPacket) { |
TEST_F(RtcpReceiverTest, XrPacketWithZeroReportBlocksIgnored) { |
rtcp::Xr xr; |
xr.From(0x2345); |
- rtcp::RawPacket p = xr.Build(); |
- EXPECT_EQ(0, InjectRtcpPacket(p.buffer(), p.buffer_length())); |
+ rtc::scoped_ptr<rtcp::RawPacket> packet(xr.Build()); |
+ EXPECT_EQ(0, InjectRtcpPacket(packet->Buffer(), packet->Length())); |
EXPECT_EQ(0U, rtcp_packet_info_.rtcpPacketTypeFlags); |
} |
@@ -593,8 +593,8 @@ TEST_F(RtcpReceiverTest, InjectXrVoipPacket) { |
rtcp::Xr xr; |
xr.From(0x2345); |
xr.WithVoipMetric(&voip_metric); |
- rtcp::RawPacket p = xr.Build(); |
- EXPECT_EQ(0, InjectRtcpPacket(p.buffer(), p.buffer_length())); |
+ rtc::scoped_ptr<rtcp::RawPacket> packet(xr.Build()); |
+ EXPECT_EQ(0, InjectRtcpPacket(packet->Buffer(), packet->Length())); |
ASSERT_TRUE(rtcp_packet_info_.VoIPMetric != NULL); |
EXPECT_EQ(kLossRate, rtcp_packet_info_.VoIPMetric->lossRate); |
EXPECT_EQ(kRtcpXrVoipMetric, rtcp_packet_info_.rtcpPacketTypeFlags); |
@@ -611,8 +611,8 @@ TEST_F(RtcpReceiverTest, XrVoipPacketNotToUsIgnored) { |
rtcp::Xr xr; |
xr.From(0x2345); |
xr.WithVoipMetric(&voip_metric); |
- rtcp::RawPacket p = xr.Build(); |
- EXPECT_EQ(0, InjectRtcpPacket(p.buffer(), p.buffer_length())); |
+ rtc::scoped_ptr<rtcp::RawPacket> packet(xr.Build()); |
+ EXPECT_EQ(0, InjectRtcpPacket(packet->Buffer(), packet->Length())); |
EXPECT_EQ(0U, rtcp_packet_info_.rtcpPacketTypeFlags); |
} |
@@ -624,8 +624,8 @@ TEST_F(RtcpReceiverTest, InjectXrReceiverReferenceTimePacket) { |
xr.From(0x2345); |
xr.WithRrtr(&rrtr); |
- rtcp::RawPacket p = xr.Build(); |
- EXPECT_EQ(0, InjectRtcpPacket(p.buffer(), p.buffer_length())); |
+ rtc::scoped_ptr<rtcp::RawPacket> packet(xr.Build()); |
+ EXPECT_EQ(0, InjectRtcpPacket(packet->Buffer(), packet->Length())); |
EXPECT_EQ(kRtcpXrReceiverReferenceTime, |
rtcp_packet_info_.rtcpPacketTypeFlags); |
} |
@@ -641,8 +641,8 @@ TEST_F(RtcpReceiverTest, XrDlrrPacketNotToUsIgnored) { |
rtcp::Xr xr; |
xr.From(0x2345); |
xr.WithDlrr(&dlrr); |
- rtcp::RawPacket p = xr.Build(); |
- EXPECT_EQ(0, InjectRtcpPacket(p.buffer(), p.buffer_length())); |
+ rtc::scoped_ptr<rtcp::RawPacket> packet(xr.Build()); |
+ EXPECT_EQ(0, InjectRtcpPacket(packet->Buffer(), packet->Length())); |
EXPECT_EQ(0U, rtcp_packet_info_.rtcpPacketTypeFlags); |
EXPECT_FALSE(rtcp_packet_info_.xr_dlrr_item); |
} |
@@ -658,8 +658,8 @@ TEST_F(RtcpReceiverTest, InjectXrDlrrPacketWithSubBlock) { |
rtcp::Xr xr; |
xr.From(0x2345); |
xr.WithDlrr(&dlrr); |
- rtcp::RawPacket p = xr.Build(); |
- EXPECT_EQ(0, InjectRtcpPacket(p.buffer(), p.buffer_length())); |
+ rtc::scoped_ptr<rtcp::RawPacket> packet(xr.Build()); |
+ EXPECT_EQ(0, InjectRtcpPacket(packet->Buffer(), packet->Length())); |
// The parser should note the DLRR report block item, but not flag the packet |
// since the RTT is not estimated. |
EXPECT_TRUE(rtcp_packet_info_.xr_dlrr_item); |
@@ -678,8 +678,8 @@ TEST_F(RtcpReceiverTest, InjectXrDlrrPacketWithMultipleSubBlocks) { |
rtcp::Xr xr; |
xr.From(0x2345); |
xr.WithDlrr(&dlrr); |
- rtcp::RawPacket p = xr.Build(); |
- EXPECT_EQ(0, InjectRtcpPacket(p.buffer(), p.buffer_length())); |
+ rtc::scoped_ptr<rtcp::RawPacket> packet(xr.Build()); |
+ EXPECT_EQ(0, InjectRtcpPacket(packet->Buffer(), packet->Length())); |
// The parser should note the DLRR report block item, but not flag the packet |
// since the RTT is not estimated. |
EXPECT_TRUE(rtcp_packet_info_.xr_dlrr_item); |
@@ -701,8 +701,8 @@ TEST_F(RtcpReceiverTest, InjectXrPacketWithMultipleReportBlocks) { |
xr.WithRrtr(&rrtr); |
xr.WithDlrr(&dlrr); |
xr.WithVoipMetric(&metric); |
- rtcp::RawPacket p = xr.Build(); |
- EXPECT_EQ(0, InjectRtcpPacket(p.buffer(), p.buffer_length())); |
+ rtc::scoped_ptr<rtcp::RawPacket> packet(xr.Build()); |
+ EXPECT_EQ(0, InjectRtcpPacket(packet->Buffer(), packet->Length())); |
EXPECT_EQ(static_cast<unsigned int>(kRtcpXrReceiverReferenceTime + |
kRtcpXrVoipMetric), |
rtcp_packet_info_.rtcpPacketTypeFlags); |
@@ -729,13 +729,13 @@ TEST_F(RtcpReceiverTest, InjectXrPacketWithUnknownReportBlock) { |
xr.WithRrtr(&rrtr); |
xr.WithDlrr(&dlrr); |
xr.WithVoipMetric(&metric); |
- rtcp::RawPacket p = xr.Build(); |
+ rtc::scoped_ptr<rtcp::RawPacket> packet(xr.Build()); |
// Modify the DLRR block to have an unsupported block type, from 5 to 6. |
- uint8_t* buffer = const_cast<uint8_t*>(p.buffer()); |
+ uint8_t* buffer = const_cast<uint8_t*>(packet->Buffer()); |
EXPECT_EQ(5, buffer[20]); |
buffer[20] = 6; |
- EXPECT_EQ(0, InjectRtcpPacket(p.buffer(), p.buffer_length())); |
+ EXPECT_EQ(0, InjectRtcpPacket(packet->Buffer(), packet->Length())); |
EXPECT_EQ(static_cast<unsigned int>(kRtcpXrReceiverReferenceTime + |
kRtcpXrVoipMetric), |
rtcp_packet_info_.rtcpPacketTypeFlags); |
@@ -764,8 +764,8 @@ TEST_F(RtcpReceiverTest, GetLastReceivedXrReferenceTimeInfo) { |
rtcp::Xr xr; |
xr.From(kSenderSsrc); |
xr.WithRrtr(&rrtr); |
- rtcp::RawPacket p = xr.Build(); |
- EXPECT_EQ(0, InjectRtcpPacket(p.buffer(), p.buffer_length())); |
+ rtc::scoped_ptr<rtcp::RawPacket> packet(xr.Build()); |
+ EXPECT_EQ(0, InjectRtcpPacket(packet->Buffer(), packet->Length())); |
EXPECT_EQ(kRtcpXrReceiverReferenceTime, |
rtcp_packet_info_.rtcpPacketTypeFlags); |
@@ -803,15 +803,15 @@ TEST_F(RtcpReceiverTest, ReceiveReportTimeout) { |
rtcp::ReceiverReport rr1; |
rr1.From(kSenderSsrc); |
rr1.WithReportBlock(&rb1); |
- rtcp::RawPacket p1 = rr1.Build(); |
- EXPECT_EQ(0, InjectRtcpPacket(p1.buffer(), p1.buffer_length())); |
+ rtc::scoped_ptr<rtcp::RawPacket> p1(rr1.Build()); |
+ EXPECT_EQ(0, InjectRtcpPacket(p1->Buffer(), p1->Length())); |
system_clock_.AdvanceTimeMilliseconds(3 * kRtcpIntervalMs - 1); |
EXPECT_FALSE(rtcp_receiver_->RtcpRrTimeout(kRtcpIntervalMs)); |
EXPECT_FALSE(rtcp_receiver_->RtcpRrSequenceNumberTimeout(kRtcpIntervalMs)); |
// Add a RR with the same extended max as the previous RR to trigger a |
// sequence number timeout, but not a RR timeout. |
- EXPECT_EQ(0, InjectRtcpPacket(p1.buffer(), p1.buffer_length())); |
+ EXPECT_EQ(0, InjectRtcpPacket(p1->Buffer(), p1->Length())); |
system_clock_.AdvanceTimeMilliseconds(2); |
EXPECT_FALSE(rtcp_receiver_->RtcpRrTimeout(kRtcpIntervalMs)); |
EXPECT_TRUE(rtcp_receiver_->RtcpRrSequenceNumberTimeout(kRtcpIntervalMs)); |
@@ -832,14 +832,14 @@ TEST_F(RtcpReceiverTest, ReceiveReportTimeout) { |
rtcp::ReceiverReport rr2; |
rr2.From(kSenderSsrc); |
rr2.WithReportBlock(&rb2); |
- rtcp::RawPacket p2 = rr2.Build(); |
- EXPECT_EQ(0, InjectRtcpPacket(p2.buffer(), p2.buffer_length())); |
+ rtc::scoped_ptr<rtcp::RawPacket> p2(rr2.Build()); |
+ EXPECT_EQ(0, InjectRtcpPacket(p2->Buffer(), p2->Length())); |
EXPECT_FALSE(rtcp_receiver_->RtcpRrTimeout(kRtcpIntervalMs)); |
EXPECT_FALSE(rtcp_receiver_->RtcpRrSequenceNumberTimeout(kRtcpIntervalMs)); |
// Verify we can get a timeout again once we've received new RR. |
system_clock_.AdvanceTimeMilliseconds(2 * kRtcpIntervalMs); |
- EXPECT_EQ(0, InjectRtcpPacket(p2.buffer(), p2.buffer_length())); |
+ EXPECT_EQ(0, InjectRtcpPacket(p2->Buffer(), p2->Length())); |
system_clock_.AdvanceTimeMilliseconds(kRtcpIntervalMs + 1); |
EXPECT_FALSE(rtcp_receiver_->RtcpRrTimeout(kRtcpIntervalMs)); |
EXPECT_TRUE(rtcp_receiver_->RtcpRrSequenceNumberTimeout(kRtcpIntervalMs)); |
@@ -867,8 +867,8 @@ TEST_F(RtcpReceiverTest, TmmbrPacketAccepted) { |
rtcp::SenderReport sr; |
sr.From(kSenderSsrc); |
sr.Append(&tmmbr); |
- rtcp::RawPacket p = sr.Build(); |
- EXPECT_EQ(0, InjectRtcpPacket(p.buffer(), p.buffer_length())); |
+ rtc::scoped_ptr<rtcp::RawPacket> packet(sr.Build()); |
+ EXPECT_EQ(0, InjectRtcpPacket(packet->Buffer(), packet->Length())); |
EXPECT_EQ(1, rtcp_receiver_->TMMBRReceived(0, 0, NULL)); |
TMMBRSet candidate_set; |
@@ -890,12 +890,12 @@ TEST_F(RtcpReceiverTest, TmmbrPacketNotForUsIgnored) { |
rtcp::SenderReport sr; |
sr.From(kSenderSsrc); |
sr.Append(&tmmbr); |
- rtcp::RawPacket p = sr.Build(); |
+ rtc::scoped_ptr<rtcp::RawPacket> packet(sr.Build()); |
std::set<uint32_t> ssrcs; |
ssrcs.insert(kMediaFlowSsrc); |
rtcp_receiver_->SetSsrcs(kMediaFlowSsrc, ssrcs); |
- EXPECT_EQ(0, InjectRtcpPacket(p.buffer(), p.buffer_length())); |
+ EXPECT_EQ(0, InjectRtcpPacket(packet->Buffer(), packet->Length())); |
EXPECT_EQ(0, rtcp_receiver_->TMMBRReceived(0, 0, NULL)); |
} |
@@ -914,9 +914,9 @@ TEST_F(RtcpReceiverTest, TmmbrPacketZeroRateIgnored) { |
rtcp::SenderReport sr; |
sr.From(kSenderSsrc); |
sr.Append(&tmmbr); |
- rtcp::RawPacket p = sr.Build(); |
+ rtc::scoped_ptr<rtcp::RawPacket> packet(sr.Build()); |
- EXPECT_EQ(0, InjectRtcpPacket(p.buffer(), p.buffer_length())); |
+ EXPECT_EQ(0, InjectRtcpPacket(packet->Buffer(), packet->Length())); |
EXPECT_EQ(0, rtcp_receiver_->TMMBRReceived(0, 0, NULL)); |
} |
@@ -938,8 +938,8 @@ TEST_F(RtcpReceiverTest, TmmbrThreeConstraintsTimeOut) { |
rtcp::SenderReport sr; |
sr.From(ssrc); |
sr.Append(&tmmbr); |
- rtcp::RawPacket p = sr.Build(); |
- EXPECT_EQ(0, InjectRtcpPacket(p.buffer(), p.buffer_length())); |
+ rtc::scoped_ptr<rtcp::RawPacket> packet(sr.Build()); |
+ EXPECT_EQ(0, InjectRtcpPacket(packet->Buffer(), packet->Length())); |
// 5 seconds between each packet. |
system_clock_.AdvanceTimeMilliseconds(5000); |
} |
@@ -1009,8 +1009,8 @@ TEST_F(RtcpReceiverTest, Callbacks) { |
rtcp::ReceiverReport rr1; |
rr1.From(kSenderSsrc); |
rr1.WithReportBlock(&rb1); |
- rtcp::RawPacket p1 = rr1.Build(); |
- EXPECT_EQ(0, InjectRtcpPacket(p1.buffer(), p1.buffer_length())); |
+ rtc::scoped_ptr<rtcp::RawPacket> p1(rr1.Build()); |
+ EXPECT_EQ(0, InjectRtcpPacket(p1->Buffer(), p1->Length())); |
EXPECT_TRUE(callback.Matches(kSourceSsrc, kSequenceNumber, kFractionLoss, |
kCumulativeLoss, kJitter)); |
@@ -1027,8 +1027,8 @@ TEST_F(RtcpReceiverTest, Callbacks) { |
rtcp::ReceiverReport rr2; |
rr2.From(kSenderSsrc); |
rr2.WithReportBlock(&rb2); |
- rtcp::RawPacket p2 = rr2.Build(); |
- EXPECT_EQ(0, InjectRtcpPacket(p2.buffer(), p2.buffer_length())); |
+ rtc::scoped_ptr<rtcp::RawPacket> p2(rr2.Build()); |
+ EXPECT_EQ(0, InjectRtcpPacket(p2->Buffer(), p2->Length())); |
EXPECT_TRUE(callback.Matches(kSourceSsrc, kSequenceNumber, kFractionLoss, |
kCumulativeLoss, kJitter)); |
} |