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 4ea4dd8c46f875e4f7f911ada6a5bda777721e98..8ba9fe7c952857dc2a3c28a1c3956045fa21d4f4 100644 |
--- a/webrtc/modules/rtp_rtcp/source/rtcp_receiver_unittest.cc |
+++ b/webrtc/modules/rtp_rtcp/source/rtcp_receiver_unittest.cc |
@@ -160,13 +160,12 @@ TEST_F(RtcpReceiverTest, InjectSrPacket) { |
const uint32_t kSenderSsrc = 0x10203; |
rtcp::SenderReport sr; |
sr.From(kSenderSsrc); |
- rtc::scoped_ptr<rtcp::RawPacket> packet(sr.Build()); |
- EXPECT_EQ(0, InjectRtcpPacket(packet->Buffer(), packet->Length())); |
+ rtc::Buffer packet = sr.Build(); |
+ EXPECT_EQ(0, InjectRtcpPacket(packet.data(), packet.size())); |
// 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); |
- EXPECT_EQ(0U, |
- kRtcpSr & rtcp_packet_info_.rtcpPacketTypeFlags); |
+ EXPECT_EQ(0U, kRtcpSr & rtcp_packet_info_.rtcpPacketTypeFlags); |
} |
TEST_F(RtcpReceiverTest, InjectSrPacketFromExpectedPeer) { |
@@ -174,8 +173,8 @@ TEST_F(RtcpReceiverTest, InjectSrPacketFromExpectedPeer) { |
rtcp_receiver_->SetRemoteSSRC(kSenderSsrc); |
rtcp::SenderReport sr; |
sr.From(kSenderSsrc); |
- rtc::scoped_ptr<rtcp::RawPacket> packet(sr.Build()); |
- EXPECT_EQ(0, InjectRtcpPacket(packet->Buffer(), packet->Length())); |
+ rtc::Buffer packet = sr.Build(); |
+ EXPECT_EQ(0, InjectRtcpPacket(packet.data(), packet.size())); |
EXPECT_EQ(kSenderSsrc, rtcp_packet_info_.remoteSSRC); |
EXPECT_EQ(kRtcpSr, rtcp_packet_info_.rtcpPacketTypeFlags); |
} |
@@ -184,8 +183,8 @@ TEST_F(RtcpReceiverTest, InjectRrPacket) { |
const uint32_t kSenderSsrc = 0x10203; |
rtcp::ReceiverReport rr; |
rr.From(kSenderSsrc); |
- rtc::scoped_ptr<rtcp::RawPacket> packet(rr.Build()); |
- EXPECT_EQ(0, InjectRtcpPacket(packet->Buffer(), packet->Length())); |
+ rtc::Buffer packet = rr.Build(); |
+ EXPECT_EQ(0, InjectRtcpPacket(packet.data(), packet.size())); |
EXPECT_EQ(kSenderSsrc, rtcp_packet_info_.remoteSSRC); |
EXPECT_EQ(kRtcpRr, rtcp_packet_info_.rtcpPacketTypeFlags); |
ASSERT_EQ(0u, rtcp_packet_info_.report_blocks.size()); |
@@ -203,8 +202,8 @@ TEST_F(RtcpReceiverTest, InjectRrPacketWithReportBlockNotToUsIgnored) { |
rtcp::ReceiverReport rr; |
rr.From(kSenderSsrc); |
rr.WithReportBlock(rb); |
- rtc::scoped_ptr<rtcp::RawPacket> packet(rr.Build()); |
- EXPECT_EQ(0, InjectRtcpPacket(packet->Buffer(), packet->Length())); |
+ rtc::Buffer packet = rr.Build(); |
+ EXPECT_EQ(0, InjectRtcpPacket(packet.data(), packet.size())); |
EXPECT_EQ(kSenderSsrc, rtcp_packet_info_.remoteSSRC); |
EXPECT_EQ(kRtcpRr, rtcp_packet_info_.rtcpPacketTypeFlags); |
ASSERT_EQ(0u, rtcp_packet_info_.report_blocks.size()); |
@@ -226,8 +225,8 @@ TEST_F(RtcpReceiverTest, InjectRrPacketWithOneReportBlock) { |
rtcp::ReceiverReport rr; |
rr.From(kSenderSsrc); |
rr.WithReportBlock(rb); |
- rtc::scoped_ptr<rtcp::RawPacket> packet(rr.Build()); |
- EXPECT_EQ(0, InjectRtcpPacket(packet->Buffer(), packet->Length())); |
+ rtc::Buffer packet = rr.Build(); |
+ EXPECT_EQ(0, InjectRtcpPacket(packet.data(), packet.size())); |
EXPECT_EQ(kSenderSsrc, rtcp_packet_info_.remoteSSRC); |
EXPECT_EQ(kRtcpRr, rtcp_packet_info_.rtcpPacketTypeFlags); |
ASSERT_EQ(1u, rtcp_packet_info_.report_blocks.size()); |
@@ -263,8 +262,8 @@ TEST_F(RtcpReceiverTest, InjectRrPacketWithTwoReportBlocks) { |
rr1.WithReportBlock(rb1); |
rr1.WithReportBlock(rb2); |
- rtc::scoped_ptr<rtcp::RawPacket> p1(rr1.Build()); |
- EXPECT_EQ(0, InjectRtcpPacket(p1->Buffer(), p1->Length())); |
+ rtc::Buffer p1 = rr1.Build(); |
+ EXPECT_EQ(0, InjectRtcpPacket(p1.data(), p1.size())); |
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); |
@@ -286,8 +285,8 @@ TEST_F(RtcpReceiverTest, InjectRrPacketWithTwoReportBlocks) { |
rr2.WithReportBlock(rb3); |
rr2.WithReportBlock(rb4); |
- rtc::scoped_ptr<rtcp::RawPacket> p2(rr2.Build()); |
- EXPECT_EQ(0, InjectRtcpPacket(p2->Buffer(), p2->Length())); |
+ rtc::Buffer p2 = rr2.Build(); |
+ EXPECT_EQ(0, InjectRtcpPacket(p2.data(), p2.size())); |
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); |
@@ -325,8 +324,8 @@ TEST_F(RtcpReceiverTest, InjectRrPacketsFromTwoRemoteSsrcs) { |
rr1.From(kSenderSsrc1); |
rr1.WithReportBlock(rb1); |
- rtc::scoped_ptr<rtcp::RawPacket> p1(rr1.Build()); |
- EXPECT_EQ(0, InjectRtcpPacket(p1->Buffer(), p1->Length())); |
+ rtc::Buffer p1 = rr1.Build(); |
+ EXPECT_EQ(0, InjectRtcpPacket(p1.data(), p1.size())); |
ASSERT_EQ(1u, rtcp_packet_info_.report_blocks.size()); |
EXPECT_EQ(kFracLost[0], rtcp_packet_info_.report_blocks.front().fractionLost); |
@@ -347,8 +346,8 @@ TEST_F(RtcpReceiverTest, InjectRrPacketsFromTwoRemoteSsrcs) { |
rtcp::ReceiverReport rr2; |
rr2.From(kSenderSsrc2); |
rr2.WithReportBlock(rb2); |
- rtc::scoped_ptr<rtcp::RawPacket> p2(rr2.Build()); |
- EXPECT_EQ(0, InjectRtcpPacket(p2->Buffer(), p2->Length())); |
+ rtc::Buffer p2 = rr2.Build(); |
+ EXPECT_EQ(0, InjectRtcpPacket(p2.data(), p2.size())); |
ASSERT_EQ(1u, rtcp_packet_info_.report_blocks.size()); |
EXPECT_EQ(kFracLost[1], rtcp_packet_info_.report_blocks.front().fractionLost); |
@@ -381,8 +380,8 @@ TEST_F(RtcpReceiverTest, GetRtt) { |
rtcp::ReceiverReport rr; |
rr.From(kSenderSsrc); |
rr.WithReportBlock(rb); |
- rtc::scoped_ptr<rtcp::RawPacket> packet(rr.Build()); |
- EXPECT_EQ(0, InjectRtcpPacket(packet->Buffer(), packet->Length())); |
+ rtc::Buffer packet = rr.Build(); |
+ EXPECT_EQ(0, InjectRtcpPacket(packet.data(), packet.size())); |
EXPECT_EQ(kSenderSsrc, rtcp_packet_info_.remoteSSRC); |
EXPECT_EQ(kRtcpRr, rtcp_packet_info_.rtcpPacketTypeFlags); |
EXPECT_EQ(1u, rtcp_packet_info_.report_blocks.size()); |
@@ -396,8 +395,8 @@ TEST_F(RtcpReceiverTest, GetRtt) { |
TEST_F(RtcpReceiverTest, InjectIjWithNoItem) { |
rtcp::ExtendedJitterReport ij; |
- rtc::scoped_ptr<rtcp::RawPacket> packet(ij.Build()); |
- EXPECT_EQ(0, InjectRtcpPacket(packet->Buffer(), packet->Length())); |
+ rtc::Buffer packet = ij.Build(); |
+ EXPECT_EQ(0, InjectRtcpPacket(packet.data(), packet.size())); |
EXPECT_EQ(0U, rtcp_packet_info_.rtcpPacketTypeFlags); |
} |
@@ -405,8 +404,8 @@ TEST_F(RtcpReceiverTest, InjectIjWithOneItem) { |
rtcp::ExtendedJitterReport ij; |
ij.WithJitter(0x11213141); |
- rtc::scoped_ptr<rtcp::RawPacket> packet(ij.Build()); |
- EXPECT_EQ(0, InjectRtcpPacket(packet->Buffer(), packet->Length())); |
+ rtc::Buffer packet = ij.Build(); |
+ EXPECT_EQ(0, InjectRtcpPacket(packet.data(), packet.size())); |
EXPECT_EQ(kRtcpTransmissionTimeOffset, rtcp_packet_info_.rtcpPacketTypeFlags); |
EXPECT_EQ(0x11213141U, rtcp_packet_info_.interArrivalJitter); |
} |
@@ -420,8 +419,8 @@ TEST_F(RtcpReceiverTest, InjectAppWithNoData) { |
name += 'e'; |
app.WithName(name); |
- rtc::scoped_ptr<rtcp::RawPacket> packet(app.Build()); |
- EXPECT_EQ(0, InjectRtcpPacket(packet->Buffer(), packet->Length())); |
+ rtc::Buffer packet = app.Build(); |
+ EXPECT_EQ(0, InjectRtcpPacket(packet.data(), packet.size())); |
EXPECT_EQ(kRtcpApp, rtcp_packet_info_.rtcpPacketTypeFlags); |
EXPECT_EQ(30, rtcp_packet_info_.applicationSubType); |
EXPECT_EQ(name, rtcp_packet_info_.applicationName); |
@@ -440,8 +439,8 @@ TEST_F(RtcpReceiverTest, InjectAppWithData) { |
const size_t kDataLength = sizeof(kData) / sizeof(kData[0]); |
app.WithData((const uint8_t*)kData, kDataLength); |
- rtc::scoped_ptr<rtcp::RawPacket> packet(app.Build()); |
- EXPECT_EQ(0, InjectRtcpPacket(packet->Buffer(), packet->Length())); |
+ rtc::Buffer packet = app.Build(); |
+ EXPECT_EQ(0, InjectRtcpPacket(packet.data(), packet.size())); |
EXPECT_EQ(kRtcpApp, rtcp_packet_info_.rtcpPacketTypeFlags); |
EXPECT_EQ(30, rtcp_packet_info_.applicationSubType); |
EXPECT_EQ(name, rtcp_packet_info_.applicationName); |
@@ -453,8 +452,8 @@ TEST_F(RtcpReceiverTest, InjectSdesWithOneChunk) { |
rtcp::Sdes sdes; |
sdes.WithCName(kSenderSsrc, "alice@host"); |
- rtc::scoped_ptr<rtcp::RawPacket> packet(sdes.Build()); |
- EXPECT_EQ(0, InjectRtcpPacket(packet->Buffer(), packet->Length())); |
+ rtc::Buffer packet = sdes.Build(); |
+ EXPECT_EQ(0, InjectRtcpPacket(packet.data(), packet.size())); |
char cName[RTCP_CNAME_SIZE]; |
EXPECT_EQ(0, rtcp_receiver_->CNAME(kSenderSsrc, cName)); |
EXPECT_EQ(0, strncmp(cName, "alice@host", RTCP_CNAME_SIZE)); |
@@ -465,16 +464,16 @@ TEST_F(RtcpReceiverTest, InjectByePacket_RemovesCname) { |
rtcp::Sdes sdes; |
sdes.WithCName(kSenderSsrc, "alice@host"); |
- rtc::scoped_ptr<rtcp::RawPacket> packet(sdes.Build()); |
- EXPECT_EQ(0, InjectRtcpPacket(packet->Buffer(), packet->Length())); |
+ rtc::Buffer packet = sdes.Build(); |
+ EXPECT_EQ(0, InjectRtcpPacket(packet.data(), packet.size())); |
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); |
- rtc::scoped_ptr<rtcp::RawPacket> p2(bye.Build()); |
- EXPECT_EQ(0, InjectRtcpPacket(p2->Buffer(), p2->Length())); |
+ rtc::Buffer p2 = bye.Build(); |
+ EXPECT_EQ(0, InjectRtcpPacket(p2.data(), p2.size())); |
EXPECT_EQ(-1, rtcp_receiver_->CNAME(kSenderSsrc, cName)); |
} |
@@ -495,8 +494,8 @@ TEST_F(RtcpReceiverTest, InjectByePacket_RemovesReportBlocks) { |
rr.WithReportBlock(rb1); |
rr.WithReportBlock(rb2); |
- rtc::scoped_ptr<rtcp::RawPacket> p1(rr.Build()); |
- EXPECT_EQ(0, InjectRtcpPacket(p1->Buffer(), p1->Length())); |
+ rtc::Buffer p1 = rr.Build(); |
+ EXPECT_EQ(0, InjectRtcpPacket(p1.data(), p1.size())); |
ASSERT_EQ(2u, rtcp_packet_info_.report_blocks.size()); |
std::vector<RTCPReportBlock> received_blocks; |
rtcp_receiver_->StatisticsReceived(&received_blocks); |
@@ -505,14 +504,14 @@ TEST_F(RtcpReceiverTest, InjectByePacket_RemovesReportBlocks) { |
// Verify that BYE removes the report blocks. |
rtcp::Bye bye; |
bye.From(kSenderSsrc); |
- rtc::scoped_ptr<rtcp::RawPacket> p2(bye.Build()); |
- EXPECT_EQ(0, InjectRtcpPacket(p2->Buffer(), p2->Length())); |
+ rtc::Buffer p2 = bye.Build(); |
+ EXPECT_EQ(0, InjectRtcpPacket(p2.data(), p2.size())); |
received_blocks.clear(); |
rtcp_receiver_->StatisticsReceived(&received_blocks); |
EXPECT_TRUE(received_blocks.empty()); |
// Inject packet. |
- EXPECT_EQ(0, InjectRtcpPacket(p1->Buffer(), p1->Length())); |
+ EXPECT_EQ(0, InjectRtcpPacket(p1.data(), p1.size())); |
ASSERT_EQ(2u, rtcp_packet_info_.report_blocks.size()); |
received_blocks.clear(); |
rtcp_receiver_->StatisticsReceived(&received_blocks); |
@@ -527,8 +526,8 @@ TEST_F(RtcpReceiverTest, InjectPliPacket) { |
rtcp::Pli pli; |
pli.To(kSourceSsrc); |
- rtc::scoped_ptr<rtcp::RawPacket> packet(pli.Build()); |
- EXPECT_EQ(0, InjectRtcpPacket(packet->Buffer(), packet->Length())); |
+ rtc::Buffer packet = pli.Build(); |
+ EXPECT_EQ(0, InjectRtcpPacket(packet.data(), packet.size())); |
EXPECT_EQ(kRtcpPli, rtcp_packet_info_.rtcpPacketTypeFlags); |
} |
@@ -540,8 +539,8 @@ TEST_F(RtcpReceiverTest, PliPacketNotToUsIgnored) { |
rtcp::Pli pli; |
pli.To(kSourceSsrc + 1); |
- rtc::scoped_ptr<rtcp::RawPacket> packet(pli.Build()); |
- EXPECT_EQ(0, InjectRtcpPacket(packet->Buffer(), packet->Length())); |
+ rtc::Buffer packet = pli.Build(); |
+ EXPECT_EQ(0, InjectRtcpPacket(packet.data(), packet.size())); |
EXPECT_EQ(0U, rtcp_packet_info_.rtcpPacketTypeFlags); |
} |
@@ -553,8 +552,8 @@ TEST_F(RtcpReceiverTest, InjectFirPacket) { |
rtcp::Fir fir; |
fir.WithRequestTo(kSourceSsrc, 13); |
- rtc::scoped_ptr<rtcp::RawPacket> packet(fir.Build()); |
- EXPECT_EQ(0, InjectRtcpPacket(packet->Buffer(), packet->Length())); |
+ rtc::Buffer packet = fir.Build(); |
+ EXPECT_EQ(0, InjectRtcpPacket(packet.data(), packet.size())); |
EXPECT_EQ(kRtcpFir, rtcp_packet_info_.rtcpPacketTypeFlags); |
} |
@@ -566,16 +565,16 @@ TEST_F(RtcpReceiverTest, FirPacketNotToUsIgnored) { |
rtcp::Fir fir; |
fir.WithRequestTo(kSourceSsrc + 1, 13); |
- rtc::scoped_ptr<rtcp::RawPacket> packet(fir.Build()); |
- EXPECT_EQ(0, InjectRtcpPacket(packet->Buffer(), packet->Length())); |
+ rtc::Buffer packet = fir.Build(); |
+ EXPECT_EQ(0, InjectRtcpPacket(packet.data(), packet.size())); |
EXPECT_EQ(0U, rtcp_packet_info_.rtcpPacketTypeFlags); |
} |
TEST_F(RtcpReceiverTest, InjectSliPacket) { |
rtcp::Sli sli; |
sli.WithPictureId(40); |
- rtc::scoped_ptr<rtcp::RawPacket> packet(sli.Build()); |
- EXPECT_EQ(0, InjectRtcpPacket(packet->Buffer(), packet->Length())); |
+ rtc::Buffer packet = sli.Build(); |
+ EXPECT_EQ(0, InjectRtcpPacket(packet.data(), packet.size())); |
EXPECT_EQ(kRtcpSli, rtcp_packet_info_.rtcpPacketTypeFlags); |
EXPECT_EQ(40, rtcp_packet_info_.sliPictureId); |
} |
@@ -583,8 +582,8 @@ TEST_F(RtcpReceiverTest, InjectSliPacket) { |
TEST_F(RtcpReceiverTest, ExtendedReportsPacketWithZeroReportBlocksIgnored) { |
rtcp::ExtendedReports xr; |
xr.From(0x2345); |
- rtc::scoped_ptr<rtcp::RawPacket> packet(xr.Build()); |
- EXPECT_EQ(0, InjectRtcpPacket(packet->Buffer(), packet->Length())); |
+ rtc::Buffer packet = xr.Build(); |
+ EXPECT_EQ(0, InjectRtcpPacket(packet.data(), packet.size())); |
EXPECT_EQ(0U, rtcp_packet_info_.rtcpPacketTypeFlags); |
} |
@@ -603,8 +602,8 @@ TEST_F(RtcpReceiverTest, InjectExtendedReportsVoipPacket) { |
rtcp::ExtendedReports xr; |
xr.From(0x2345); |
xr.WithVoipMetric(voip_metric); |
- rtc::scoped_ptr<rtcp::RawPacket> packet(xr.Build()); |
- EXPECT_EQ(0, InjectRtcpPacket(packet->Buffer(), packet->Length())); |
+ rtc::Buffer packet = xr.Build(); |
+ EXPECT_EQ(0, InjectRtcpPacket(packet.data(), packet.size())); |
ASSERT_TRUE(rtcp_packet_info_.VoIPMetric != nullptr); |
EXPECT_EQ(kLossRate, rtcp_packet_info_.VoIPMetric->lossRate); |
EXPECT_EQ(kRtcpXrVoipMetric, rtcp_packet_info_.rtcpPacketTypeFlags); |
@@ -621,8 +620,8 @@ TEST_F(RtcpReceiverTest, ExtendedReportsVoipPacketNotToUsIgnored) { |
rtcp::ExtendedReports xr; |
xr.From(0x2345); |
xr.WithVoipMetric(voip_metric); |
- rtc::scoped_ptr<rtcp::RawPacket> packet(xr.Build()); |
- EXPECT_EQ(0, InjectRtcpPacket(packet->Buffer(), packet->Length())); |
+ rtc::Buffer packet = xr.Build(); |
+ EXPECT_EQ(0, InjectRtcpPacket(packet.data(), packet.size())); |
EXPECT_EQ(0U, rtcp_packet_info_.rtcpPacketTypeFlags); |
} |
@@ -633,8 +632,8 @@ TEST_F(RtcpReceiverTest, InjectExtendedReportsReceiverReferenceTimePacket) { |
xr.From(0x2345); |
xr.WithRrtr(rrtr); |
- rtc::scoped_ptr<rtcp::RawPacket> packet(xr.Build()); |
- EXPECT_EQ(0, InjectRtcpPacket(packet->Buffer(), packet->Length())); |
+ rtc::Buffer packet = xr.Build(); |
+ EXPECT_EQ(0, InjectRtcpPacket(packet.data(), packet.size())); |
EXPECT_EQ(kRtcpXrReceiverReferenceTime, |
rtcp_packet_info_.rtcpPacketTypeFlags); |
} |
@@ -650,8 +649,8 @@ TEST_F(RtcpReceiverTest, ExtendedReportsDlrrPacketNotToUsIgnored) { |
rtcp::ExtendedReports xr; |
xr.From(0x2345); |
xr.WithDlrr(dlrr); |
- rtc::scoped_ptr<rtcp::RawPacket> packet(xr.Build()); |
- EXPECT_EQ(0, InjectRtcpPacket(packet->Buffer(), packet->Length())); |
+ rtc::Buffer packet = xr.Build(); |
+ EXPECT_EQ(0, InjectRtcpPacket(packet.data(), packet.size())); |
EXPECT_EQ(0U, rtcp_packet_info_.rtcpPacketTypeFlags); |
EXPECT_FALSE(rtcp_packet_info_.xr_dlrr_item); |
} |
@@ -667,8 +666,8 @@ TEST_F(RtcpReceiverTest, InjectExtendedReportsDlrrPacketWithSubBlock) { |
rtcp::ExtendedReports xr; |
xr.From(0x2345); |
xr.WithDlrr(dlrr); |
- rtc::scoped_ptr<rtcp::RawPacket> packet(xr.Build()); |
- EXPECT_EQ(0, InjectRtcpPacket(packet->Buffer(), packet->Length())); |
+ rtc::Buffer packet = xr.Build(); |
+ EXPECT_EQ(0, InjectRtcpPacket(packet.data(), packet.size())); |
// 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); |
@@ -687,8 +686,8 @@ TEST_F(RtcpReceiverTest, InjectExtendedReportsDlrrPacketWithMultipleSubBlocks) { |
rtcp::ExtendedReports xr; |
xr.From(0x2345); |
xr.WithDlrr(dlrr); |
- rtc::scoped_ptr<rtcp::RawPacket> packet(xr.Build()); |
- EXPECT_EQ(0, InjectRtcpPacket(packet->Buffer(), packet->Length())); |
+ rtc::Buffer packet = xr.Build(); |
+ EXPECT_EQ(0, InjectRtcpPacket(packet.data(), packet.size())); |
// 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); |
@@ -710,8 +709,8 @@ TEST_F(RtcpReceiverTest, InjectExtendedReportsPacketWithMultipleReportBlocks) { |
xr.WithRrtr(rrtr); |
xr.WithDlrr(dlrr); |
xr.WithVoipMetric(metric); |
- rtc::scoped_ptr<rtcp::RawPacket> packet(xr.Build()); |
- EXPECT_EQ(0, InjectRtcpPacket(packet->Buffer(), packet->Length())); |
+ rtc::Buffer packet = xr.Build(); |
+ EXPECT_EQ(0, InjectRtcpPacket(packet.data(), packet.size())); |
EXPECT_EQ(static_cast<unsigned int>(kRtcpXrReceiverReferenceTime + |
kRtcpXrVoipMetric), |
rtcp_packet_info_.rtcpPacketTypeFlags); |
@@ -738,13 +737,13 @@ TEST_F(RtcpReceiverTest, InjectExtendedReportsPacketWithUnknownReportBlock) { |
xr.WithRrtr(rrtr); |
xr.WithDlrr(dlrr); |
xr.WithVoipMetric(metric); |
- rtc::scoped_ptr<rtcp::RawPacket> packet(xr.Build()); |
+ rtc::Buffer packet = xr.Build(); |
// Modify the DLRR block to have an unsupported block type, from 5 to 6. |
- uint8_t* buffer = const_cast<uint8_t*>(packet->Buffer()); |
+ uint8_t* buffer = packet.data(); |
EXPECT_EQ(5, buffer[20]); |
buffer[20] = 6; |
- EXPECT_EQ(0, InjectRtcpPacket(packet->Buffer(), packet->Length())); |
+ EXPECT_EQ(0, InjectRtcpPacket(packet.data(), packet.size())); |
EXPECT_EQ(static_cast<unsigned int>(kRtcpXrReceiverReferenceTime + |
kRtcpXrVoipMetric), |
rtcp_packet_info_.rtcpPacketTypeFlags); |
@@ -772,8 +771,8 @@ TEST_F(RtcpReceiverTest, GetLastReceivedExtendedReportsReferenceTimeInfo) { |
rtcp::ExtendedReports xr; |
xr.From(kSenderSsrc); |
xr.WithRrtr(rrtr); |
- rtc::scoped_ptr<rtcp::RawPacket> packet(xr.Build()); |
- EXPECT_EQ(0, InjectRtcpPacket(packet->Buffer(), packet->Length())); |
+ rtc::Buffer packet = xr.Build(); |
+ EXPECT_EQ(0, InjectRtcpPacket(packet.data(), packet.size())); |
EXPECT_EQ(kRtcpXrReceiverReferenceTime, |
rtcp_packet_info_.rtcpPacketTypeFlags); |
@@ -811,15 +810,15 @@ TEST_F(RtcpReceiverTest, ReceiveReportTimeout) { |
rtcp::ReceiverReport rr1; |
rr1.From(kSenderSsrc); |
rr1.WithReportBlock(rb1); |
- rtc::scoped_ptr<rtcp::RawPacket> p1(rr1.Build()); |
- EXPECT_EQ(0, InjectRtcpPacket(p1->Buffer(), p1->Length())); |
+ rtc::Buffer p1 = rr1.Build(); |
+ EXPECT_EQ(0, InjectRtcpPacket(p1.data(), p1.size())); |
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->Length())); |
+ EXPECT_EQ(0, InjectRtcpPacket(p1.data(), p1.size())); |
system_clock_.AdvanceTimeMilliseconds(2); |
EXPECT_FALSE(rtcp_receiver_->RtcpRrTimeout(kRtcpIntervalMs)); |
EXPECT_TRUE(rtcp_receiver_->RtcpRrSequenceNumberTimeout(kRtcpIntervalMs)); |
@@ -840,14 +839,14 @@ TEST_F(RtcpReceiverTest, ReceiveReportTimeout) { |
rtcp::ReceiverReport rr2; |
rr2.From(kSenderSsrc); |
rr2.WithReportBlock(rb2); |
- rtc::scoped_ptr<rtcp::RawPacket> p2(rr2.Build()); |
- EXPECT_EQ(0, InjectRtcpPacket(p2->Buffer(), p2->Length())); |
+ rtc::Buffer p2 = rr2.Build(); |
+ EXPECT_EQ(0, InjectRtcpPacket(p2.data(), p2.size())); |
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->Length())); |
+ EXPECT_EQ(0, InjectRtcpPacket(p2.data(), p2.size())); |
system_clock_.AdvanceTimeMilliseconds(kRtcpIntervalMs + 1); |
EXPECT_FALSE(rtcp_receiver_->RtcpRrTimeout(kRtcpIntervalMs)); |
EXPECT_TRUE(rtcp_receiver_->RtcpRrSequenceNumberTimeout(kRtcpIntervalMs)); |
@@ -874,8 +873,8 @@ TEST_F(RtcpReceiverTest, TmmbrPacketAccepted) { |
rtcp::SenderReport sr; |
sr.From(kSenderSsrc); |
sr.Append(&tmmbr); |
- rtc::scoped_ptr<rtcp::RawPacket> packet(sr.Build()); |
- EXPECT_EQ(0, InjectRtcpPacket(packet->Buffer(), packet->Length())); |
+ rtc::Buffer packet = sr.Build(); |
+ EXPECT_EQ(0, InjectRtcpPacket(packet.data(), packet.size())); |
EXPECT_EQ(1, rtcp_receiver_->TMMBRReceived(0, 0, nullptr)); |
TMMBRSet candidate_set; |
@@ -897,12 +896,12 @@ TEST_F(RtcpReceiverTest, TmmbrPacketNotForUsIgnored) { |
rtcp::SenderReport sr; |
sr.From(kSenderSsrc); |
sr.Append(&tmmbr); |
- rtc::scoped_ptr<rtcp::RawPacket> packet(sr.Build()); |
+ rtc::Buffer packet = sr.Build(); |
std::set<uint32_t> ssrcs; |
ssrcs.insert(kMediaFlowSsrc); |
rtcp_receiver_->SetSsrcs(kMediaFlowSsrc, ssrcs); |
- EXPECT_EQ(0, InjectRtcpPacket(packet->Buffer(), packet->Length())); |
+ EXPECT_EQ(0, InjectRtcpPacket(packet.data(), packet.size())); |
EXPECT_EQ(0, rtcp_receiver_->TMMBRReceived(0, 0, nullptr)); |
} |
@@ -920,9 +919,9 @@ TEST_F(RtcpReceiverTest, TmmbrPacketZeroRateIgnored) { |
rtcp::SenderReport sr; |
sr.From(kSenderSsrc); |
sr.Append(&tmmbr); |
- rtc::scoped_ptr<rtcp::RawPacket> packet(sr.Build()); |
+ rtc::Buffer packet = sr.Build(); |
- EXPECT_EQ(0, InjectRtcpPacket(packet->Buffer(), packet->Length())); |
+ EXPECT_EQ(0, InjectRtcpPacket(packet.data(), packet.size())); |
EXPECT_EQ(0, rtcp_receiver_->TMMBRReceived(0, 0, nullptr)); |
} |
@@ -943,8 +942,8 @@ TEST_F(RtcpReceiverTest, TmmbrThreeConstraintsTimeOut) { |
rtcp::SenderReport sr; |
sr.From(ssrc); |
sr.Append(&tmmbr); |
- rtc::scoped_ptr<rtcp::RawPacket> packet(sr.Build()); |
- EXPECT_EQ(0, InjectRtcpPacket(packet->Buffer(), packet->Length())); |
+ rtc::Buffer packet = sr.Build(); |
+ EXPECT_EQ(0, InjectRtcpPacket(packet.data(), packet.size())); |
// 5 seconds between each packet. |
system_clock_.AdvanceTimeMilliseconds(5000); |
} |
@@ -1014,8 +1013,8 @@ TEST_F(RtcpReceiverTest, Callbacks) { |
rtcp::ReceiverReport rr1; |
rr1.From(kSenderSsrc); |
rr1.WithReportBlock(rb1); |
- rtc::scoped_ptr<rtcp::RawPacket> p1(rr1.Build()); |
- EXPECT_EQ(0, InjectRtcpPacket(p1->Buffer(), p1->Length())); |
+ rtc::Buffer p1 = rr1.Build(); |
+ EXPECT_EQ(0, InjectRtcpPacket(p1.data(), p1.size())); |
EXPECT_TRUE(callback.Matches(kSourceSsrc, kSequenceNumber, kFractionLoss, |
kCumulativeLoss, kJitter)); |
@@ -1032,8 +1031,8 @@ TEST_F(RtcpReceiverTest, Callbacks) { |
rtcp::ReceiverReport rr2; |
rr2.From(kSenderSsrc); |
rr2.WithReportBlock(rb2); |
- rtc::scoped_ptr<rtcp::RawPacket> p2(rr2.Build()); |
- EXPECT_EQ(0, InjectRtcpPacket(p2->Buffer(), p2->Length())); |
+ rtc::Buffer p2 = rr2.Build(); |
+ EXPECT_EQ(0, InjectRtcpPacket(p2.data(), p2.size())); |
EXPECT_TRUE(callback.Matches(kSourceSsrc, kSequenceNumber, kFractionLoss, |
kCumulativeLoss, kJitter)); |
} |
@@ -1052,11 +1051,9 @@ TEST_F(RtcpReceiverTest, ReceivesTransportFeedback) { |
packet.WithBase(1, 1000); |
packet.WithReceivedPacket(1, 1000); |
- rtc::scoped_ptr<rtcp::RawPacket> built_packet = packet.Build(); |
- ASSERT_TRUE(built_packet.get() != nullptr); |
+ rtc::Buffer built_packet = packet.Build(); |
- EXPECT_EQ(0, |
- InjectRtcpPacket(built_packet->Buffer(), built_packet->Length())); |
+ EXPECT_EQ(0, InjectRtcpPacket(built_packet.data(), built_packet.size())); |
EXPECT_NE(0u, rtcp_packet_info_.rtcpPacketTypeFlags & kRtcpTransportFeedback); |
EXPECT_TRUE(rtcp_packet_info_.transport_feedback_.get() != nullptr); |
@@ -1083,16 +1080,14 @@ TEST_F(RtcpReceiverTest, HandlesInvalidTransportFeedback) { |
remb.WithBitrateBps(kBitrateBps); |
packet.Append(&remb); |
- rtc::scoped_ptr<rtcp::RawPacket> built_packet = packet.Build(); |
- ASSERT_TRUE(built_packet.get() != nullptr); |
+ rtc::Buffer built_packet = packet.Build(); |
// Modify the TransportFeedback packet so that it is invalid. |
const size_t kStatusCountOffset = 14; |
ByteWriter<uint16_t>::WriteBigEndian( |
- &built_packet->MutableBuffer()[kStatusCountOffset], 42); |
+ &built_packet.data()[kStatusCountOffset], 42); |
- EXPECT_EQ(0, |
- InjectRtcpPacket(built_packet->Buffer(), built_packet->Length())); |
+ EXPECT_EQ(0, InjectRtcpPacket(built_packet.data(), built_packet.size())); |
// Transport feedback should be ignored, but next packet should work. |
EXPECT_EQ(0u, rtcp_packet_info_.rtcpPacketTypeFlags & kRtcpTransportFeedback); |