Revert of Unify rtcp packet setters (patchset #8 id:130001 of https://codereview.webrtc.org/2348623003/ )
Reason for revert:
Breaks compilation of internal downstream project.
Original issue's description:
> Unify rtcp packet setters
> Renamed setters in rtcp classes
> from WithField to SetField
> from WithItem to AddItem or SetItems
> from From to SetSenderSsrc
> from To to SetMediaSsrc
> Some redundant or unsued setters removed.
> Pass-by-const& replaced with pass-by-value when appropriate.
>
> BUG=webrtc:5260
>
> Committed: https://crrev.com/20e77c7b8a9f19942ef3c3c4f1fa3888b2cd54ea
> Cr-Commit-Position: refs/heads/master@{#14393}
TBR=sprang@webrtc.org,stefan@webrtc.org,danilchap@webrtc.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=webrtc:5260
Review-Url: https://codereview.webrtc.org/2372713005
Cr-Commit-Position: refs/heads/master@{#14400}
diff --git a/webrtc/call/rtc_event_log_unittest.cc b/webrtc/call/rtc_event_log_unittest.cc
index 8e92c7e..34e993c 100644
--- a/webrtc/call/rtc_event_log_unittest.cc
+++ b/webrtc/call/rtc_event_log_unittest.cc
@@ -139,14 +139,15 @@
rtc::Buffer GenerateRtcpPacket(Random* prng) {
rtcp::ReportBlock report_block;
- report_block.SetMediaSsrc(prng->Rand<uint32_t>()); // Remote SSRC.
- report_block.SetFractionLost(prng->Rand(50));
+ report_block.To(prng->Rand<uint32_t>()); // Remote SSRC.
+ report_block.WithFractionLost(prng->Rand(50));
rtcp::SenderReport sender_report;
- sender_report.SetSenderSsrc(prng->Rand<uint32_t>());
- sender_report.SetNtp(NtpTime(prng->Rand<uint32_t>(), prng->Rand<uint32_t>()));
- sender_report.SetPacketCount(prng->Rand<uint32_t>());
- sender_report.AddReportBlock(report_block);
+ sender_report.From(prng->Rand<uint32_t>()); // Sender SSRC.
+ sender_report.WithNtp(
+ NtpTime(prng->Rand<uint32_t>(), prng->Rand<uint32_t>()));
+ sender_report.WithPacketCount(prng->Rand<uint32_t>());
+ sender_report.WithReportBlock(report_block);
return sender_report.Build();
}
diff --git a/webrtc/modules/pacing/packet_router.cc b/webrtc/modules/pacing/packet_router.cc
index de8c2ce..be45615 100644
--- a/webrtc/modules/pacing/packet_router.cc
+++ b/webrtc/modules/pacing/packet_router.cc
@@ -99,7 +99,7 @@
bool PacketRouter::SendFeedback(rtcp::TransportFeedback* packet) {
rtc::CritScope cs(&modules_crit_);
for (auto* rtp_module : rtp_modules_) {
- packet->SetSenderSsrc(rtp_module->SSRC());
+ packet->WithPacketSenderSsrc(rtp_module->SSRC());
if (rtp_module->SendFeedbackPacket(*packet))
return true;
}
diff --git a/webrtc/modules/remote_bitrate_estimator/remote_estimator_proxy.cc b/webrtc/modules/remote_bitrate_estimator/remote_estimator_proxy.cc
index b08b30a..ec37c88 100644
--- a/webrtc/modules/remote_bitrate_estimator/remote_estimator_proxy.cc
+++ b/webrtc/modules/remote_bitrate_estimator/remote_estimator_proxy.cc
@@ -152,15 +152,15 @@
// TODO(sprang): Measure receive times in microseconds and remove the
// conversions below.
const int64_t first_sequence = it->first;
- feedback_packet->SetMediaSsrc(media_ssrc_);
+ feedback_packet->WithMediaSourceSsrc(media_ssrc_);
// Base sequence is the expected next (window_start_seq_). This is known, but
// we might not have actually received it, so the base time shall be the time
// of the first received packet in the feedback.
- feedback_packet->SetBase(static_cast<uint16_t>(window_start_seq_ & 0xFFFF),
- it->second * 1000);
- feedback_packet->SetFeedbackSequenceNumber(feedback_sequence_++);
+ feedback_packet->WithBase(static_cast<uint16_t>(window_start_seq_ & 0xFFFF),
+ it->second * 1000);
+ feedback_packet->WithFeedbackSequenceNumber(feedback_sequence_++);
for (; it != packet_arrival_times_.end(); ++it) {
- if (!feedback_packet->AddReceivedPacket(
+ if (!feedback_packet->WithReceivedPacket(
static_cast<uint16_t>(it->first & 0xFFFF), it->second * 1000)) {
// If we can't even add the first seq to the feedback packet, we won't be
// able to build it at all.
diff --git a/webrtc/modules/remote_bitrate_estimator/remote_estimator_proxy_unittest.cc b/webrtc/modules/remote_bitrate_estimator/remote_estimator_proxy_unittest.cc
index 8b8bab4..d999525 100644
--- a/webrtc/modules/remote_bitrate_estimator/remote_estimator_proxy_unittest.cc
+++ b/webrtc/modules/remote_bitrate_estimator/remote_estimator_proxy_unittest.cc
@@ -67,7 +67,7 @@
.WillOnce(Invoke([this](rtcp::TransportFeedback* packet) {
packet->Build();
EXPECT_EQ(kBaseSeq, packet->GetBaseSequence());
- EXPECT_EQ(kMediaSsrc, packet->media_ssrc());
+ EXPECT_EQ(kMediaSsrc, packet->GetMediaSourceSsrc());
std::vector<rtcp::TransportFeedback::StatusSymbol> status_vec =
packet->GetStatusVector();
@@ -92,7 +92,7 @@
.WillOnce(Invoke([this](rtcp::TransportFeedback* packet) {
packet->Build();
EXPECT_EQ(kBaseSeq, packet->GetBaseSequence());
- EXPECT_EQ(kMediaSsrc, packet->media_ssrc());
+ EXPECT_EQ(kMediaSsrc, packet->GetMediaSourceSsrc());
std::vector<rtcp::TransportFeedback::StatusSymbol> status_vec =
packet->GetStatusVector();
@@ -123,7 +123,7 @@
.WillOnce(Invoke([this](rtcp::TransportFeedback* packet) {
packet->Build();
EXPECT_EQ(kBaseSeq + 2, packet->GetBaseSequence());
- EXPECT_EQ(kMediaSsrc, packet->media_ssrc());
+ EXPECT_EQ(kMediaSsrc, packet->GetMediaSourceSsrc());
std::vector<rtcp::TransportFeedback::StatusSymbol> status_vec =
packet->GetStatusVector();
@@ -152,7 +152,7 @@
.WillOnce(Invoke([this](rtcp::TransportFeedback* packet) {
packet->Build();
EXPECT_EQ(kBaseSeq, packet->GetBaseSequence());
- EXPECT_EQ(kMediaSsrc, packet->media_ssrc());
+ EXPECT_EQ(kMediaSsrc, packet->GetMediaSourceSsrc());
std::vector<rtcp::TransportFeedback::StatusSymbol> status_vec =
packet->GetStatusVector();
@@ -188,7 +188,7 @@
.WillOnce(Invoke([kTooLargeDelta, this](rtcp::TransportFeedback* packet) {
packet->Build();
EXPECT_EQ(kBaseSeq, packet->GetBaseSequence());
- EXPECT_EQ(kMediaSsrc, packet->media_ssrc());
+ EXPECT_EQ(kMediaSsrc, packet->GetMediaSourceSsrc());
std::vector<rtcp::TransportFeedback::StatusSymbol> status_vec =
packet->GetStatusVector();
@@ -207,7 +207,7 @@
.WillOnce(Invoke([kTooLargeDelta, this](rtcp::TransportFeedback* packet) {
packet->Build();
EXPECT_EQ(kBaseSeq + 1, packet->GetBaseSequence());
- EXPECT_EQ(kMediaSsrc, packet->media_ssrc());
+ EXPECT_EQ(kMediaSsrc, packet->GetMediaSourceSsrc());
std::vector<rtcp::TransportFeedback::StatusSymbol> status_vec =
packet->GetStatusVector();
@@ -236,7 +236,7 @@
.WillOnce(Invoke([this](rtcp::TransportFeedback* packet) {
packet->Build();
EXPECT_EQ(kBaseSeq, packet->GetBaseSequence());
- EXPECT_EQ(kMediaSsrc, packet->media_ssrc());
+ EXPECT_EQ(kMediaSsrc, packet->GetMediaSourceSsrc());
std::vector<int64_t> delta_vec = packet->GetReceiveDeltasUs();
EXPECT_EQ(1u, delta_vec.size());
@@ -256,7 +256,7 @@
.WillOnce(Invoke([this](rtcp::TransportFeedback* packet) {
packet->Build();
EXPECT_EQ(kBaseSeq, packet->GetBaseSequence());
- EXPECT_EQ(kMediaSsrc, packet->media_ssrc());
+ EXPECT_EQ(kMediaSsrc, packet->GetMediaSourceSsrc());
std::vector<int64_t> delta_vec = packet->GetReceiveDeltasUs();
EXPECT_EQ(2u, delta_vec.size());
@@ -274,7 +274,7 @@
.WillOnce(Invoke([this](rtcp::TransportFeedback* packet) {
packet->Build();
EXPECT_EQ(kBaseSeq + 1, packet->GetBaseSequence());
- EXPECT_EQ(kMediaSsrc, packet->media_ssrc());
+ EXPECT_EQ(kMediaSsrc, packet->GetMediaSourceSsrc());
std::vector<int64_t> delta_vec = packet->GetReceiveDeltasUs();
EXPECT_EQ(2u, delta_vec.size());
diff --git a/webrtc/modules/remote_bitrate_estimator/transport_feedback_adapter_unittest.cc b/webrtc/modules/remote_bitrate_estimator/transport_feedback_adapter_unittest.cc
index e2755b3..2a60da7 100644
--- a/webrtc/modules/remote_bitrate_estimator/transport_feedback_adapter_unittest.cc
+++ b/webrtc/modules/remote_bitrate_estimator/transport_feedback_adapter_unittest.cc
@@ -125,12 +125,12 @@
OnSentPacket(packet);
rtcp::TransportFeedback feedback;
- feedback.SetBase(packets[0].sequence_number,
- packets[0].arrival_time_ms * 1000);
+ feedback.WithBase(packets[0].sequence_number,
+ packets[0].arrival_time_ms * 1000);
for (const PacketInfo& packet : packets) {
- EXPECT_TRUE(feedback.AddReceivedPacket(packet.sequence_number,
- packet.arrival_time_ms * 1000));
+ EXPECT_TRUE(feedback.WithReceivedPacket(packet.sequence_number,
+ packet.arrival_time_ms * 1000));
}
feedback.Build();
@@ -161,13 +161,13 @@
}
rtcp::TransportFeedback feedback;
- feedback.SetBase(packets[0].sequence_number,
- packets[0].arrival_time_ms * 1000);
+ feedback.WithBase(packets[0].sequence_number,
+ packets[0].arrival_time_ms * 1000);
for (const PacketInfo& packet : packets) {
if (packet.sequence_number <= kReceiveSideDropAfter) {
- EXPECT_TRUE(feedback.AddReceivedPacket(packet.sequence_number,
- packet.arrival_time_ms * 1000));
+ EXPECT_TRUE(feedback.WithReceivedPacket(packet.sequence_number,
+ packet.arrival_time_ms * 1000));
}
}
@@ -204,11 +204,11 @@
for (size_t i = 0; i < packets.size(); ++i) {
std::unique_ptr<rtcp::TransportFeedback> feedback(
new rtcp::TransportFeedback());
- feedback->SetBase(packets[i].sequence_number,
- packets[i].arrival_time_ms * 1000);
+ feedback->WithBase(packets[i].sequence_number,
+ packets[i].arrival_time_ms * 1000);
- EXPECT_TRUE(feedback->AddReceivedPacket(packets[i].sequence_number,
- packets[i].arrival_time_ms * 1000));
+ EXPECT_TRUE(feedback->WithReceivedPacket(
+ packets[i].sequence_number, packets[i].arrival_time_ms * 1000));
rtc::Buffer raw_packet = feedback->Build();
feedback = rtcp::TransportFeedback::ParseFrom(raw_packet.data(),
@@ -241,12 +241,12 @@
OnSentPacket(packet);
rtcp::TransportFeedback feedback;
- feedback.SetBase(packets[0].sequence_number,
- packets[0].arrival_time_ms * 1000);
+ feedback.WithBase(packets[0].sequence_number,
+ packets[0].arrival_time_ms * 1000);
for (const PacketInfo& packet : packets) {
- EXPECT_TRUE(feedback.AddReceivedPacket(packet.sequence_number,
- packet.arrival_time_ms * 1000));
+ EXPECT_TRUE(feedback.WithReceivedPacket(packet.sequence_number,
+ packet.arrival_time_ms * 1000));
}
feedback.Build();
@@ -310,15 +310,15 @@
// Create expected feedback and send into adapter.
std::unique_ptr<rtcp::TransportFeedback> feedback(
new rtcp::TransportFeedback());
- feedback->SetBase(sent_packets[0].sequence_number,
- sent_packets[0].arrival_time_ms * 1000);
+ feedback->WithBase(sent_packets[0].sequence_number,
+ sent_packets[0].arrival_time_ms * 1000);
for (const PacketInfo& packet : sent_packets) {
- EXPECT_TRUE(feedback->AddReceivedPacket(packet.sequence_number,
- packet.arrival_time_ms * 1000));
+ EXPECT_TRUE(feedback->WithReceivedPacket(packet.sequence_number,
+ packet.arrival_time_ms * 1000));
}
- EXPECT_FALSE(feedback->AddReceivedPacket(info.sequence_number,
- info.arrival_time_ms * 1000));
+ EXPECT_FALSE(feedback->WithReceivedPacket(info.sequence_number,
+ info.arrival_time_ms * 1000));
rtc::Buffer raw_packet = feedback->Build();
feedback =
@@ -338,9 +338,9 @@
// Create a new feedback message and add the trailing item.
feedback.reset(new rtcp::TransportFeedback());
- feedback->SetBase(info.sequence_number, info.arrival_time_ms * 1000);
- EXPECT_TRUE(feedback->AddReceivedPacket(info.sequence_number,
- info.arrival_time_ms * 1000));
+ feedback->WithBase(info.sequence_number, info.arrival_time_ms * 1000);
+ EXPECT_TRUE(feedback->WithReceivedPacket(info.sequence_number,
+ info.arrival_time_ms * 1000));
raw_packet = feedback->Build();
feedback =
rtcp::TransportFeedback::ParseFrom(raw_packet.data(), raw_packet.size());
diff --git a/webrtc/modules/rtp_rtcp/source/rtcp_packet.h b/webrtc/modules/rtp_rtcp/source/rtcp_packet.h
index 9443b6d..27ec57a 100644
--- a/webrtc/modules/rtp_rtcp/source/rtcp_packet.h
+++ b/webrtc/modules/rtp_rtcp/source/rtcp_packet.h
@@ -21,16 +21,16 @@
//
// Example:
// ReportBlock report_block;
-// report_block.SetMediaSsrc(234);
-// report_block.SetFractionLost(10);
+// report_block.To(234);
+// report_block.WithFractionLost(10);
//
// ReceiverReport rr;
-// rr.SetSenderSsrc(123);
-// rr.AddReportBlock(report_block);
+// rr.From(123);
+// rr.WithReportBlock(report_block);
//
// Fir fir;
-// fir.SetSenderSsrc(123);
-// fir.AddRequestTo(234, 56);
+// fir.From(123);
+// fir.WithRequestTo(234, 56);
//
// size_t length = 0; // Builds an intra frame request
// uint8_t packet[kPacketSize]; // with sequence number 56.
diff --git a/webrtc/modules/rtp_rtcp/source/rtcp_packet/app.cc b/webrtc/modules/rtp_rtcp/source/rtcp_packet/app.cc
index a2d37a4..205fdbb 100644
--- a/webrtc/modules/rtp_rtcp/source/rtcp_packet/app.cc
+++ b/webrtc/modules/rtp_rtcp/source/rtcp_packet/app.cc
@@ -51,12 +51,12 @@
return true;
}
-void App::SetSubType(uint8_t subtype) {
+void App::WithSubType(uint8_t subtype) {
RTC_DCHECK_LE(subtype, 0x1f);
sub_type_ = subtype;
}
-void App::SetData(const uint8_t* data, size_t data_length) {
+void App::WithData(const uint8_t* data, size_t data_length) {
RTC_DCHECK(data);
RTC_DCHECK_EQ(data_length % 4, 0u) << "Data must be 32 bits aligned.";
RTC_DCHECK_LE(data_length, kMaxDataSize) << "App data size " << data_length
diff --git a/webrtc/modules/rtp_rtcp/source/rtcp_packet/app.h b/webrtc/modules/rtp_rtcp/source/rtcp_packet/app.h
index 0b233b3..fea55e4 100644
--- a/webrtc/modules/rtp_rtcp/source/rtcp_packet/app.h
+++ b/webrtc/modules/rtp_rtcp/source/rtcp_packet/app.h
@@ -28,10 +28,10 @@
// Parse assumes header is already parsed and validated.
bool Parse(const CommonHeader& packet);
- void SetSsrc(uint32_t ssrc) { ssrc_ = ssrc; }
- void SetSubType(uint8_t subtype);
- void SetName(uint32_t name) { name_ = name; }
- void SetData(const uint8_t* data, size_t data_length);
+ void From(uint32_t ssrc) { ssrc_ = ssrc; }
+ void WithSubType(uint8_t subtype);
+ void WithName(uint32_t name) { name_ = name; }
+ void WithData(const uint8_t* data, size_t data_length);
uint8_t sub_type() const { return sub_type_; }
uint32_t ssrc() const { return ssrc_; }
diff --git a/webrtc/modules/rtp_rtcp/source/rtcp_packet/app_unittest.cc b/webrtc/modules/rtp_rtcp/source/rtcp_packet/app_unittest.cc
index 6015ab8..abc8f04 100644
--- a/webrtc/modules/rtp_rtcp/source/rtcp_packet/app_unittest.cc
+++ b/webrtc/modules/rtp_rtcp/source/rtcp_packet/app_unittest.cc
@@ -53,9 +53,9 @@
TEST(RtcpPacketAppTest, CreateWithoutData) {
App app;
- app.SetSsrc(kSenderSsrc);
- app.SetSubType(kSubtype);
- app.SetName(kName);
+ app.From(kSenderSsrc);
+ app.WithSubType(kSubtype);
+ app.WithName(kName);
rtc::Buffer raw = app.Build();
@@ -75,10 +75,10 @@
TEST(RtcpPacketAppTest, CreateWithData) {
App app;
- app.SetSsrc(kSenderSsrc);
- app.SetSubType(kSubtype);
- app.SetName(kName);
- app.SetData(kData, sizeof(kData));
+ app.From(kSenderSsrc);
+ app.WithSubType(kSubtype);
+ app.WithName(kName);
+ app.WithData(kData, sizeof(kData));
rtc::Buffer raw = app.Build();
diff --git a/webrtc/modules/rtp_rtcp/source/rtcp_packet/bye.cc b/webrtc/modules/rtp_rtcp/source/rtcp_packet/bye.cc
index 610dfe3..7b688ab 100644
--- a/webrtc/modules/rtp_rtcp/source/rtcp_packet/bye.cc
+++ b/webrtc/modules/rtp_rtcp/source/rtcp_packet/bye.cc
@@ -10,8 +10,6 @@
#include "webrtc/modules/rtp_rtcp/source/rtcp_packet/bye.h"
-#include <utility>
-
#include "webrtc/base/checks.h"
#include "webrtc/base/logging.h"
#include "webrtc/modules/rtp_rtcp/source/byte_io.h"
@@ -111,18 +109,18 @@
return true;
}
-bool Bye::SetCsrcs(std::vector<uint32_t> csrcs) {
- if (csrcs.size() > kMaxNumberOfCsrcs) {
- LOG(LS_WARNING) << "Too many CSRCs for Bye packet.";
+bool Bye::WithCsrc(uint32_t csrc) {
+ if (csrcs_.size() >= kMaxNumberOfCsrcs) {
+ LOG(LS_WARNING) << "Max CSRC size reached.";
return false;
}
- csrcs_ = std::move(csrcs);
+ csrcs_.push_back(csrc);
return true;
}
-void Bye::SetReason(std::string reason) {
+void Bye::WithReason(const std::string& reason) {
RTC_DCHECK_LE(reason.size(), 0xffu);
- reason_ = std::move(reason);
+ reason_ = reason;
}
size_t Bye::BlockLength() const {
diff --git a/webrtc/modules/rtp_rtcp/source/rtcp_packet/bye.h b/webrtc/modules/rtp_rtcp/source/rtcp_packet/bye.h
index c1db9e8..ad28cb3 100644
--- a/webrtc/modules/rtp_rtcp/source/rtcp_packet/bye.h
+++ b/webrtc/modules/rtp_rtcp/source/rtcp_packet/bye.h
@@ -32,9 +32,9 @@
// Parse assumes header is already parsed and validated.
bool Parse(const CommonHeader& packet);
- void SetSenderSsrc(uint32_t ssrc) { sender_ssrc_ = ssrc; }
- bool SetCsrcs(std::vector<uint32_t> csrcs);
- void SetReason(std::string reason);
+ void From(uint32_t ssrc) { sender_ssrc_ = ssrc; }
+ bool WithCsrc(uint32_t csrc);
+ void WithReason(const std::string& reason);
uint32_t sender_ssrc() const { return sender_ssrc_; }
const std::vector<uint32_t>& csrcs() const { return csrcs_; }
diff --git a/webrtc/modules/rtp_rtcp/source/rtcp_packet/bye_unittest.cc b/webrtc/modules/rtp_rtcp/source/rtcp_packet/bye_unittest.cc
index c90566b..fbea60a 100644
--- a/webrtc/modules/rtp_rtcp/source/rtcp_packet/bye_unittest.cc
+++ b/webrtc/modules/rtp_rtcp/source/rtcp_packet/bye_unittest.cc
@@ -26,7 +26,7 @@
TEST(RtcpPacketByeTest, CreateAndParseWithoutReason) {
Bye bye;
- bye.SetSenderSsrc(kSenderSsrc);
+ bye.From(kSenderSsrc);
rtc::Buffer raw = bye.Build();
Bye parsed_bye;
@@ -39,8 +39,9 @@
TEST(RtcpPacketByeTest, CreateAndParseWithCsrcs) {
Bye bye;
- bye.SetSenderSsrc(kSenderSsrc);
- EXPECT_TRUE(bye.SetCsrcs({kCsrc1, kCsrc2}));
+ bye.From(kSenderSsrc);
+ EXPECT_TRUE(bye.WithCsrc(kCsrc1));
+ EXPECT_TRUE(bye.WithCsrc(kCsrc2));
EXPECT_TRUE(bye.reason().empty());
rtc::Buffer raw = bye.Build();
@@ -56,9 +57,10 @@
Bye bye;
const std::string kReason = "Some Reason";
- bye.SetSenderSsrc(kSenderSsrc);
- EXPECT_TRUE(bye.SetCsrcs({kCsrc1, kCsrc2}));
- bye.SetReason(kReason);
+ bye.From(kSenderSsrc);
+ EXPECT_TRUE(bye.WithCsrc(kCsrc1));
+ EXPECT_TRUE(bye.WithCsrc(kCsrc2));
+ bye.WithReason(kReason);
rtc::Buffer raw = bye.Build();
Bye parsed_bye;
@@ -71,18 +73,20 @@
TEST(RtcpPacketByeTest, CreateWithTooManyCsrcs) {
Bye bye;
- bye.SetSenderSsrc(kSenderSsrc);
+ bye.From(kSenderSsrc);
const int kMaxCsrcs = (1 << 5) - 2; // 5 bit len, first item is sender SSRC.
- EXPECT_TRUE(bye.SetCsrcs(std::vector<uint32_t>(kMaxCsrcs, kCsrc1)));
- EXPECT_FALSE(bye.SetCsrcs(std::vector<uint32_t>(kMaxCsrcs + 1, kCsrc1)));
+ for (int i = 0; i < kMaxCsrcs; ++i) {
+ EXPECT_TRUE(bye.WithCsrc(i));
+ }
+ EXPECT_FALSE(bye.WithCsrc(kMaxCsrcs));
}
TEST(RtcpPacketByeTest, CreateAndParseWithAReason) {
Bye bye;
const std::string kReason = "Some Random Reason";
- bye.SetSenderSsrc(kSenderSsrc);
- bye.SetReason(kReason);
+ bye.From(kSenderSsrc);
+ bye.WithReason(kReason);
rtc::Buffer raw = bye.Build();
Bye parsed_bye;
@@ -99,8 +103,8 @@
for (size_t reminder = 0; reminder < 4; ++reminder) {
const std::string kReason(4 + reminder, 'a' + reminder);
Bye bye;
- bye.SetSenderSsrc(kSenderSsrc);
- bye.SetReason(kReason);
+ bye.From(kSenderSsrc);
+ bye.WithReason(kReason);
rtc::Buffer raw = bye.Build();
Bye parsed_bye;
@@ -121,7 +125,7 @@
TEST(RtcpPacketByeTest, ParseFailOnInvalidSrcCount) {
Bye bye;
- bye.SetSenderSsrc(kSenderSsrc);
+ bye.From(kSenderSsrc);
rtc::Buffer raw = bye.Build();
raw[0]++; // Damage the packet: increase ssrc count by one.
@@ -132,8 +136,8 @@
TEST(RtcpPacketByeTest, ParseFailOnInvalidReasonLength) {
Bye bye;
- bye.SetSenderSsrc(kSenderSsrc);
- bye.SetReason("18 characters long");
+ bye.From(kSenderSsrc);
+ bye.WithReason("18 characters long");
rtc::Buffer raw = bye.Build();
// Damage the packet: decrease payload size by 4 bytes
diff --git a/webrtc/modules/rtp_rtcp/source/rtcp_packet/compound_packet_unittest.cc b/webrtc/modules/rtp_rtcp/source/rtcp_packet/compound_packet_unittest.cc
index 5e2c7df..94686fb 100644
--- a/webrtc/modules/rtp_rtcp/source/rtcp_packet/compound_packet_unittest.cc
+++ b/webrtc/modules/rtp_rtcp/source/rtcp_packet/compound_packet_unittest.cc
@@ -35,11 +35,11 @@
TEST(RtcpCompoundPacketTest, AppendPacket) {
CompoundPacket compound;
Fir fir;
- fir.AddRequestTo(kRemoteSsrc, kSeqNo);
+ fir.WithRequestTo(kRemoteSsrc, kSeqNo);
ReportBlock rb;
ReceiverReport rr;
- rr.SetSenderSsrc(kSenderSsrc);
- EXPECT_TRUE(rr.AddReportBlock(rb));
+ rr.From(kSenderSsrc);
+ EXPECT_TRUE(rr.WithReportBlock(rb));
compound.Append(&rr);
compound.Append(&fir);
@@ -56,12 +56,12 @@
CompoundPacket root;
CompoundPacket leaf;
Fir fir;
- fir.AddRequestTo(kRemoteSsrc, kSeqNo);
+ fir.WithRequestTo(kRemoteSsrc, kSeqNo);
Bye bye;
ReportBlock rb;
ReceiverReport rr;
- EXPECT_TRUE(rr.AddReportBlock(rb));
+ EXPECT_TRUE(rr.WithReportBlock(rb));
leaf.Append(&rr);
leaf.Append(&fir);
@@ -83,11 +83,11 @@
TEST(RtcpCompoundPacketTest, BuildWithInputBuffer) {
CompoundPacket compound;
Fir fir;
- fir.AddRequestTo(kRemoteSsrc, kSeqNo);
+ fir.WithRequestTo(kRemoteSsrc, kSeqNo);
ReportBlock rb;
ReceiverReport rr;
- rr.SetSenderSsrc(kSenderSsrc);
- EXPECT_TRUE(rr.AddReportBlock(rb));
+ rr.From(kSenderSsrc);
+ EXPECT_TRUE(rr.WithReportBlock(rb));
compound.Append(&rr);
compound.Append(&fir);
@@ -117,11 +117,11 @@
TEST(RtcpCompoundPacketTest, BuildWithTooSmallBuffer_FragmentedSend) {
CompoundPacket compound;
Fir fir;
- fir.AddRequestTo(kRemoteSsrc, kSeqNo);
+ fir.WithRequestTo(kRemoteSsrc, kSeqNo);
ReportBlock rb;
ReceiverReport rr;
- rr.SetSenderSsrc(kSenderSsrc);
- EXPECT_TRUE(rr.AddReportBlock(rb));
+ rr.From(kSenderSsrc);
+ EXPECT_TRUE(rr.WithReportBlock(rb));
compound.Append(&rr);
compound.Append(&fir);
diff --git a/webrtc/modules/rtp_rtcp/source/rtcp_packet/dlrr.cc b/webrtc/modules/rtp_rtcp/source/rtcp_packet/dlrr.cc
index 97516f1..45c4b63 100644
--- a/webrtc/modules/rtp_rtcp/source/rtcp_packet/dlrr.cc
+++ b/webrtc/modules/rtp_rtcp/source/rtcp_packet/dlrr.cc
@@ -81,7 +81,7 @@
RTC_DCHECK_EQ(buffer + BlockLength(), write_at);
}
-bool Dlrr::AddDlrrItem(const ReceiveTimeInfo& block) {
+bool Dlrr::WithDlrrItem(const ReceiveTimeInfo& block) {
if (sub_blocks_.size() >= kMaxNumberOfDlrrItems) {
LOG(LS_WARNING) << "Max DLRR items reached.";
return false;
@@ -90,14 +90,14 @@
return true;
}
-bool Dlrr::AddDlrrItem(uint32_t ssrc,
- uint32_t last_rr,
- uint32_t delay_last_rr) {
+bool Dlrr::WithDlrrItem(uint32_t ssrc,
+ uint32_t last_rr,
+ uint32_t delay_last_rr) {
ReceiveTimeInfo block;
block.ssrc = ssrc;
block.last_rr = last_rr;
block.delay_since_last_rr = delay_last_rr;
- return AddDlrrItem(block);
+ return WithDlrrItem(block);
}
} // namespace rtcp
} // namespace webrtc
diff --git a/webrtc/modules/rtp_rtcp/source/rtcp_packet/dlrr.h b/webrtc/modules/rtp_rtcp/source/rtcp_packet/dlrr.h
index c2a4b8f..a48c339 100644
--- a/webrtc/modules/rtp_rtcp/source/rtcp_packet/dlrr.h
+++ b/webrtc/modules/rtp_rtcp/source/rtcp_packet/dlrr.h
@@ -50,8 +50,8 @@
void Create(uint8_t* buffer) const;
// Max 100 DLRR Items can be added per DLRR report block.
- bool AddDlrrItem(const ReceiveTimeInfo& time_info);
- bool AddDlrrItem(uint32_t ssrc, uint32_t last_rr, uint32_t delay_last_rr);
+ bool WithDlrrItem(const ReceiveTimeInfo& time_info);
+ bool WithDlrrItem(uint32_t ssrc, uint32_t last_rr, uint32_t delay_last_rr);
const std::vector<ReceiveTimeInfo>& sub_blocks() const { return sub_blocks_; }
diff --git a/webrtc/modules/rtp_rtcp/source/rtcp_packet/dlrr_unittest.cc b/webrtc/modules/rtp_rtcp/source/rtcp_packet/dlrr_unittest.cc
index 469a466..1bf0cc4 100644
--- a/webrtc/modules/rtp_rtcp/source/rtcp_packet/dlrr_unittest.cc
+++ b/webrtc/modules/rtp_rtcp/source/rtcp_packet/dlrr_unittest.cc
@@ -35,7 +35,7 @@
TEST(RtcpPacketDlrrTest, Create) {
Dlrr dlrr;
- EXPECT_TRUE(dlrr.AddDlrrItem(kSsrc, kLastRR, kDelay));
+ EXPECT_TRUE(dlrr.WithDlrrItem(kSsrc, kLastRR, kDelay));
ASSERT_EQ(kBlockSizeBytes, dlrr.BlockLength());
uint8_t buffer[kBlockSizeBytes];
@@ -73,9 +73,9 @@
TEST(RtcpPacketDlrrTest, FailsOnTooManySubBlocks) {
Dlrr dlrr;
for (size_t i = 1; i <= Dlrr::kMaxNumberOfDlrrItems; ++i) {
- EXPECT_TRUE(dlrr.AddDlrrItem(kSsrc + i, kLastRR + i, kDelay + i));
+ EXPECT_TRUE(dlrr.WithDlrrItem(kSsrc + i, kLastRR + i, kDelay + i));
}
- EXPECT_FALSE(dlrr.AddDlrrItem(kSsrc, kLastRR, kDelay));
+ EXPECT_FALSE(dlrr.WithDlrrItem(kSsrc, kLastRR, kDelay));
}
TEST(RtcpPacketDlrrTest, CreateAndParseMaxSubBlocks) {
@@ -85,7 +85,7 @@
// Create.
Dlrr dlrr;
for (size_t i = 1; i <= Dlrr::kMaxNumberOfDlrrItems; ++i) {
- EXPECT_TRUE(dlrr.AddDlrrItem(kSsrc + i, kLastRR + i, kDelay + i));
+ EXPECT_TRUE(dlrr.WithDlrrItem(kSsrc + i, kLastRR + i, kDelay + i));
}
size_t used_buffer_size = dlrr.BlockLength();
ASSERT_LE(used_buffer_size, kBufferSize);
diff --git a/webrtc/modules/rtp_rtcp/source/rtcp_packet/extended_jitter_report.cc b/webrtc/modules/rtp_rtcp/source/rtcp_packet/extended_jitter_report.cc
index c296dbc..fc3a810 100644
--- a/webrtc/modules/rtp_rtcp/source/rtcp_packet/extended_jitter_report.cc
+++ b/webrtc/modules/rtp_rtcp/source/rtcp_packet/extended_jitter_report.cc
@@ -10,8 +10,6 @@
#include "webrtc/modules/rtp_rtcp/source/rtcp_packet/extended_jitter_report.h"
-#include <utility>
-
#include "webrtc/base/checks.h"
#include "webrtc/base/logging.h"
#include "webrtc/modules/rtp_rtcp/source/byte_io.h"
@@ -58,12 +56,12 @@
return true;
}
-bool ExtendedJitterReport::SetJitterValues(std::vector<uint32_t> values) {
- if (values.size() > kMaxNumberOfJitterValues) {
- LOG(LS_WARNING) << "Too many inter-arrival jitter items.";
+bool ExtendedJitterReport::WithJitter(uint32_t jitter) {
+ if (inter_arrival_jitters_.size() >= kMaxNumberOfJitters) {
+ LOG(LS_WARNING) << "Max inter-arrival jitter items reached.";
return false;
}
- inter_arrival_jitters_ = std::move(values);
+ inter_arrival_jitters_.push_back(jitter);
return true;
}
diff --git a/webrtc/modules/rtp_rtcp/source/rtcp_packet/extended_jitter_report.h b/webrtc/modules/rtp_rtcp/source/rtcp_packet/extended_jitter_report.h
index b26dc46..7731988 100644
--- a/webrtc/modules/rtp_rtcp/source/rtcp_packet/extended_jitter_report.h
+++ b/webrtc/modules/rtp_rtcp/source/rtcp_packet/extended_jitter_report.h
@@ -23,7 +23,6 @@
class ExtendedJitterReport : public RtcpPacket {
public:
static constexpr uint8_t kPacketType = 195;
- static constexpr size_t kMaxNumberOfJitterValues = 0x1f;
ExtendedJitterReport() {}
~ExtendedJitterReport() override {}
@@ -31,11 +30,9 @@
// Parse assumes header is already parsed and validated.
bool Parse(const CommonHeader& packet);
- bool SetJitterValues(std::vector<uint32_t> jitter_values);
+ bool WithJitter(uint32_t jitter);
- const std::vector<uint32_t>& jitter_values() {
- return inter_arrival_jitters_;
- }
+ const std::vector<uint32_t>& jitters() { return inter_arrival_jitters_; }
protected:
bool Create(uint8_t* packet,
@@ -44,6 +41,7 @@
RtcpPacket::PacketReadyCallback* callback) const override;
private:
+ static constexpr size_t kMaxNumberOfJitters = 0x1f;
static constexpr size_t kJitterSizeBytes = 4;
size_t BlockLength() const override {
diff --git a/webrtc/modules/rtp_rtcp/source/rtcp_packet/extended_jitter_report_unittest.cc b/webrtc/modules/rtp_rtcp/source/rtcp_packet/extended_jitter_report_unittest.cc
index f1ce6a9..c9e01aa 100644
--- a/webrtc/modules/rtp_rtcp/source/rtcp_packet/extended_jitter_report_unittest.cc
+++ b/webrtc/modules/rtp_rtcp/source/rtcp_packet/extended_jitter_report_unittest.cc
@@ -31,42 +31,44 @@
ExtendedJitterReport parsed;
EXPECT_TRUE(test::ParseSinglePacket(raw, &parsed));
- EXPECT_THAT(parsed.jitter_values(), IsEmpty());
+ EXPECT_THAT(parsed.jitters(), IsEmpty());
}
TEST(RtcpPacketExtendedJitterReportTest, CreateAndParseWithOneItem) {
ExtendedJitterReport ij;
- EXPECT_TRUE(ij.SetJitterValues({kJitter1}));
+ EXPECT_TRUE(ij.WithJitter(kJitter1));
rtc::Buffer raw = ij.Build();
ExtendedJitterReport parsed;
EXPECT_TRUE(test::ParseSinglePacket(raw, &parsed));
- EXPECT_THAT(parsed.jitter_values(), ElementsAre(kJitter1));
+ EXPECT_THAT(parsed.jitters(), ElementsAre(kJitter1));
}
TEST(RtcpPacketExtendedJitterReportTest, CreateAndParseWithTwoItems) {
ExtendedJitterReport ij;
- EXPECT_TRUE(ij.SetJitterValues({kJitter1, kJitter2}));
+ EXPECT_TRUE(ij.WithJitter(kJitter1));
+ EXPECT_TRUE(ij.WithJitter(kJitter2));
rtc::Buffer raw = ij.Build();
ExtendedJitterReport parsed;
EXPECT_TRUE(test::ParseSinglePacket(raw, &parsed));
- EXPECT_THAT(parsed.jitter_values(), ElementsAre(kJitter1, kJitter2));
+ EXPECT_THAT(parsed.jitters(), ElementsAre(kJitter1, kJitter2));
}
TEST(RtcpPacketExtendedJitterReportTest, CreateWithTooManyItems) {
ExtendedJitterReport ij;
- const int kMaxItems = ExtendedJitterReport::kMaxNumberOfJitterValues;
- EXPECT_FALSE(
- ij.SetJitterValues(std::vector<uint32_t>(kMaxItems + 1, kJitter1)));
- EXPECT_TRUE(ij.SetJitterValues(std::vector<uint32_t>(kMaxItems, kJitter1)));
+ const int kMaxIjItems = (1 << 5) - 1;
+ for (int i = 0; i < kMaxIjItems; ++i) {
+ EXPECT_TRUE(ij.WithJitter(i));
+ }
+ EXPECT_FALSE(ij.WithJitter(kMaxIjItems));
}
TEST(RtcpPacketExtendedJitterReportTest, ParseFailsWithTooManyItems) {
ExtendedJitterReport ij;
- ij.SetJitterValues({kJitter1});
+ ij.WithJitter(kJitter1);
rtc::Buffer raw = ij.Build();
raw[0]++; // Damage packet: increase jitter count by 1.
ExtendedJitterReport parsed;
diff --git a/webrtc/modules/rtp_rtcp/source/rtcp_packet/extended_reports.cc b/webrtc/modules/rtp_rtcp/source/rtcp_packet/extended_reports.cc
index 0199b52..9e704b1 100644
--- a/webrtc/modules/rtp_rtcp/source/rtcp_packet/extended_reports.cc
+++ b/webrtc/modules/rtp_rtcp/source/rtcp_packet/extended_reports.cc
@@ -91,7 +91,7 @@
return true;
}
-bool ExtendedReports::AddRrtr(const Rrtr& rrtr) {
+bool ExtendedReports::WithRrtr(const Rrtr& rrtr) {
if (rrtr_blocks_.size() >= kMaxNumberOfRrtrBlocks) {
LOG(LS_WARNING) << "Max RRTR blocks reached.";
return false;
@@ -100,7 +100,7 @@
return true;
}
-bool ExtendedReports::AddDlrr(const Dlrr& dlrr) {
+bool ExtendedReports::WithDlrr(const Dlrr& dlrr) {
if (dlrr_blocks_.size() >= kMaxNumberOfDlrrBlocks) {
LOG(LS_WARNING) << "Max DLRR blocks reached.";
return false;
@@ -109,7 +109,7 @@
return true;
}
-bool ExtendedReports::AddVoipMetric(const VoipMetric& voip_metric) {
+bool ExtendedReports::WithVoipMetric(const VoipMetric& voip_metric) {
if (voip_metric_blocks_.size() >= kMaxNumberOfVoipMetricBlocks) {
LOG(LS_WARNING) << "Max Voip Metric blocks reached.";
return false;
diff --git a/webrtc/modules/rtp_rtcp/source/rtcp_packet/extended_reports.h b/webrtc/modules/rtp_rtcp/source/rtcp_packet/extended_reports.h
index 7b6c544..b15d416 100644
--- a/webrtc/modules/rtp_rtcp/source/rtcp_packet/extended_reports.h
+++ b/webrtc/modules/rtp_rtcp/source/rtcp_packet/extended_reports.h
@@ -34,12 +34,12 @@
// Parse assumes header is already parsed and validated.
bool Parse(const CommonHeader& packet);
- void SetSenderSsrc(uint32_t ssrc) { sender_ssrc_ = ssrc; }
+ void From(uint32_t ssrc) { sender_ssrc_ = ssrc; }
// Max 50 items of each of {Rrtr, Dlrr, VoipMetric} allowed per Xr.
- bool AddRrtr(const Rrtr& rrtr);
- bool AddDlrr(const Dlrr& dlrr);
- bool AddVoipMetric(const VoipMetric& voip_metric);
+ bool WithRrtr(const Rrtr& rrtr);
+ bool WithDlrr(const Dlrr& dlrr);
+ bool WithVoipMetric(const VoipMetric& voip_metric);
uint32_t sender_ssrc() const { return sender_ssrc_; }
const std::vector<Rrtr>& rrtrs() const { return rrtr_blocks_; }
diff --git a/webrtc/modules/rtp_rtcp/source/rtcp_packet/extended_reports_unittest.cc b/webrtc/modules/rtp_rtcp/source/rtcp_packet/extended_reports_unittest.cc
index 8cb144d..133e840 100644
--- a/webrtc/modules/rtp_rtcp/source/rtcp_packet/extended_reports_unittest.cc
+++ b/webrtc/modules/rtp_rtcp/source/rtcp_packet/extended_reports_unittest.cc
@@ -110,7 +110,7 @@
template <>
Rrtr RtcpPacketExtendedReportsTest::Rand<Rrtr>() {
Rrtr rrtr;
- rrtr.SetNtp(Rand<NtpTime>());
+ rrtr.WithNtp(Rand<NtpTime>());
return rrtr;
}
@@ -143,14 +143,14 @@
template <>
VoipMetric RtcpPacketExtendedReportsTest::Rand<VoipMetric>() {
VoipMetric voip_metric;
- voip_metric.SetMediaSsrc(Rand<uint32_t>());
- voip_metric.SetVoipMetric(Rand<RTCPVoIPMetric>());
+ voip_metric.To(Rand<uint32_t>());
+ voip_metric.WithVoipMetric(Rand<RTCPVoIPMetric>());
return voip_metric;
}
TEST_F(RtcpPacketExtendedReportsTest, CreateWithoutReportBlocks) {
ExtendedReports xr;
- xr.SetSenderSsrc(kSenderSsrc);
+ xr.From(kSenderSsrc);
rtc::Buffer packet = xr.Build();
@@ -170,8 +170,8 @@
TEST_F(RtcpPacketExtendedReportsTest, CreateAndParseWithOneRrtrBlock) {
Rrtr rrtr = Rand<Rrtr>();
ExtendedReports xr;
- xr.SetSenderSsrc(kSenderSsrc);
- EXPECT_TRUE(xr.AddRrtr(rrtr));
+ xr.From(kSenderSsrc);
+ EXPECT_TRUE(xr.WithRrtr(rrtr));
rtc::Buffer packet = xr.Build();
ExtendedReports mparsed;
@@ -186,9 +186,9 @@
Rrtr rrtr1 = Rand<Rrtr>();
Rrtr rrtr2 = Rand<Rrtr>();
ExtendedReports xr;
- xr.SetSenderSsrc(kSenderSsrc);
- EXPECT_TRUE(xr.AddRrtr(rrtr1));
- EXPECT_TRUE(xr.AddRrtr(rrtr2));
+ xr.From(kSenderSsrc);
+ EXPECT_TRUE(xr.WithRrtr(rrtr1));
+ EXPECT_TRUE(xr.WithRrtr(rrtr2));
rtc::Buffer packet = xr.Build();
@@ -202,10 +202,10 @@
TEST_F(RtcpPacketExtendedReportsTest, CreateAndParseWithDlrrWithOneSubBlock) {
Dlrr dlrr;
- EXPECT_TRUE(dlrr.AddDlrrItem(Rand<ReceiveTimeInfo>()));
+ EXPECT_TRUE(dlrr.WithDlrrItem(Rand<ReceiveTimeInfo>()));
ExtendedReports xr;
- xr.SetSenderSsrc(kSenderSsrc);
- EXPECT_TRUE(xr.AddDlrr(dlrr));
+ xr.From(kSenderSsrc);
+ EXPECT_TRUE(xr.WithDlrr(dlrr));
rtc::Buffer packet = xr.Build();
@@ -219,11 +219,11 @@
TEST_F(RtcpPacketExtendedReportsTest, CreateAndParseWithDlrrWithTwoSubBlocks) {
Dlrr dlrr;
- EXPECT_TRUE(dlrr.AddDlrrItem(Rand<ReceiveTimeInfo>()));
- EXPECT_TRUE(dlrr.AddDlrrItem(Rand<ReceiveTimeInfo>()));
+ EXPECT_TRUE(dlrr.WithDlrrItem(Rand<ReceiveTimeInfo>()));
+ EXPECT_TRUE(dlrr.WithDlrrItem(Rand<ReceiveTimeInfo>()));
ExtendedReports xr;
- xr.SetSenderSsrc(kSenderSsrc);
- EXPECT_TRUE(xr.AddDlrr(dlrr));
+ xr.From(kSenderSsrc);
+ EXPECT_TRUE(xr.WithDlrr(dlrr));
rtc::Buffer packet = xr.Build();
@@ -237,13 +237,13 @@
TEST_F(RtcpPacketExtendedReportsTest, CreateAndParseWithTwoDlrrBlocks) {
Dlrr dlrr1;
- EXPECT_TRUE(dlrr1.AddDlrrItem(Rand<ReceiveTimeInfo>()));
+ EXPECT_TRUE(dlrr1.WithDlrrItem(Rand<ReceiveTimeInfo>()));
Dlrr dlrr2;
- EXPECT_TRUE(dlrr2.AddDlrrItem(Rand<ReceiveTimeInfo>()));
+ EXPECT_TRUE(dlrr2.WithDlrrItem(Rand<ReceiveTimeInfo>()));
ExtendedReports xr;
- xr.SetSenderSsrc(kSenderSsrc);
- EXPECT_TRUE(xr.AddDlrr(dlrr1));
- EXPECT_TRUE(xr.AddDlrr(dlrr2));
+ xr.From(kSenderSsrc);
+ EXPECT_TRUE(xr.WithDlrr(dlrr1));
+ EXPECT_TRUE(xr.WithDlrr(dlrr2));
rtc::Buffer packet = xr.Build();
@@ -259,8 +259,8 @@
VoipMetric voip_metric = Rand<VoipMetric>();
ExtendedReports xr;
- xr.SetSenderSsrc(kSenderSsrc);
- EXPECT_TRUE(xr.AddVoipMetric(voip_metric));
+ xr.From(kSenderSsrc);
+ EXPECT_TRUE(xr.WithVoipMetric(voip_metric));
rtc::Buffer packet = xr.Build();
@@ -275,13 +275,13 @@
TEST_F(RtcpPacketExtendedReportsTest, CreateAndParseWithMultipleReportBlocks) {
Rrtr rrtr = Rand<Rrtr>();
Dlrr dlrr;
- EXPECT_TRUE(dlrr.AddDlrrItem(Rand<ReceiveTimeInfo>()));
+ EXPECT_TRUE(dlrr.WithDlrrItem(Rand<ReceiveTimeInfo>()));
VoipMetric metric = Rand<VoipMetric>();
ExtendedReports xr;
- xr.SetSenderSsrc(kSenderSsrc);
- EXPECT_TRUE(xr.AddRrtr(rrtr));
- EXPECT_TRUE(xr.AddDlrr(dlrr));
- EXPECT_TRUE(xr.AddVoipMetric(metric));
+ xr.From(kSenderSsrc);
+ EXPECT_TRUE(xr.WithRrtr(rrtr));
+ EXPECT_TRUE(xr.WithDlrr(dlrr));
+ EXPECT_TRUE(xr.WithVoipMetric(metric));
rtc::Buffer packet = xr.Build();
@@ -300,10 +300,10 @@
Dlrr dlrr;
VoipMetric metric = Rand<VoipMetric>();
ExtendedReports xr;
- xr.SetSenderSsrc(kSenderSsrc);
- EXPECT_TRUE(xr.AddRrtr(rrtr));
- EXPECT_TRUE(xr.AddDlrr(dlrr));
- EXPECT_TRUE(xr.AddVoipMetric(metric));
+ xr.From(kSenderSsrc);
+ EXPECT_TRUE(xr.WithRrtr(rrtr));
+ EXPECT_TRUE(xr.WithDlrr(dlrr));
+ EXPECT_TRUE(xr.WithVoipMetric(metric));
rtc::Buffer packet = xr.Build();
@@ -322,17 +322,17 @@
Rrtr rrtr = Rand<Rrtr>();
for (size_t i = 0; i < kMaxBlocks; ++i)
- EXPECT_TRUE(xr.AddRrtr(rrtr));
- EXPECT_FALSE(xr.AddRrtr(rrtr));
+ EXPECT_TRUE(xr.WithRrtr(rrtr));
+ EXPECT_FALSE(xr.WithRrtr(rrtr));
Dlrr dlrr;
for (size_t i = 0; i < kMaxBlocks; ++i)
- EXPECT_TRUE(xr.AddDlrr(dlrr));
- EXPECT_FALSE(xr.AddDlrr(dlrr));
+ EXPECT_TRUE(xr.WithDlrr(dlrr));
+ EXPECT_FALSE(xr.WithDlrr(dlrr));
VoipMetric voip_metric = Rand<VoipMetric>();
for (size_t i = 0; i < kMaxBlocks; ++i)
- EXPECT_TRUE(xr.AddVoipMetric(voip_metric));
- EXPECT_FALSE(xr.AddVoipMetric(voip_metric));
+ EXPECT_TRUE(xr.WithVoipMetric(voip_metric));
+ EXPECT_FALSE(xr.WithVoipMetric(voip_metric));
}
} // namespace webrtc
diff --git a/webrtc/modules/rtp_rtcp/source/rtcp_packet/fir.h b/webrtc/modules/rtp_rtcp/source/rtcp_packet/fir.h
index 59f3b61..ddf2cfa 100644
--- a/webrtc/modules/rtp_rtcp/source/rtcp_packet/fir.h
+++ b/webrtc/modules/rtp_rtcp/source/rtcp_packet/fir.h
@@ -36,8 +36,8 @@
// Parse assumes header is already parsed and validated.
bool Parse(const CommonHeader& packet);
- void AddRequestTo(uint32_t ssrc, uint8_t seq_num) {
- items_.emplace_back(ssrc, seq_num);
+ void WithRequestTo(uint32_t ssrc, uint8_t seq_num) {
+ items_.push_back(Request(ssrc, seq_num));
}
const std::vector<Request>& requests() const { return items_; }
@@ -53,7 +53,7 @@
return kHeaderLength + kCommonFeedbackLength + kFciLength * items_.size();
}
// SSRC of media source is not used in FIR packet. Shadow base functions.
- void SetMediaSsrc(uint32_t ssrc);
+ void To(uint32_t ssrc);
uint32_t media_ssrc() const;
std::vector<Request> items_;
diff --git a/webrtc/modules/rtp_rtcp/source/rtcp_packet/fir_unittest.cc b/webrtc/modules/rtp_rtcp/source/rtcp_packet/fir_unittest.cc
index bce5f95..8c48a83 100644
--- a/webrtc/modules/rtp_rtcp/source/rtcp_packet/fir_unittest.cc
+++ b/webrtc/modules/rtp_rtcp/source/rtcp_packet/fir_unittest.cc
@@ -49,8 +49,8 @@
TEST(RtcpPacketFirTest, Create) {
Fir fir;
- fir.SetSenderSsrc(kSenderSsrc);
- fir.AddRequestTo(kRemoteSsrc, kSeqNr);
+ fir.From(kSenderSsrc);
+ fir.WithRequestTo(kRemoteSsrc, kSeqNr);
rtc::Buffer packet = fir.Build();
@@ -60,9 +60,9 @@
TEST(RtcpPacketFirTest, TwoFciEntries) {
Fir fir;
- fir.SetSenderSsrc(kSenderSsrc);
- fir.AddRequestTo(kRemoteSsrc, kSeqNr);
- fir.AddRequestTo(kRemoteSsrc + 1, kSeqNr + 1);
+ fir.From(kSenderSsrc);
+ fir.WithRequestTo(kRemoteSsrc, kSeqNr);
+ fir.WithRequestTo(kRemoteSsrc + 1, kSeqNr + 1);
rtc::Buffer packet = fir.Build();
Fir parsed;
diff --git a/webrtc/modules/rtp_rtcp/source/rtcp_packet/nack.cc b/webrtc/modules/rtp_rtcp/source/rtcp_packet/nack.cc
index 956b16f..0c1f577 100644
--- a/webrtc/modules/rtp_rtcp/source/rtcp_packet/nack.cc
+++ b/webrtc/modules/rtp_rtcp/source/rtcp_packet/nack.cc
@@ -121,7 +121,7 @@
packed_.size() * kNackItemLength;
}
-void Nack::SetPacketIds(const uint16_t* nack_list, size_t length) {
+void Nack::WithList(const uint16_t* nack_list, size_t length) {
RTC_DCHECK(nack_list);
RTC_DCHECK(packet_ids_.empty());
RTC_DCHECK(packed_.empty());
diff --git a/webrtc/modules/rtp_rtcp/source/rtcp_packet/nack.h b/webrtc/modules/rtp_rtcp/source/rtcp_packet/nack.h
index e346200..83b3ba9 100644
--- a/webrtc/modules/rtp_rtcp/source/rtcp_packet/nack.h
+++ b/webrtc/modules/rtp_rtcp/source/rtcp_packet/nack.h
@@ -30,7 +30,7 @@
// Parse assumes header is already parsed and validated.
bool Parse(const CommonHeader& packet);
- void SetPacketIds(const uint16_t* nack_list, size_t length);
+ void WithList(const uint16_t* nack_list, size_t length);
const std::vector<uint16_t>& packet_ids() const { return packet_ids_; }
protected:
@@ -48,7 +48,7 @@
uint16_t bitmask;
};
- void Pack(); // Fills packed_ using packed_ids_. (used in SetPacketIds).
+ void Pack(); // Fills packed_ using packed_ids_. (used in WithList).
void Unpack(); // Fills packet_ids_ using packed_. (used in Parse).
std::vector<PackedNack> packed_;
diff --git a/webrtc/modules/rtp_rtcp/source/rtcp_packet/nack_unittest.cc b/webrtc/modules/rtp_rtcp/source/rtcp_packet/nack_unittest.cc
index a992019..d335d66 100644
--- a/webrtc/modules/rtp_rtcp/source/rtcp_packet/nack_unittest.cc
+++ b/webrtc/modules/rtp_rtcp/source/rtcp_packet/nack_unittest.cc
@@ -57,9 +57,9 @@
TEST(RtcpPacketNackTest, Create) {
Nack nack;
- nack.SetSenderSsrc(kSenderSsrc);
- nack.SetMediaSsrc(kRemoteSsrc);
- nack.SetPacketIds(kList, kListLength);
+ nack.From(kSenderSsrc);
+ nack.To(kRemoteSsrc);
+ nack.WithList(kList, kListLength);
rtc::Buffer packet = nack.Build();
@@ -79,9 +79,9 @@
TEST(RtcpPacketNackTest, CreateWrap) {
Nack nack;
- nack.SetSenderSsrc(kSenderSsrc);
- nack.SetMediaSsrc(kRemoteSsrc);
- nack.SetPacketIds(kWrapList, kWrapListLength);
+ nack.From(kSenderSsrc);
+ nack.To(kRemoteSsrc);
+ nack.WithList(kWrapList, kWrapListLength);
rtc::Buffer packet = nack.Build();
@@ -104,9 +104,9 @@
const size_t kUnorderedListLength =
sizeof(kUnorderedList) / sizeof(kUnorderedList[0]);
Nack nack;
- nack.SetSenderSsrc(kSenderSsrc);
- nack.SetMediaSsrc(kRemoteSsrc);
- nack.SetPacketIds(kUnorderedList, kUnorderedListLength);
+ nack.From(kSenderSsrc);
+ nack.To(kRemoteSsrc);
+ nack.WithList(kUnorderedList, kUnorderedListLength);
rtc::Buffer packet = nack.Build();
@@ -122,9 +122,9 @@
Nack nack;
const uint16_t kList[] = {1, 100, 200, 300, 400};
const uint16_t kListLength = sizeof(kList) / sizeof(kList[0]);
- nack.SetSenderSsrc(kSenderSsrc);
- nack.SetMediaSsrc(kRemoteSsrc);
- nack.SetPacketIds(kList, kListLength);
+ nack.From(kSenderSsrc);
+ nack.To(kRemoteSsrc);
+ nack.WithList(kList, kListLength);
class MockPacketReadyCallback : public rtcp::RtcpPacket::PacketReadyCallback {
public:
@@ -156,9 +156,9 @@
const uint16_t kList[] = {1};
const size_t kMinNackBlockSize = 16;
Nack nack;
- nack.SetSenderSsrc(kSenderSsrc);
- nack.SetMediaSsrc(kRemoteSsrc);
- nack.SetPacketIds(kList, 1);
+ nack.From(kSenderSsrc);
+ nack.To(kRemoteSsrc);
+ nack.WithList(kList, 1);
class Verifier : public rtcp::RtcpPacket::PacketReadyCallback {
public:
void OnPacketReady(uint8_t* data, size_t length) override {
diff --git a/webrtc/modules/rtp_rtcp/source/rtcp_packet/pli_unittest.cc b/webrtc/modules/rtp_rtcp/source/rtcp_packet/pli_unittest.cc
index f751822..4304f19 100644
--- a/webrtc/modules/rtp_rtcp/source/rtcp_packet/pli_unittest.cc
+++ b/webrtc/modules/rtp_rtcp/source/rtcp_packet/pli_unittest.cc
@@ -40,8 +40,8 @@
TEST(RtcpPacketPliTest, Create) {
Pli pli;
- pli.SetSenderSsrc(kSenderSsrc);
- pli.SetMediaSsrc(kRemoteSsrc);
+ pli.From(kSenderSsrc);
+ pli.To(kRemoteSsrc);
rtc::Buffer packet = pli.Build();
diff --git a/webrtc/modules/rtp_rtcp/source/rtcp_packet/psfb.h b/webrtc/modules/rtp_rtcp/source/rtcp_packet/psfb.h
index 762dc61..8707a5d 100644
--- a/webrtc/modules/rtp_rtcp/source/rtcp_packet/psfb.h
+++ b/webrtc/modules/rtp_rtcp/source/rtcp_packet/psfb.h
@@ -27,8 +27,8 @@
Psfb() : sender_ssrc_(0), media_ssrc_(0) {}
~Psfb() override {}
- void SetSenderSsrc(uint32_t ssrc) { sender_ssrc_ = ssrc; }
- void SetMediaSsrc(uint32_t ssrc) { media_ssrc_ = ssrc; }
+ void From(uint32_t ssrc) { sender_ssrc_ = ssrc; }
+ void To(uint32_t ssrc) { media_ssrc_ = ssrc; }
uint32_t sender_ssrc() const { return sender_ssrc_; }
uint32_t media_ssrc() const { return media_ssrc_; }
diff --git a/webrtc/modules/rtp_rtcp/source/rtcp_packet/rapid_resync_request_unittest.cc b/webrtc/modules/rtp_rtcp/source/rtcp_packet/rapid_resync_request_unittest.cc
index 8dcc46d..60d46d1 100644
--- a/webrtc/modules/rtp_rtcp/source/rtcp_packet/rapid_resync_request_unittest.cc
+++ b/webrtc/modules/rtp_rtcp/source/rtcp_packet/rapid_resync_request_unittest.cc
@@ -39,8 +39,8 @@
TEST(RtcpPacketRapidResyncRequestTest, Create) {
RapidResyncRequest rrr;
- rrr.SetSenderSsrc(kSenderSsrc);
- rrr.SetMediaSsrc(kRemoteSsrc);
+ rrr.From(kSenderSsrc);
+ rrr.To(kRemoteSsrc);
rtc::Buffer packet = rrr.Build();
diff --git a/webrtc/modules/rtp_rtcp/source/rtcp_packet/receiver_report.cc b/webrtc/modules/rtp_rtcp/source/rtcp_packet/receiver_report.cc
index 808190a..a393181 100644
--- a/webrtc/modules/rtp_rtcp/source/rtcp_packet/receiver_report.cc
+++ b/webrtc/modules/rtp_rtcp/source/rtcp_packet/receiver_report.cc
@@ -74,7 +74,7 @@
return true;
}
-bool ReceiverReport::AddReportBlock(const ReportBlock& block) {
+bool ReceiverReport::WithReportBlock(const ReportBlock& block) {
if (report_blocks_.size() >= kMaxNumberOfReportBlocks) {
LOG(LS_WARNING) << "Max report blocks reached.";
return false;
diff --git a/webrtc/modules/rtp_rtcp/source/rtcp_packet/receiver_report.h b/webrtc/modules/rtp_rtcp/source/rtcp_packet/receiver_report.h
index 2bfe174..0630adb 100644
--- a/webrtc/modules/rtp_rtcp/source/rtcp_packet/receiver_report.h
+++ b/webrtc/modules/rtp_rtcp/source/rtcp_packet/receiver_report.h
@@ -32,8 +32,8 @@
// Parse assumes header is already parsed and validated.
bool Parse(const CommonHeader& packet);
- void SetSenderSsrc(uint32_t ssrc) { sender_ssrc_ = ssrc; }
- bool AddReportBlock(const ReportBlock& block);
+ void From(uint32_t ssrc) { sender_ssrc_ = ssrc; }
+ bool WithReportBlock(const ReportBlock& block);
uint32_t sender_ssrc() const { return sender_ssrc_; }
const std::vector<ReportBlock>& report_blocks() const {
diff --git a/webrtc/modules/rtp_rtcp/source/rtcp_packet/receiver_report_unittest.cc b/webrtc/modules/rtp_rtcp/source/rtcp_packet/receiver_report_unittest.cc
index 5e28ff4..d2c833b 100644
--- a/webrtc/modules/rtp_rtcp/source/rtcp_packet/receiver_report_unittest.cc
+++ b/webrtc/modules/rtp_rtcp/source/rtcp_packet/receiver_report_unittest.cc
@@ -65,16 +65,16 @@
TEST(RtcpPacketReceiverReportTest, CreateWithOneReportBlock) {
ReceiverReport rr;
- rr.SetSenderSsrc(kSenderSsrc);
+ rr.From(kSenderSsrc);
ReportBlock rb;
- rb.SetMediaSsrc(kRemoteSsrc);
- rb.SetFractionLost(kFractionLost);
- rb.SetCumulativeLost(kCumulativeLost);
- rb.SetExtHighestSeqNum(kExtHighestSeqNum);
- rb.SetJitter(kJitter);
- rb.SetLastSr(kLastSr);
- rb.SetDelayLastSr(kDelayLastSr);
- rr.AddReportBlock(rb);
+ rb.To(kRemoteSsrc);
+ rb.WithFractionLost(kFractionLost);
+ rb.WithCumulativeLost(kCumulativeLost);
+ rb.WithExtHighestSeqNum(kExtHighestSeqNum);
+ rb.WithJitter(kJitter);
+ rb.WithLastSr(kLastSr);
+ rb.WithDelayLastSr(kDelayLastSr);
+ rr.WithReportBlock(rb);
rtc::Buffer raw = rr.Build();
@@ -83,7 +83,7 @@
TEST(RtcpPacketReceiverReportTest, CreateAndParseWithoutReportBlocks) {
ReceiverReport rr;
- rr.SetSenderSsrc(kSenderSsrc);
+ rr.From(kSenderSsrc);
rtc::Buffer raw = rr.Build();
ReceiverReport parsed;
@@ -96,13 +96,13 @@
TEST(RtcpPacketReceiverReportTest, CreateAndParseWithTwoReportBlocks) {
ReceiverReport rr;
ReportBlock rb1;
- rb1.SetMediaSsrc(kRemoteSsrc);
+ rb1.To(kRemoteSsrc);
ReportBlock rb2;
- rb2.SetMediaSsrc(kRemoteSsrc + 1);
+ rb2.To(kRemoteSsrc + 1);
- rr.SetSenderSsrc(kSenderSsrc);
- EXPECT_TRUE(rr.AddReportBlock(rb1));
- EXPECT_TRUE(rr.AddReportBlock(rb2));
+ rr.From(kSenderSsrc);
+ EXPECT_TRUE(rr.WithReportBlock(rb1));
+ EXPECT_TRUE(rr.WithReportBlock(rb2));
rtc::Buffer raw = rr.Build();
ReceiverReport parsed;
@@ -116,15 +116,15 @@
TEST(RtcpPacketReceiverReportTest, CreateWithTooManyReportBlocks) {
ReceiverReport rr;
- rr.SetSenderSsrc(kSenderSsrc);
+ rr.From(kSenderSsrc);
const size_t kMaxReportBlocks = (1 << 5) - 1;
ReportBlock rb;
for (size_t i = 0; i < kMaxReportBlocks; ++i) {
- rb.SetMediaSsrc(kRemoteSsrc + i);
- EXPECT_TRUE(rr.AddReportBlock(rb));
+ rb.To(kRemoteSsrc + i);
+ EXPECT_TRUE(rr.WithReportBlock(rb));
}
- rb.SetMediaSsrc(kRemoteSsrc + kMaxReportBlocks);
- EXPECT_FALSE(rr.AddReportBlock(rb));
+ rb.To(kRemoteSsrc + kMaxReportBlocks);
+ EXPECT_FALSE(rr.WithReportBlock(rb));
}
} // namespace webrtc
diff --git a/webrtc/modules/rtp_rtcp/source/rtcp_packet/remb.cc b/webrtc/modules/rtp_rtcp/source/rtcp_packet/remb.cc
index ac5fc1a..2f59fbb 100644
--- a/webrtc/modules/rtp_rtcp/source/rtcp_packet/remb.cc
+++ b/webrtc/modules/rtp_rtcp/source/rtcp_packet/remb.cc
@@ -10,8 +10,6 @@
#include "webrtc/modules/rtp_rtcp/source/rtcp_packet/remb.h"
-#include <utility>
-
#include "webrtc/base/checks.h"
#include "webrtc/base/logging.h"
#include "webrtc/modules/rtp_rtcp/source/byte_io.h"
@@ -83,12 +81,22 @@
return true;
}
-bool Remb::SetSsrcs(std::vector<uint32_t> ssrcs) {
- if (ssrcs.size() > kMaxNumberOfSsrcs) {
+bool Remb::AppliesTo(uint32_t ssrc) {
+ if (ssrcs_.size() >= kMaxNumberOfSsrcs) {
+ LOG(LS_WARNING) << "Max number of REMB feedback SSRCs reached.";
+ return false;
+ }
+ ssrcs_.push_back(ssrc);
+ return true;
+}
+
+bool Remb::AppliesToMany(const std::vector<uint32_t>& ssrcs) {
+ if (ssrcs_.size() + ssrcs.size() > kMaxNumberOfSsrcs) {
LOG(LS_WARNING) << "Not enough space for all given SSRCs.";
return false;
}
- ssrcs_ = std::move(ssrcs);
+ // Append.
+ ssrcs_.insert(ssrcs_.end(), ssrcs.begin(), ssrcs.end());
return true;
}
diff --git a/webrtc/modules/rtp_rtcp/source/rtcp_packet/remb.h b/webrtc/modules/rtp_rtcp/source/rtcp_packet/remb.h
index 5cc00a2..9f10921 100644
--- a/webrtc/modules/rtp_rtcp/source/rtcp_packet/remb.h
+++ b/webrtc/modules/rtp_rtcp/source/rtcp_packet/remb.h
@@ -25,7 +25,6 @@
class Remb : public Psfb {
public:
static constexpr uint8_t kFeedbackMessageType = 15;
- static constexpr size_t kMaxNumberOfSsrcs = 0xff;
Remb() : bitrate_bps_(0) {}
~Remb() override {}
@@ -33,8 +32,9 @@
// Parse assumes header is already parsed and validated.
bool Parse(const CommonHeader& packet);
- bool SetSsrcs(std::vector<uint32_t> ssrcs);
- void SetBitrateBps(uint64_t bitrate_bps) { bitrate_bps_ = bitrate_bps; }
+ bool AppliesTo(uint32_t ssrc);
+ bool AppliesToMany(const std::vector<uint32_t>& ssrcs);
+ void WithBitrateBps(uint64_t bitrate_bps) { bitrate_bps_ = bitrate_bps; }
uint64_t bitrate_bps() const { return bitrate_bps_; }
const std::vector<uint32_t>& ssrcs() const { return ssrcs_; }
@@ -50,10 +50,11 @@
}
private:
+ static constexpr size_t kMaxNumberOfSsrcs = 0xff;
static constexpr uint32_t kUniqueIdentifier = 0x52454D42; // 'R' 'E' 'M' 'B'.
// Media ssrc is unused, shadow base class setter and getter.
- void SetMediaSsrc(uint32_t);
+ void To(uint32_t);
uint32_t media_ssrc() const;
uint64_t bitrate_bps_;
diff --git a/webrtc/modules/rtp_rtcp/source/rtcp_packet/remb_unittest.cc b/webrtc/modules/rtp_rtcp/source/rtcp_packet/remb_unittest.cc
index af4c5b4..d504143 100644
--- a/webrtc/modules/rtp_rtcp/source/rtcp_packet/remb_unittest.cc
+++ b/webrtc/modules/rtp_rtcp/source/rtcp_packet/remb_unittest.cc
@@ -34,10 +34,11 @@
TEST(RtcpPacketRembTest, Create) {
Remb remb;
- remb.SetSenderSsrc(kSenderSsrc);
- remb.SetSsrcs(
- std::vector<uint32_t>(std::begin(kRemoteSsrcs), std::end(kRemoteSsrcs)));
- remb.SetBitrateBps(kBitrateBps);
+ remb.From(kSenderSsrc);
+ remb.AppliesTo(kRemoteSsrcs[0]);
+ remb.AppliesTo(kRemoteSsrcs[1]);
+ remb.AppliesTo(kRemoteSsrcs[2]);
+ remb.WithBitrateBps(kBitrateBps);
rtc::Buffer packet = remb.Build();
@@ -57,8 +58,8 @@
TEST(RtcpPacketRembTest, CreateAndParseWithoutSsrcs) {
Remb remb;
- remb.SetSenderSsrc(kSenderSsrc);
- remb.SetBitrateBps(kBitrateBps);
+ remb.From(kSenderSsrc);
+ remb.WithBitrateBps(kBitrateBps);
rtc::Buffer packet = remb.Build();
Remb parsed;
@@ -70,7 +71,7 @@
TEST(RtcpPacketRembTest, CreateAndParse64bitBitrate) {
Remb remb;
- remb.SetBitrateBps(kBitrateBps64bit);
+ remb.WithBitrateBps(kBitrateBps64bit);
rtc::Buffer packet = remb.Build();
Remb parsed;
@@ -118,11 +119,27 @@
}
TEST(RtcpPacketRembTest, TooManySsrcs) {
+ const size_t kMax = 0xff;
Remb remb;
- EXPECT_FALSE(remb.SetSsrcs(
- std::vector<uint32_t>(Remb::kMaxNumberOfSsrcs + 1, kRemoteSsrcs[0])));
- EXPECT_TRUE(remb.SetSsrcs(
- std::vector<uint32_t>(Remb::kMaxNumberOfSsrcs, kRemoteSsrcs[0])));
+ for (size_t i = 1; i <= kMax; ++i)
+ EXPECT_TRUE(remb.AppliesTo(kRemoteSsrcs[0] + i));
+ EXPECT_FALSE(remb.AppliesTo(kRemoteSsrcs[0]));
+}
+
+TEST(RtcpPacketRembTest, TooManySsrcsForBatchAssign) {
+ const uint32_t kRemoteSsrc = kRemoteSsrcs[0];
+ const size_t kMax = 0xff;
+ const std::vector<uint32_t> kAllButOneSsrc(kMax - 1, kRemoteSsrc);
+ const std::vector<uint32_t> kTwoSsrcs(2, kRemoteSsrc);
+
+ Remb remb;
+ EXPECT_TRUE(remb.AppliesToMany(kAllButOneSsrc));
+ // Should be no place for 2 more.
+ EXPECT_FALSE(remb.AppliesToMany(kTwoSsrcs));
+ // But enough place for 1 more.
+ EXPECT_TRUE(remb.AppliesTo(kRemoteSsrc));
+ // But not for another one.
+ EXPECT_FALSE(remb.AppliesTo(kRemoteSsrc));
}
} // namespace webrtc
diff --git a/webrtc/modules/rtp_rtcp/source/rtcp_packet/report_block.cc b/webrtc/modules/rtp_rtcp/source/rtcp_packet/report_block.cc
index 8015fa3..4911dbf 100644
--- a/webrtc/modules/rtp_rtcp/source/rtcp_packet/report_block.cc
+++ b/webrtc/modules/rtp_rtcp/source/rtcp_packet/report_block.cc
@@ -76,7 +76,7 @@
ByteWriter<uint32_t>::WriteBigEndian(&buffer[20], delay_since_last_sr());
}
-bool ReportBlock::SetCumulativeLost(uint32_t cumulative_lost) {
+bool ReportBlock::WithCumulativeLost(uint32_t cumulative_lost) {
if (cumulative_lost >= (1u << 24)) { // Have only 3 bytes to store it.
LOG(LS_WARNING) << "Cumulative lost is too big to fit into Report Block";
return false;
diff --git a/webrtc/modules/rtp_rtcp/source/rtcp_packet/report_block.h b/webrtc/modules/rtp_rtcp/source/rtcp_packet/report_block.h
index bdc3cbc..ef99e17 100644
--- a/webrtc/modules/rtp_rtcp/source/rtcp_packet/report_block.h
+++ b/webrtc/modules/rtp_rtcp/source/rtcp_packet/report_block.h
@@ -30,17 +30,17 @@
// Consumes ReportBlock::kLength bytes.
void Create(uint8_t* buffer) const;
- void SetMediaSsrc(uint32_t ssrc) { source_ssrc_ = ssrc; }
- void SetFractionLost(uint8_t fraction_lost) {
+ void To(uint32_t ssrc) { source_ssrc_ = ssrc; }
+ void WithFractionLost(uint8_t fraction_lost) {
fraction_lost_ = fraction_lost;
}
- bool SetCumulativeLost(uint32_t cumulative_lost);
- void SetExtHighestSeqNum(uint32_t ext_highest_seq_num) {
+ bool WithCumulativeLost(uint32_t cumulative_lost);
+ void WithExtHighestSeqNum(uint32_t ext_highest_seq_num) {
extended_high_seq_num_ = ext_highest_seq_num;
}
- void SetJitter(uint32_t jitter) { jitter_ = jitter; }
- void SetLastSr(uint32_t last_sr) { last_sr_ = last_sr; }
- void SetDelayLastSr(uint32_t delay_last_sr) {
+ void WithJitter(uint32_t jitter) { jitter_ = jitter; }
+ void WithLastSr(uint32_t last_sr) { last_sr_ = last_sr; }
+ void WithDelayLastSr(uint32_t delay_last_sr) {
delay_since_last_sr_ = delay_last_sr;
}
diff --git a/webrtc/modules/rtp_rtcp/source/rtcp_packet/report_block_unittest.cc b/webrtc/modules/rtp_rtcp/source/rtcp_packet/report_block_unittest.cc
index 957a08f..85bbb40 100644
--- a/webrtc/modules/rtp_rtcp/source/rtcp_packet/report_block_unittest.cc
+++ b/webrtc/modules/rtp_rtcp/source/rtcp_packet/report_block_unittest.cc
@@ -52,13 +52,13 @@
TEST(RtcpPacketReportBlockTest, ParseMatchCreate) {
ReportBlock rb;
- rb.SetMediaSsrc(kRemoteSsrc);
- rb.SetFractionLost(kFractionLost);
- rb.SetCumulativeLost(kCumulativeLost);
- rb.SetExtHighestSeqNum(kExtHighestSeqNum);
- rb.SetJitter(kJitter);
- rb.SetLastSr(kLastSr);
- rb.SetDelayLastSr(kDelayLastSr);
+ rb.To(kRemoteSsrc);
+ rb.WithFractionLost(kFractionLost);
+ rb.WithCumulativeLost(kCumulativeLost);
+ rb.WithExtHighestSeqNum(kExtHighestSeqNum);
+ rb.WithJitter(kJitter);
+ rb.WithLastSr(kLastSr);
+ rb.WithDelayLastSr(kDelayLastSr);
uint8_t buffer[kBufferLength];
rb.Create(buffer);
@@ -78,8 +78,8 @@
TEST(RtcpPacketReportBlockTest, ValidateCumulativeLost) {
const uint32_t kMaxCumulativeLost = 0xffffff;
ReportBlock rb;
- EXPECT_FALSE(rb.SetCumulativeLost(kMaxCumulativeLost + 1));
- EXPECT_TRUE(rb.SetCumulativeLost(kMaxCumulativeLost));
+ EXPECT_FALSE(rb.WithCumulativeLost(kMaxCumulativeLost + 1));
+ EXPECT_TRUE(rb.WithCumulativeLost(kMaxCumulativeLost));
}
} // namespace
diff --git a/webrtc/modules/rtp_rtcp/source/rtcp_packet/rpsi.cc b/webrtc/modules/rtp_rtcp/source/rtcp_packet/rpsi.cc
index cfa59d6..3d6e72f 100644
--- a/webrtc/modules/rtp_rtcp/source/rtcp_packet/rpsi.cc
+++ b/webrtc/modules/rtp_rtcp/source/rtcp_packet/rpsi.cc
@@ -130,12 +130,12 @@
return true;
}
-void Rpsi::SetPayloadType(uint8_t payload) {
+void Rpsi::WithPayloadType(uint8_t payload) {
RTC_DCHECK_LE(payload, 0x7f);
payload_type_ = payload;
}
-void Rpsi::SetPictureId(uint64_t picture_id) {
+void Rpsi::WithPictureId(uint64_t picture_id) {
picture_id_ = picture_id;
block_length_ = CalculateBlockLength(RequiredBytes(picture_id_));
}
diff --git a/webrtc/modules/rtp_rtcp/source/rtcp_packet/rpsi.h b/webrtc/modules/rtp_rtcp/source/rtcp_packet/rpsi.h
index 79b6ace..49669f4 100644
--- a/webrtc/modules/rtp_rtcp/source/rtcp_packet/rpsi.h
+++ b/webrtc/modules/rtp_rtcp/source/rtcp_packet/rpsi.h
@@ -30,8 +30,8 @@
// Parse assumes header is already parsed and validated.
bool Parse(const CommonHeader& packet);
- void SetPayloadType(uint8_t payload);
- void SetPictureId(uint64_t picture_id);
+ void WithPayloadType(uint8_t payload);
+ void WithPictureId(uint64_t picture_id);
uint8_t payload_type() const { return payload_type_; }
uint64_t picture_id() const { return picture_id_; }
diff --git a/webrtc/modules/rtp_rtcp/source/rtcp_packet/rpsi_unittest.cc b/webrtc/modules/rtp_rtcp/source/rtcp_packet/rpsi_unittest.cc
index 9268e19..7ed8c2a 100644
--- a/webrtc/modules/rtp_rtcp/source/rtcp_packet/rpsi_unittest.cc
+++ b/webrtc/modules/rtp_rtcp/source/rtcp_packet/rpsi_unittest.cc
@@ -46,10 +46,10 @@
TEST(RtcpPacketRpsiTest, Create) {
Rpsi rpsi;
- rpsi.SetSenderSsrc(kSenderSsrc);
- rpsi.SetMediaSsrc(kRemoteSsrc);
- rpsi.SetPayloadType(kPayloadType);
- rpsi.SetPictureId(kPictureId);
+ rpsi.From(kSenderSsrc);
+ rpsi.To(kRemoteSsrc);
+ rpsi.WithPayloadType(kPayloadType);
+ rpsi.WithPictureId(kPictureId);
rtc::Buffer packet = rpsi.Build();
@@ -59,8 +59,8 @@
TEST(RtcpPacketRpsiTest, ParseFailsOnTooSmallPacket) {
Rpsi rpsi;
- rpsi.SetSenderSsrc(kSenderSsrc);
- rpsi.SetMediaSsrc(kRemoteSsrc);
+ rpsi.From(kSenderSsrc);
+ rpsi.To(kRemoteSsrc);
rtc::Buffer packet = rpsi.Build();
packet[3]--; // Reduce size field by one word (4 bytes).
@@ -71,9 +71,9 @@
TEST(RtcpPacketRpsiTest, ParseFailsOnFractionalPaddingBytes) {
Rpsi rpsi;
- rpsi.SetSenderSsrc(kSenderSsrc);
- rpsi.SetMediaSsrc(kRemoteSsrc);
- rpsi.SetPictureId(kPictureId);
+ rpsi.From(kSenderSsrc);
+ rpsi.To(kRemoteSsrc);
+ rpsi.WithPictureId(kPictureId);
rtc::Buffer packet = rpsi.Build();
uint8_t* padding_bits = packet.data() + 12;
uint8_t saved_padding_bits = *padding_bits;
@@ -87,9 +87,9 @@
TEST(RtcpPacketRpsiTest, ParseFailsOnTooBigPadding) {
Rpsi rpsi;
- rpsi.SetSenderSsrc(kSenderSsrc);
- rpsi.SetMediaSsrc(kRemoteSsrc);
- rpsi.SetPictureId(1); // Small picture id that occupy just 1 byte.
+ rpsi.From(kSenderSsrc);
+ rpsi.To(kRemoteSsrc);
+ rpsi.WithPictureId(1); // Small picture id that occupy just 1 byte.
rtc::Buffer packet = rpsi.Build();
uint8_t* padding_bits = packet.data() + 12;
ASSERT_TRUE(test::ParseSinglePacket(packet, &rpsi));
@@ -112,7 +112,7 @@
// 1000001 (7 bits = 1 byte in native string).
const uint64_t kPictureId = 0x41;
const uint16_t kNumberOfValidBytes = 1;
- rpsi.SetPictureId(kPictureId);
+ rpsi.WithPictureId(kPictureId);
rtc::Buffer packet = rpsi.Build();
EXPECT_EQ(kNumberOfValidBytes, UsedBytes(packet));
@@ -127,7 +127,7 @@
// |1 0000001 (7 bits = 1 byte in native string).
const uint64_t kPictureId = 0x81;
const uint16_t kNumberOfValidBytes = 2;
- rpsi.SetPictureId(kPictureId);
+ rpsi.WithPictureId(kPictureId);
rtc::Buffer packet = rpsi.Build();
EXPECT_EQ(kNumberOfValidBytes, UsedBytes(packet));
@@ -142,7 +142,7 @@
// 10000|00 100000|0 1000000 (7 bits = 1 byte in native string).
const uint64_t kPictureId = 0x102040;
const uint16_t kNumberOfValidBytes = 3;
- rpsi.SetPictureId(kPictureId);
+ rpsi.WithPictureId(kPictureId);
rtc::Buffer packet = rpsi.Build();
EXPECT_EQ(kNumberOfValidBytes, UsedBytes(packet));
@@ -157,7 +157,7 @@
// 1000|001 00001|01 100001|1 1000010 (7 bits = 1 byte in native string).
const uint64_t kPictureId = 0x84161C2;
const uint16_t kNumberOfValidBytes = 4;
- rpsi.SetPictureId(kPictureId);
+ rpsi.WithPictureId(kPictureId);
rtc::Buffer packet = rpsi.Build();
EXPECT_EQ(kNumberOfValidBytes, UsedBytes(packet));
@@ -173,7 +173,7 @@
// 11 111111|1 1111111 (7 bits = 1 byte in native string).
const uint64_t kPictureId = 0xffffffffffffffff;
const uint16_t kNumberOfValidBytes = 10;
- rpsi.SetPictureId(kPictureId);
+ rpsi.WithPictureId(kPictureId);
rtc::Buffer packet = rpsi.Build();
EXPECT_EQ(kNumberOfValidBytes, UsedBytes(packet));
diff --git a/webrtc/modules/rtp_rtcp/source/rtcp_packet/rrtr.h b/webrtc/modules/rtp_rtcp/source/rtcp_packet/rrtr.h
index f123aaf..3354f61 100644
--- a/webrtc/modules/rtp_rtcp/source/rtcp_packet/rrtr.h
+++ b/webrtc/modules/rtp_rtcp/source/rtcp_packet/rrtr.h
@@ -36,7 +36,7 @@
// Consumes Rrtr::kLength bytes.
void Create(uint8_t* buffer) const;
- void SetNtp(NtpTime ntp) { ntp_ = ntp; }
+ void WithNtp(const NtpTime& ntp) { ntp_ = ntp; }
NtpTime ntp() const { return ntp_; }
diff --git a/webrtc/modules/rtp_rtcp/source/rtcp_packet/rrtr_unittest.cc b/webrtc/modules/rtp_rtcp/source/rtcp_packet/rrtr_unittest.cc
index 6dff06f..6536e06 100644
--- a/webrtc/modules/rtp_rtcp/source/rtcp_packet/rrtr_unittest.cc
+++ b/webrtc/modules/rtp_rtcp/source/rtcp_packet/rrtr_unittest.cc
@@ -30,7 +30,7 @@
TEST(RtcpPacketRrtrTest, Create) {
uint8_t buffer[Rrtr::kLength];
Rrtr rrtr;
- rrtr.SetNtp(NtpTime(kNtpSec, kNtpFrac));
+ rrtr.WithNtp(NtpTime(kNtpSec, kNtpFrac));
rrtr.Create(buffer);
EXPECT_EQ(0, memcmp(buffer, kBlock, kBlockSizeBytes));
diff --git a/webrtc/modules/rtp_rtcp/source/rtcp_packet/rtpfb.h b/webrtc/modules/rtp_rtcp/source/rtcp_packet/rtpfb.h
index b34e4a0..de1cf76 100644
--- a/webrtc/modules/rtp_rtcp/source/rtcp_packet/rtpfb.h
+++ b/webrtc/modules/rtp_rtcp/source/rtcp_packet/rtpfb.h
@@ -27,8 +27,8 @@
Rtpfb() : sender_ssrc_(0), media_ssrc_(0) {}
~Rtpfb() override {}
- void SetSenderSsrc(uint32_t ssrc) { sender_ssrc_ = ssrc; }
- void SetMediaSsrc(uint32_t ssrc) { media_ssrc_ = ssrc; }
+ void From(uint32_t ssrc) { sender_ssrc_ = ssrc; }
+ void To(uint32_t ssrc) { media_ssrc_ = ssrc; }
uint32_t sender_ssrc() const { return sender_ssrc_; }
uint32_t media_ssrc() const { return media_ssrc_; }
diff --git a/webrtc/modules/rtp_rtcp/source/rtcp_packet/sdes.cc b/webrtc/modules/rtp_rtcp/source/rtcp_packet/sdes.cc
index 9c44547..3a905ba 100644
--- a/webrtc/modules/rtp_rtcp/source/rtcp_packet/sdes.cc
+++ b/webrtc/modules/rtp_rtcp/source/rtcp_packet/sdes.cc
@@ -10,8 +10,6 @@
#include "webrtc/modules/rtp_rtcp/source/rtcp_packet/sdes.h"
-#include <utility>
-
#include "webrtc/base/checks.h"
#include "webrtc/base/logging.h"
#include "webrtc/modules/rtp_rtcp/source/byte_io.h"
@@ -139,7 +137,7 @@
return true;
}
-bool Sdes::AddCName(uint32_t ssrc, std::string cname) {
+bool Sdes::WithCName(uint32_t ssrc, const std::string& cname) {
RTC_DCHECK_LE(cname.length(), 0xffu);
if (chunks_.size() >= kMaxNumberOfChunks) {
LOG(LS_WARNING) << "Max SDES chunks reached.";
@@ -147,7 +145,7 @@
}
Chunk chunk;
chunk.ssrc = ssrc;
- chunk.cname = std::move(cname);
+ chunk.cname = cname;
chunks_.push_back(chunk);
block_length_ += ChunkSize(chunk);
return true;
diff --git a/webrtc/modules/rtp_rtcp/source/rtcp_packet/sdes.h b/webrtc/modules/rtp_rtcp/source/rtcp_packet/sdes.h
index d9a9526..19d5b42 100644
--- a/webrtc/modules/rtp_rtcp/source/rtcp_packet/sdes.h
+++ b/webrtc/modules/rtp_rtcp/source/rtcp_packet/sdes.h
@@ -36,7 +36,7 @@
// Parse assumes header is already parsed and validated.
bool Parse(const CommonHeader& packet);
- bool AddCName(uint32_t ssrc, std::string cname);
+ bool WithCName(uint32_t ssrc, const std::string& cname);
const std::vector<Chunk>& chunks() const { return chunks_; }
diff --git a/webrtc/modules/rtp_rtcp/source/rtcp_packet/sdes_unittest.cc b/webrtc/modules/rtp_rtcp/source/rtcp_packet/sdes_unittest.cc
index 206558a..53cda68 100644
--- a/webrtc/modules/rtp_rtcp/source/rtcp_packet/sdes_unittest.cc
+++ b/webrtc/modules/rtp_rtcp/source/rtcp_packet/sdes_unittest.cc
@@ -39,7 +39,7 @@
const std::string kCname = "alice@host";
Sdes sdes;
- EXPECT_TRUE(sdes.AddCName(kSenderSsrc, kCname));
+ EXPECT_TRUE(sdes.WithCName(kSenderSsrc, kCname));
rtc::Buffer packet = sdes.Build();
Sdes sdes_parsed;
@@ -53,12 +53,12 @@
TEST(RtcpPacketSdesTest, CreateAndParseWithMultipleChunks) {
Sdes sdes;
- EXPECT_TRUE(sdes.AddCName(kSenderSsrc + 0, "a"));
- EXPECT_TRUE(sdes.AddCName(kSenderSsrc + 1, "ab"));
- EXPECT_TRUE(sdes.AddCName(kSenderSsrc + 2, "abc"));
- EXPECT_TRUE(sdes.AddCName(kSenderSsrc + 3, "abcd"));
- EXPECT_TRUE(sdes.AddCName(kSenderSsrc + 4, "abcde"));
- EXPECT_TRUE(sdes.AddCName(kSenderSsrc + 5, "abcdef"));
+ EXPECT_TRUE(sdes.WithCName(kSenderSsrc + 0, "a"));
+ EXPECT_TRUE(sdes.WithCName(kSenderSsrc + 1, "ab"));
+ EXPECT_TRUE(sdes.WithCName(kSenderSsrc + 2, "abc"));
+ EXPECT_TRUE(sdes.WithCName(kSenderSsrc + 3, "abcd"));
+ EXPECT_TRUE(sdes.WithCName(kSenderSsrc + 4, "abcde"));
+ EXPECT_TRUE(sdes.WithCName(kSenderSsrc + 5, "abcdef"));
rtc::Buffer packet = sdes.Build();
Sdes parsed;
@@ -76,14 +76,14 @@
uint32_t ssrc = kSenderSsrc + i;
std::ostringstream oss;
oss << "cname" << i;
- EXPECT_TRUE(sdes.AddCName(ssrc, oss.str()));
+ EXPECT_TRUE(sdes.WithCName(ssrc, oss.str()));
}
- EXPECT_FALSE(sdes.AddCName(kSenderSsrc + kMaxChunks, "foo"));
+ EXPECT_FALSE(sdes.WithCName(kSenderSsrc + kMaxChunks, "foo"));
}
TEST(RtcpPacketSdesTest, CreateAndParseCnameItemWithEmptyString) {
Sdes sdes;
- EXPECT_TRUE(sdes.AddCName(kSenderSsrc, ""));
+ EXPECT_TRUE(sdes.WithCName(kSenderSsrc, ""));
rtc::Buffer packet = sdes.Build();
Sdes parsed;
@@ -224,7 +224,7 @@
Sdes source;
const std::string kAlice = "alice@host";
const std::string kBob = "bob@host";
- source.AddCName(kSenderSsrc, kAlice);
+ source.WithCName(kSenderSsrc, kAlice);
rtc::Buffer packet1 = source.Build();
Sdes middle;
@@ -232,7 +232,7 @@
EXPECT_EQ(source.BlockLength(), middle.BlockLength());
- middle.AddCName(kSenderSsrc + 1, kBob);
+ middle.WithCName(kSenderSsrc + 1, kBob);
rtc::Buffer packet2 = middle.Build();
Sdes destination;
diff --git a/webrtc/modules/rtp_rtcp/source/rtcp_packet/sender_report.cc b/webrtc/modules/rtp_rtcp/source/rtcp_packet/sender_report.cc
index 5e3a6cd..4795bf1 100644
--- a/webrtc/modules/rtp_rtcp/source/rtcp_packet/sender_report.cc
+++ b/webrtc/modules/rtp_rtcp/source/rtcp_packet/sender_report.cc
@@ -105,7 +105,7 @@
return true;
}
-bool SenderReport::AddReportBlock(const ReportBlock& block) {
+bool SenderReport::WithReportBlock(const ReportBlock& block) {
if (report_blocks_.size() >= kMaxNumberOfReportBlocks) {
LOG(LS_WARNING) << "Max report blocks reached.";
return false;
diff --git a/webrtc/modules/rtp_rtcp/source/rtcp_packet/sender_report.h b/webrtc/modules/rtp_rtcp/source/rtcp_packet/sender_report.h
index 91a66b7..a544017 100644
--- a/webrtc/modules/rtp_rtcp/source/rtcp_packet/sender_report.h
+++ b/webrtc/modules/rtp_rtcp/source/rtcp_packet/sender_report.h
@@ -32,18 +32,18 @@
// Parse assumes header is already parsed and validated.
bool Parse(const CommonHeader& packet);
- void SetSenderSsrc(uint32_t ssrc) { sender_ssrc_ = ssrc; }
- void SetNtp(NtpTime ntp) { ntp_ = ntp; }
- void SetRtpTimestamp(uint32_t rtp_timestamp) {
+ void From(uint32_t ssrc) { sender_ssrc_ = ssrc; }
+ void WithNtp(NtpTime ntp) { ntp_ = ntp; }
+ void WithRtpTimestamp(uint32_t rtp_timestamp) {
rtp_timestamp_ = rtp_timestamp;
}
- void SetPacketCount(uint32_t packet_count) {
+ void WithPacketCount(uint32_t packet_count) {
sender_packet_count_ = packet_count;
}
- void SetOctetCount(uint32_t octet_count) {
+ void WithOctetCount(uint32_t octet_count) {
sender_octet_count_ = octet_count;
}
- bool AddReportBlock(const ReportBlock& block);
+ bool WithReportBlock(const ReportBlock& block);
void ClearReportBlocks() { report_blocks_.clear(); }
uint32_t sender_ssrc() const { return sender_ssrc_; }
diff --git a/webrtc/modules/rtp_rtcp/source/rtcp_packet/sender_report_unittest.cc b/webrtc/modules/rtp_rtcp/source/rtcp_packet/sender_report_unittest.cc
index 6611991..ac7fbca 100644
--- a/webrtc/modules/rtp_rtcp/source/rtcp_packet/sender_report_unittest.cc
+++ b/webrtc/modules/rtp_rtcp/source/rtcp_packet/sender_report_unittest.cc
@@ -39,11 +39,11 @@
TEST(RtcpPacketSenderReportTest, CreateWithoutReportBlocks) {
SenderReport sr;
- sr.SetSenderSsrc(kSenderSsrc);
- sr.SetNtp(kNtp);
- sr.SetRtpTimestamp(kRtpTimestamp);
- sr.SetPacketCount(kPacketCount);
- sr.SetOctetCount(kOctetCount);
+ sr.From(kSenderSsrc);
+ sr.WithNtp(kNtp);
+ sr.WithRtpTimestamp(kRtpTimestamp);
+ sr.WithPacketCount(kPacketCount);
+ sr.WithOctetCount(kOctetCount);
rtc::Buffer raw = sr.Build();
EXPECT_THAT(make_tuple(raw.data(), raw.size()), ElementsAreArray(kPacket));
@@ -63,11 +63,11 @@
TEST(RtcpPacketSenderReportTest, CreateAndParseWithOneReportBlock) {
ReportBlock rb;
- rb.SetMediaSsrc(kRemoteSsrc);
+ rb.To(kRemoteSsrc);
SenderReport sr;
- sr.SetSenderSsrc(kSenderSsrc);
- EXPECT_TRUE(sr.AddReportBlock(rb));
+ sr.From(kSenderSsrc);
+ EXPECT_TRUE(sr.WithReportBlock(rb));
rtc::Buffer raw = sr.Build();
SenderReport parsed;
@@ -80,14 +80,14 @@
TEST(RtcpPacketSenderReportTest, CreateAndParseWithTwoReportBlocks) {
ReportBlock rb1;
- rb1.SetMediaSsrc(kRemoteSsrc);
+ rb1.To(kRemoteSsrc);
ReportBlock rb2;
- rb2.SetMediaSsrc(kRemoteSsrc + 1);
+ rb2.To(kRemoteSsrc + 1);
SenderReport sr;
- sr.SetSenderSsrc(kSenderSsrc);
- EXPECT_TRUE(sr.AddReportBlock(rb1));
- EXPECT_TRUE(sr.AddReportBlock(rb2));
+ sr.From(kSenderSsrc);
+ EXPECT_TRUE(sr.WithReportBlock(rb1));
+ EXPECT_TRUE(sr.WithReportBlock(rb2));
rtc::Buffer raw = sr.Build();
SenderReport parsed;
@@ -101,15 +101,15 @@
TEST(RtcpPacketSenderReportTest, CreateWithTooManyReportBlocks) {
SenderReport sr;
- sr.SetSenderSsrc(kSenderSsrc);
+ sr.From(kSenderSsrc);
const size_t kMaxReportBlocks = (1 << 5) - 1;
ReportBlock rb;
for (size_t i = 0; i < kMaxReportBlocks; ++i) {
- rb.SetMediaSsrc(kRemoteSsrc + i);
- EXPECT_TRUE(sr.AddReportBlock(rb));
+ rb.To(kRemoteSsrc + i);
+ EXPECT_TRUE(sr.WithReportBlock(rb));
}
- rb.SetMediaSsrc(kRemoteSsrc + kMaxReportBlocks);
- EXPECT_FALSE(sr.AddReportBlock(rb));
+ rb.To(kRemoteSsrc + kMaxReportBlocks);
+ EXPECT_FALSE(sr.WithReportBlock(rb));
}
} // namespace webrtc
diff --git a/webrtc/modules/rtp_rtcp/source/rtcp_packet/sli.h b/webrtc/modules/rtp_rtcp/source/rtcp_packet/sli.h
index 3214b96..ce1dfe5 100644
--- a/webrtc/modules/rtp_rtcp/source/rtcp_packet/sli.h
+++ b/webrtc/modules/rtp_rtcp/source/rtcp_packet/sli.h
@@ -49,13 +49,11 @@
// Parse assumes header is already parsed and validated.
bool Parse(const CommonHeader& packet);
- void AddPictureId(uint8_t picture_id) {
- items_.emplace_back(picture_id, 0, 0x1fff);
- }
- void AddPictureId(uint8_t picture_id,
- uint16_t first_macroblock,
- uint16_t number_macroblocks) {
- items_.emplace_back(picture_id, first_macroblock, number_macroblocks);
+ void WithPictureId(uint8_t picture_id,
+ uint16_t first_macroblock = 0,
+ uint16_t number_macroblocks = 0x1fff) {
+ items_.push_back(
+ Macroblocks(picture_id, first_macroblock, number_macroblocks));
}
const std::vector<Macroblocks>& macroblocks() const { return items_; }
diff --git a/webrtc/modules/rtp_rtcp/source/rtcp_packet/sli_unittest.cc b/webrtc/modules/rtp_rtcp/source/rtcp_packet/sli_unittest.cc
index 4b2fdea..dfb7d59 100644
--- a/webrtc/modules/rtp_rtcp/source/rtcp_packet/sli_unittest.cc
+++ b/webrtc/modules/rtp_rtcp/source/rtcp_packet/sli_unittest.cc
@@ -42,9 +42,9 @@
TEST(RtcpPacketSliTest, Create) {
Sli sli;
- sli.SetSenderSsrc(kSenderSsrc);
- sli.SetMediaSsrc(kRemoteSsrc);
- sli.AddPictureId(kPictureId, kFirstMb, kNumberOfMb);
+ sli.From(kSenderSsrc);
+ sli.To(kRemoteSsrc);
+ sli.WithPictureId(kPictureId, kFirstMb, kNumberOfMb);
rtc::Buffer packet = sli.Build();
@@ -67,9 +67,9 @@
TEST(RtcpPacketSliTest, ParseFailsOnTooSmallPacket) {
Sli sli;
- sli.SetSenderSsrc(kSenderSsrc);
- sli.SetMediaSsrc(kRemoteSsrc);
- sli.AddPictureId(kPictureId, kFirstMb, kNumberOfMb);
+ sli.From(kSenderSsrc);
+ sli.To(kRemoteSsrc);
+ sli.WithPictureId(kPictureId, kFirstMb, kNumberOfMb);
rtc::Buffer packet = sli.Build();
packet[3]--; // Decrease size by 1 word (4 bytes).
diff --git a/webrtc/modules/rtp_rtcp/source/rtcp_packet/tmmbn.cc b/webrtc/modules/rtp_rtcp/source/rtcp_packet/tmmbn.cc
index a0b785c..f5683fb 100644
--- a/webrtc/modules/rtp_rtcp/source/rtcp_packet/tmmbn.cc
+++ b/webrtc/modules/rtp_rtcp/source/rtcp_packet/tmmbn.cc
@@ -70,7 +70,7 @@
return true;
}
-void Tmmbn::AddTmmbr(const TmmbItem& item) {
+void Tmmbn::WithTmmbr(const TmmbItem& item) {
items_.push_back(item);
}
diff --git a/webrtc/modules/rtp_rtcp/source/rtcp_packet/tmmbn.h b/webrtc/modules/rtp_rtcp/source/rtcp_packet/tmmbn.h
index 23db484..a801816 100644
--- a/webrtc/modules/rtp_rtcp/source/rtcp_packet/tmmbn.h
+++ b/webrtc/modules/rtp_rtcp/source/rtcp_packet/tmmbn.h
@@ -34,7 +34,10 @@
// Parse assumes header is already parsed and validated.
bool Parse(const CommonHeader& packet);
- void AddTmmbr(const TmmbItem& item);
+ void WithTmmbr(uint32_t ssrc, uint32_t bitrate_kbps, uint16_t overhead) {
+ WithTmmbr(TmmbItem(ssrc, bitrate_kbps * 1000, overhead));
+ }
+ void WithTmmbr(const TmmbItem& item);
const std::vector<TmmbItem>& items() const { return items_; }
@@ -51,7 +54,7 @@
}
// Media ssrc is unused, shadow base class setter and getter.
- void SetMediaSsrc(uint32_t ssrc);
+ void To(uint32_t ssrc);
uint32_t media_ssrc() const;
std::vector<TmmbItem> items_;
diff --git a/webrtc/modules/rtp_rtcp/source/rtcp_packet/tmmbn_unittest.cc b/webrtc/modules/rtp_rtcp/source/rtcp_packet/tmmbn_unittest.cc
index e2a3aca..3df6b5d 100644
--- a/webrtc/modules/rtp_rtcp/source/rtcp_packet/tmmbn_unittest.cc
+++ b/webrtc/modules/rtp_rtcp/source/rtcp_packet/tmmbn_unittest.cc
@@ -35,8 +35,8 @@
TEST(RtcpPacketTmmbnTest, Create) {
Tmmbn tmmbn;
- tmmbn.SetSenderSsrc(kSenderSsrc);
- tmmbn.AddTmmbr(TmmbItem(kRemoteSsrc, kBitrateBps, kOverhead));
+ tmmbn.From(kSenderSsrc);
+ tmmbn.WithTmmbr(TmmbItem(kRemoteSsrc, kBitrateBps, kOverhead));
rtc::Buffer packet = tmmbn.Build();
@@ -59,7 +59,7 @@
TEST(RtcpPacketTmmbnTest, CreateAndParseWithoutItems) {
Tmmbn tmmbn;
- tmmbn.SetSenderSsrc(kSenderSsrc);
+ tmmbn.From(kSenderSsrc);
rtc::Buffer packet = tmmbn.Build();
Tmmbn parsed;
@@ -71,9 +71,9 @@
TEST(RtcpPacketTmmbnTest, CreateAndParseWithTwoItems) {
Tmmbn tmmbn;
- tmmbn.SetSenderSsrc(kSenderSsrc);
- tmmbn.AddTmmbr(TmmbItem(kRemoteSsrc, kBitrateBps, kOverhead));
- tmmbn.AddTmmbr(TmmbItem(kRemoteSsrc + 1, 4 * kBitrateBps, 40));
+ tmmbn.From(kSenderSsrc);
+ tmmbn.WithTmmbr(TmmbItem(kRemoteSsrc, kBitrateBps, kOverhead));
+ tmmbn.WithTmmbr(TmmbItem(kRemoteSsrc + 1, 4 * kBitrateBps, 40));
rtc::Buffer packet = tmmbn.Build();
Tmmbn parsed;
diff --git a/webrtc/modules/rtp_rtcp/source/rtcp_packet/tmmbr.cc b/webrtc/modules/rtp_rtcp/source/rtcp_packet/tmmbr.cc
index b4b8ccb..6f957ae 100644
--- a/webrtc/modules/rtp_rtcp/source/rtcp_packet/tmmbr.cc
+++ b/webrtc/modules/rtp_rtcp/source/rtcp_packet/tmmbr.cc
@@ -71,7 +71,7 @@
return true;
}
-void Tmmbr::AddTmmbr(const TmmbItem& item) {
+void Tmmbr::WithTmmbr(const TmmbItem& item) {
items_.push_back(item);
}
diff --git a/webrtc/modules/rtp_rtcp/source/rtcp_packet/tmmbr.h b/webrtc/modules/rtp_rtcp/source/rtcp_packet/tmmbr.h
index 1db99f4..20ccdf2 100644
--- a/webrtc/modules/rtp_rtcp/source/rtcp_packet/tmmbr.h
+++ b/webrtc/modules/rtp_rtcp/source/rtcp_packet/tmmbr.h
@@ -34,7 +34,7 @@
// Parse assumes header is already parsed and validated.
bool Parse(const CommonHeader& packet);
- void AddTmmbr(const TmmbItem& item);
+ void WithTmmbr(const TmmbItem& item);
const std::vector<TmmbItem>& requests() const { return items_; }
@@ -51,7 +51,7 @@
}
// Media ssrc is unused, shadow base class setter.
- void SetMediaSsrc(uint32_t ssrc);
+ void To(uint32_t ssrc);
std::vector<TmmbItem> items_;
diff --git a/webrtc/modules/rtp_rtcp/source/rtcp_packet/tmmbr_unittest.cc b/webrtc/modules/rtp_rtcp/source/rtcp_packet/tmmbr_unittest.cc
index 415ca94..45f12c3 100644
--- a/webrtc/modules/rtp_rtcp/source/rtcp_packet/tmmbr_unittest.cc
+++ b/webrtc/modules/rtp_rtcp/source/rtcp_packet/tmmbr_unittest.cc
@@ -35,8 +35,8 @@
TEST(RtcpPacketTmmbrTest, Create) {
Tmmbr tmmbr;
- tmmbr.SetSenderSsrc(kSenderSsrc);
- tmmbr.AddTmmbr(TmmbItem(kRemoteSsrc, kBitrateBps, kOverhead));
+ tmmbr.From(kSenderSsrc);
+ tmmbr.WithTmmbr(TmmbItem(kRemoteSsrc, kBitrateBps, kOverhead));
rtc::Buffer packet = tmmbr.Build();
@@ -58,9 +58,9 @@
TEST(RtcpPacketTmmbrTest, CreateAndParseWithTwoEntries) {
Tmmbr tmmbr;
- tmmbr.SetSenderSsrc(kSenderSsrc);
- tmmbr.AddTmmbr(TmmbItem(kRemoteSsrc, kBitrateBps, kOverhead));
- tmmbr.AddTmmbr(TmmbItem(kRemoteSsrc + 1, 4 * kBitrateBps, kOverhead + 1));
+ tmmbr.From(kSenderSsrc);
+ tmmbr.WithTmmbr(TmmbItem(kRemoteSsrc, kBitrateBps, kOverhead));
+ tmmbr.WithTmmbr(TmmbItem(kRemoteSsrc + 1, 4 * kBitrateBps, kOverhead + 1));
rtc::Buffer packet = tmmbr.Build();
diff --git a/webrtc/modules/rtp_rtcp/source/rtcp_packet/transport_feedback.cc b/webrtc/modules/rtp_rtcp/source/rtcp_packet/transport_feedback.cc
index 9008aa0..a4f0f6b 100644
--- a/webrtc/modules/rtp_rtcp/source/rtcp_packet/transport_feedback.cc
+++ b/webrtc/modules/rtp_rtcp/source/rtcp_packet/transport_feedback.cc
@@ -304,8 +304,8 @@
return last_seq_ + delta;
}
-void TransportFeedback::SetBase(uint16_t base_sequence,
- int64_t ref_timestamp_us) {
+void TransportFeedback::WithBase(uint16_t base_sequence,
+ int64_t ref_timestamp_us) {
RTC_DCHECK_EQ(-1, base_seq_);
RTC_DCHECK_NE(-1, ref_timestamp_us);
base_seq_ = base_sequence;
@@ -318,12 +318,12 @@
last_timestamp_ = base_time_ * kBaseScaleFactor;
}
-void TransportFeedback::SetFeedbackSequenceNumber(uint8_t feedback_sequence) {
+void TransportFeedback::WithFeedbackSequenceNumber(uint8_t feedback_sequence) {
feedback_seq_ = feedback_sequence;
}
-bool TransportFeedback::AddReceivedPacket(uint16_t sequence_number,
- int64_t timestamp) {
+bool TransportFeedback::WithReceivedPacket(uint16_t sequence_number,
+ int64_t timestamp) {
RTC_DCHECK_NE(-1, base_seq_);
int64_t seq = Unwrap(sequence_number);
if (seq != base_seq_ && seq <= last_seq_)
diff --git a/webrtc/modules/rtp_rtcp/source/rtcp_packet/transport_feedback.h b/webrtc/modules/rtp_rtcp/source/rtcp_packet/transport_feedback.h
index 3d7ef51..6a381ef 100644
--- a/webrtc/modules/rtp_rtcp/source/rtcp_packet/transport_feedback.h
+++ b/webrtc/modules/rtp_rtcp/source/rtcp_packet/transport_feedback.h
@@ -16,7 +16,6 @@
#include <vector>
#include "webrtc/base/constructormagic.h"
-#include "webrtc/base/deprecation.h"
#include "webrtc/modules/rtp_rtcp/source/rtcp_packet/rtpfb.h"
namespace webrtc {
@@ -34,11 +33,13 @@
TransportFeedback();
~TransportFeedback() override;
- void SetBase(uint16_t base_sequence, // Seq# of first packet in this msg.
- int64_t ref_timestamp_us); // Reference timestamp for this msg.
- void SetFeedbackSequenceNumber(uint8_t feedback_sequence);
+ void WithPacketSenderSsrc(uint32_t ssrc) { From(ssrc); }
+ void WithMediaSourceSsrc(uint32_t ssrc) { To(ssrc); }
+ void WithBase(uint16_t base_sequence, // Seq# of first packet in this msg.
+ int64_t ref_timestamp_us); // Reference timestamp for this msg.
+ void WithFeedbackSequenceNumber(uint8_t feedback_sequence);
// NOTE: This method requires increasing sequence numbers (excepting wraps).
- bool AddReceivedPacket(uint16_t sequence_number, int64_t timestamp_us);
+ bool WithReceivedPacket(uint16_t sequence_number, int64_t timestamp_us);
enum class StatusSymbol {
kNotReceived,
@@ -56,27 +57,13 @@
// is relative the base time.
std::vector<int64_t> GetReceiveDeltasUs() const;
+ uint32_t GetPacketSenderSsrc() const { return sender_ssrc(); }
+ uint32_t GetMediaSourceSsrc() const { return media_ssrc(); }
+
bool Parse(const CommonHeader& packet);
static std::unique_ptr<TransportFeedback> ParseFrom(const uint8_t* buffer,
size_t length);
- RTC_DEPRECATED
- void WithPacketSenderSenderSsrc(uint32_t ssrc) { SetSenderSsrc(ssrc); }
- RTC_DEPRECATED
- void WithMediaSourceSsrc(uint32_t ssrc) { SetMediaSsrc(ssrc); }
- RTC_DEPRECATED
- void WithBase(uint16_t base_sequence, int64_t ref_timestamp_us) {
- SetBase(base_sequence, ref_timestamp_us);
- }
- RTC_DEPRECATED
- void WithFeedbackSequenceNumber(uint8_t feedback_sequence) {
- SetFeedbackSequenceNumber(feedback_sequence);
- }
- RTC_DEPRECATED
- bool WithReceivedPacket(uint16_t sequence_number, int64_t timestamp_us) {
- return AddReceivedPacket(sequence_number, timestamp_us);
- }
-
protected:
bool Create(uint8_t* packet,
size_t* position,
diff --git a/webrtc/modules/rtp_rtcp/source/rtcp_packet/transport_feedback_unittest.cc b/webrtc/modules/rtp_rtcp/source/rtcp_packet/transport_feedback_unittest.cc
index 5387330..07f9049 100644
--- a/webrtc/modules/rtp_rtcp/source/rtcp_packet/transport_feedback_unittest.cc
+++ b/webrtc/modules/rtp_rtcp/source/rtcp_packet/transport_feedback_unittest.cc
@@ -55,11 +55,11 @@
expected_deltas_.clear();
feedback_.reset(new TransportFeedback());
- feedback_->SetBase(received_seq[0], received_ts[0]);
+ feedback_->WithBase(received_seq[0], received_ts[0]);
int64_t last_time = feedback_->GetBaseTimeUs();
for (int i = 0; i < length; ++i) {
int64_t time = received_ts[i];
- EXPECT_TRUE(feedback_->AddReceivedPacket(received_seq[i], time));
+ EXPECT_TRUE(feedback_->WithReceivedPacket(received_seq[i], time));
if (last_time != -1) {
int64_t delta = time - last_time;
@@ -332,13 +332,13 @@
TEST(RtcpPacketTest, TransportFeedback_Aliasing) {
TransportFeedback feedback;
- feedback.SetBase(0, 0);
+ feedback.WithBase(0, 0);
const int kSamples = 100;
const int64_t kTooSmallDelta = TransportFeedback::kDeltaScaleFactor / 3;
for (int i = 0; i < kSamples; ++i)
- feedback.AddReceivedPacket(i, i * kTooSmallDelta);
+ feedback.WithReceivedPacket(i, i * kTooSmallDelta);
feedback.Build();
std::vector<int64_t> deltas = feedback.GetReceiveDeltasUs();
@@ -358,48 +358,48 @@
TEST(RtcpPacketTest, TransportFeedback_Limits) {
// Sequence number wrap above 0x8000.
std::unique_ptr<TransportFeedback> packet(new TransportFeedback());
- packet->SetBase(0, 0);
- EXPECT_TRUE(packet->AddReceivedPacket(0x0, 0));
- EXPECT_TRUE(packet->AddReceivedPacket(0x8000, 1000));
+ packet->WithBase(0, 0);
+ EXPECT_TRUE(packet->WithReceivedPacket(0x0, 0));
+ EXPECT_TRUE(packet->WithReceivedPacket(0x8000, 1000));
packet.reset(new TransportFeedback());
- packet->SetBase(0, 0);
- EXPECT_TRUE(packet->AddReceivedPacket(0x0, 0));
- EXPECT_FALSE(packet->AddReceivedPacket(0x8000 + 1, 1000));
+ packet->WithBase(0, 0);
+ EXPECT_TRUE(packet->WithReceivedPacket(0x0, 0));
+ EXPECT_FALSE(packet->WithReceivedPacket(0x8000 + 1, 1000));
// Packet status count max 0xFFFF.
packet.reset(new TransportFeedback());
- packet->SetBase(0, 0);
- EXPECT_TRUE(packet->AddReceivedPacket(0x0, 0));
- EXPECT_TRUE(packet->AddReceivedPacket(0x8000, 1000));
- EXPECT_TRUE(packet->AddReceivedPacket(0xFFFF, 2000));
- EXPECT_FALSE(packet->AddReceivedPacket(0, 3000));
+ packet->WithBase(0, 0);
+ EXPECT_TRUE(packet->WithReceivedPacket(0x0, 0));
+ EXPECT_TRUE(packet->WithReceivedPacket(0x8000, 1000));
+ EXPECT_TRUE(packet->WithReceivedPacket(0xFFFF, 2000));
+ EXPECT_FALSE(packet->WithReceivedPacket(0, 3000));
// Too large delta.
packet.reset(new TransportFeedback());
- packet->SetBase(0, 0);
+ packet->WithBase(0, 0);
int64_t kMaxPositiveTimeDelta = std::numeric_limits<int16_t>::max() *
TransportFeedback::kDeltaScaleFactor;
- EXPECT_FALSE(packet->AddReceivedPacket(
+ EXPECT_FALSE(packet->WithReceivedPacket(
1, kMaxPositiveTimeDelta + TransportFeedback::kDeltaScaleFactor));
- EXPECT_TRUE(packet->AddReceivedPacket(1, kMaxPositiveTimeDelta));
+ EXPECT_TRUE(packet->WithReceivedPacket(1, kMaxPositiveTimeDelta));
// Too large negative delta.
packet.reset(new TransportFeedback());
- packet->SetBase(0, 0);
+ packet->WithBase(0, 0);
int64_t kMaxNegativeTimeDelta = std::numeric_limits<int16_t>::min() *
TransportFeedback::kDeltaScaleFactor;
- EXPECT_FALSE(packet->AddReceivedPacket(
+ EXPECT_FALSE(packet->WithReceivedPacket(
1, kMaxNegativeTimeDelta - TransportFeedback::kDeltaScaleFactor));
- EXPECT_TRUE(packet->AddReceivedPacket(1, kMaxNegativeTimeDelta));
+ EXPECT_TRUE(packet->WithReceivedPacket(1, kMaxNegativeTimeDelta));
// Base time at maximum value.
int64_t kMaxBaseTime =
static_cast<int64_t>(TransportFeedback::kDeltaScaleFactor) * (1L << 8) *
((1L << 23) - 1);
packet.reset(new TransportFeedback());
- packet->SetBase(0, kMaxBaseTime);
- packet->AddReceivedPacket(0, kMaxBaseTime);
+ packet->WithBase(0, kMaxBaseTime);
+ packet->WithReceivedPacket(0, kMaxBaseTime);
// Serialize and de-serialize (verify 24bit parsing).
rtc::Buffer raw_packet = packet->Build();
packet = TransportFeedback::ParseFrom(raw_packet.data(), raw_packet.size());
@@ -409,8 +409,8 @@
int64_t kTooLargeBaseTime =
kMaxBaseTime + (TransportFeedback::kDeltaScaleFactor * (1L << 8));
packet.reset(new TransportFeedback());
- packet->SetBase(0, kTooLargeBaseTime);
- packet->AddReceivedPacket(0, kTooLargeBaseTime);
+ packet->WithBase(0, kTooLargeBaseTime);
+ packet->WithReceivedPacket(0, kTooLargeBaseTime);
raw_packet = packet->Build();
packet = TransportFeedback::ParseFrom(raw_packet.data(), raw_packet.size());
EXPECT_NE(kTooLargeBaseTime, packet->GetBaseTimeUs());
@@ -425,8 +425,8 @@
const size_t kExpectedSizeWords = (kExpectedSizeBytes + 3) / 4;
TransportFeedback feedback;
- feedback.SetBase(0, 0);
- EXPECT_TRUE(feedback.AddReceivedPacket(0, 0));
+ feedback.WithBase(0, 0);
+ EXPECT_TRUE(feedback.WithReceivedPacket(0, 0));
rtc::Buffer packet = feedback.Build();
EXPECT_EQ(kExpectedSizeWords * 4, packet.size());
@@ -466,10 +466,10 @@
for (int deltas = 0; deltas <= kOneBitVectorCapacity + 1; ++deltas) {
TransportFeedback feedback;
- feedback.SetBase(0, 0);
+ feedback.WithBase(0, 0);
for (int i = 0; i < deltas; ++i)
- feedback.AddReceivedPacket(i, i * 1000);
- feedback.AddReceivedPacket(deltas, deltas * 1000 + kLargeTimeDelta);
+ feedback.WithReceivedPacket(i, i * 1000);
+ feedback.WithReceivedPacket(deltas, deltas * 1000 + kLargeTimeDelta);
rtc::Buffer serialized_packet = feedback.Build();
std::unique_ptr<TransportFeedback> deserialized_packet =
diff --git a/webrtc/modules/rtp_rtcp/source/rtcp_packet/voip_metric.h b/webrtc/modules/rtp_rtcp/source/rtcp_packet/voip_metric.h
index 62c26fe..9e3e419 100644
--- a/webrtc/modules/rtp_rtcp/source/rtcp_packet/voip_metric.h
+++ b/webrtc/modules/rtp_rtcp/source/rtcp_packet/voip_metric.h
@@ -35,8 +35,8 @@
// Consumes VoipMetric::kLength bytes.
void Create(uint8_t* buffer) const;
- void SetMediaSsrc(uint32_t ssrc) { ssrc_ = ssrc; }
- void SetVoipMetric(const RTCPVoIPMetric& voip_metric) {
+ void To(uint32_t ssrc) { ssrc_ = ssrc; }
+ void WithVoipMetric(const RTCPVoIPMetric& voip_metric) {
voip_metric_ = voip_metric;
}
diff --git a/webrtc/modules/rtp_rtcp/source/rtcp_packet/voip_metric_unittest.cc b/webrtc/modules/rtp_rtcp/source/rtcp_packet/voip_metric_unittest.cc
index d12889d..44c82d6 100644
--- a/webrtc/modules/rtp_rtcp/source/rtcp_packet/voip_metric_unittest.cc
+++ b/webrtc/modules/rtp_rtcp/source/rtcp_packet/voip_metric_unittest.cc
@@ -51,8 +51,8 @@
metric.JBmax = 0x6667;
metric.JBabsMax = 0x7778;
VoipMetric metric_block;
- metric_block.SetMediaSsrc(kRemoteSsrc);
- metric_block.SetVoipMetric(metric);
+ metric_block.To(kRemoteSsrc);
+ metric_block.WithVoipMetric(metric);
metric_block.Create(buffer);
EXPECT_EQ(0, memcmp(buffer, kBlock, kBlockSizeBytes));
diff --git a/webrtc/modules/rtp_rtcp/source/rtcp_packet_unittest.cc b/webrtc/modules/rtp_rtcp/source/rtcp_packet_unittest.cc
index 082d1c7..58218dd 100644
--- a/webrtc/modules/rtp_rtcp/source/rtcp_packet_unittest.cc
+++ b/webrtc/modules/rtp_rtcp/source/rtcp_packet_unittest.cc
@@ -24,8 +24,8 @@
TEST(RtcpPacketTest, BuildWithTooSmallBuffer) {
ReportBlock rb;
ReceiverReport rr;
- rr.SetSenderSsrc(kSenderSsrc);
- EXPECT_TRUE(rr.AddReportBlock(rb));
+ rr.From(kSenderSsrc);
+ EXPECT_TRUE(rr.WithReportBlock(rb));
const size_t kRrLength = 8;
const size_t kReportBlockLength = 24;
diff --git a/webrtc/modules/rtp_rtcp/source/rtcp_receiver_unittest.cc b/webrtc/modules/rtp_rtcp/source/rtcp_receiver_unittest.cc
index 6f8fe45..c7ca304 100644
--- a/webrtc/modules/rtp_rtcp/source/rtcp_receiver_unittest.cc
+++ b/webrtc/modules/rtp_rtcp/source/rtcp_receiver_unittest.cc
@@ -214,7 +214,7 @@
TEST_F(RtcpReceiverTest, InjectRpsiPacket) {
const uint64_t kPictureId = 0x123456789;
rtcp::Rpsi rpsi;
- rpsi.SetPictureId(kPictureId);
+ rpsi.WithPictureId(kPictureId);
EXPECT_CALL(intra_frame_observer_, OnReceivedRPSI(_, kPictureId));
InjectRtcpPacket(rpsi);
@@ -226,7 +226,7 @@
int64_t now = system_clock_.TimeInMilliseconds();
rtcp::SenderReport sr;
- sr.SetSenderSsrc(kSenderSsrc);
+ sr.From(kSenderSsrc);
EXPECT_CALL(rtp_rtcp_impl_, OnReceivedRtcpReportBlocks(IsEmpty()));
EXPECT_CALL(bandwidth_observer_,
@@ -239,7 +239,7 @@
TEST_F(RtcpReceiverTest, InjectSrPacketFromUnknownSender) {
int64_t now = system_clock_.TimeInMilliseconds();
rtcp::SenderReport sr;
- sr.SetSenderSsrc(kUnknownSenderSsrc);
+ sr.From(kUnknownSenderSsrc);
// The parser will handle report blocks in Sender Report from other than his
// expected peer.
@@ -266,12 +266,12 @@
system_clock_.AdvanceTimeMilliseconds(kRttMs + kDelayMs);
rtcp::SenderReport sr;
- sr.SetSenderSsrc(kSenderSsrc);
+ sr.From(kSenderSsrc);
rtcp::ReportBlock block;
- block.SetMediaSsrc(kReceiverMainSsrc);
- block.SetLastSr(sent_ntp);
- block.SetDelayLastSr(kDelayNtp);
- sr.AddReportBlock(block);
+ block.To(kReceiverMainSsrc);
+ block.WithLastSr(sent_ntp);
+ block.WithDelayLastSr(kDelayNtp);
+ sr.WithReportBlock(block);
EXPECT_CALL(rtp_rtcp_impl_, OnReceivedRtcpReportBlocks(_));
EXPECT_CALL(bandwidth_observer_, OnReceivedRtcpReceiverReport(_, _, _));
@@ -296,12 +296,12 @@
system_clock_.AdvanceTimeMilliseconds(kRttMs + kDelayMs);
rtcp::SenderReport sr;
- sr.SetSenderSsrc(kSenderSsrc);
+ sr.From(kSenderSsrc);
rtcp::ReportBlock block;
- block.SetMediaSsrc(kReceiverMainSsrc);
- block.SetLastSr(sent_ntp);
- block.SetDelayLastSr(kDelayNtp);
- sr.AddReportBlock(block);
+ block.To(kReceiverMainSsrc);
+ block.WithLastSr(sent_ntp);
+ block.WithDelayLastSr(kDelayNtp);
+ sr.WithReportBlock(block);
EXPECT_CALL(rtp_rtcp_impl_, OnReceivedRtcpReportBlocks(SizeIs(1)));
EXPECT_CALL(bandwidth_observer_,
@@ -316,7 +316,7 @@
TEST_F(RtcpReceiverTest, InjectRrPacket) {
int64_t now = system_clock_.TimeInMilliseconds();
rtcp::ReceiverReport rr;
- rr.SetSenderSsrc(kSenderSsrc);
+ rr.From(kSenderSsrc);
EXPECT_CALL(rtp_rtcp_impl_, OnReceivedRtcpReportBlocks(IsEmpty()));
EXPECT_CALL(bandwidth_observer_,
@@ -334,10 +334,10 @@
TEST_F(RtcpReceiverTest, InjectRrPacketWithReportBlockNotToUsIgnored) {
int64_t now = system_clock_.TimeInMilliseconds();
rtcp::ReportBlock rb;
- rb.SetMediaSsrc(kNotToUsSsrc);
+ rb.To(kNotToUsSsrc);
rtcp::ReceiverReport rr;
- rr.SetSenderSsrc(kSenderSsrc);
- rr.AddReportBlock(rb);
+ rr.From(kSenderSsrc);
+ rr.WithReportBlock(rb);
EXPECT_CALL(rtp_rtcp_impl_, OnReceivedRtcpReportBlocks(IsEmpty()));
EXPECT_CALL(bandwidth_observer_,
@@ -354,10 +354,10 @@
int64_t now = system_clock_.TimeInMilliseconds();
rtcp::ReportBlock rb;
- rb.SetMediaSsrc(kReceiverMainSsrc);
+ rb.To(kReceiverMainSsrc);
rtcp::ReceiverReport rr;
- rr.SetSenderSsrc(kSenderSsrc);
- rr.AddReportBlock(rb);
+ rr.From(kSenderSsrc);
+ rr.WithReportBlock(rb);
EXPECT_CALL(rtp_rtcp_impl_, OnReceivedRtcpReportBlocks(SizeIs(1)));
EXPECT_CALL(bandwidth_observer_,
@@ -377,19 +377,19 @@
int64_t now = system_clock_.TimeInMilliseconds();
rtcp::ReportBlock rb1;
- rb1.SetMediaSsrc(kReceiverMainSsrc);
- rb1.SetExtHighestSeqNum(kSequenceNumbers[0]);
- rb1.SetFractionLost(10);
+ rb1.To(kReceiverMainSsrc);
+ rb1.WithExtHighestSeqNum(kSequenceNumbers[0]);
+ rb1.WithFractionLost(10);
rtcp::ReportBlock rb2;
- rb2.SetMediaSsrc(kReceiverExtraSsrc);
- rb2.SetExtHighestSeqNum(kSequenceNumbers[1]);
- rb2.SetFractionLost(0);
+ rb2.To(kReceiverExtraSsrc);
+ rb2.WithExtHighestSeqNum(kSequenceNumbers[1]);
+ rb2.WithFractionLost(0);
rtcp::ReceiverReport rr1;
- rr1.SetSenderSsrc(kSenderSsrc);
- rr1.AddReportBlock(rb1);
- rr1.AddReportBlock(rb2);
+ rr1.From(kSenderSsrc);
+ rr1.WithReportBlock(rb1);
+ rr1.WithReportBlock(rb2);
EXPECT_CALL(rtp_rtcp_impl_, OnReceivedRtcpReportBlocks(SizeIs(2)));
EXPECT_CALL(bandwidth_observer_,
@@ -405,21 +405,21 @@
// Insert next receiver report with same ssrc but new values.
rtcp::ReportBlock rb3;
- rb3.SetMediaSsrc(kReceiverMainSsrc);
- rb3.SetExtHighestSeqNum(kSequenceNumbers[0]);
- rb3.SetFractionLost(kFracLost[0]);
- rb3.SetCumulativeLost(kCumLost[0]);
+ rb3.To(kReceiverMainSsrc);
+ rb3.WithExtHighestSeqNum(kSequenceNumbers[0]);
+ rb3.WithFractionLost(kFracLost[0]);
+ rb3.WithCumulativeLost(kCumLost[0]);
rtcp::ReportBlock rb4;
- rb4.SetMediaSsrc(kReceiverExtraSsrc);
- rb4.SetExtHighestSeqNum(kSequenceNumbers[1]);
- rb4.SetFractionLost(kFracLost[1]);
- rb4.SetCumulativeLost(kCumLost[1]);
+ rb4.To(kReceiverExtraSsrc);
+ rb4.WithExtHighestSeqNum(kSequenceNumbers[1]);
+ rb4.WithFractionLost(kFracLost[1]);
+ rb4.WithCumulativeLost(kCumLost[1]);
rtcp::ReceiverReport rr2;
- rr2.SetSenderSsrc(kSenderSsrc);
- rr2.AddReportBlock(rb3);
- rr2.AddReportBlock(rb4);
+ rr2.From(kSenderSsrc);
+ rr2.WithReportBlock(rb3);
+ rr2.WithReportBlock(rb4);
// Advance time to make 1st sent time and 2nd sent time different.
system_clock_.AdvanceTimeMilliseconds(500);
@@ -454,13 +454,13 @@
const uint8_t kFracLost[] = {20, 11};
rtcp::ReportBlock rb1;
- rb1.SetMediaSsrc(kReceiverMainSsrc);
- rb1.SetExtHighestSeqNum(kSequenceNumbers[0]);
- rb1.SetFractionLost(kFracLost[0]);
- rb1.SetCumulativeLost(kCumLost[0]);
+ rb1.To(kReceiverMainSsrc);
+ rb1.WithExtHighestSeqNum(kSequenceNumbers[0]);
+ rb1.WithFractionLost(kFracLost[0]);
+ rb1.WithCumulativeLost(kCumLost[0]);
rtcp::ReceiverReport rr1;
- rr1.SetSenderSsrc(kSenderSsrc);
- rr1.AddReportBlock(rb1);
+ rr1.From(kSenderSsrc);
+ rr1.WithReportBlock(rb1);
int64_t now = system_clock_.TimeInMilliseconds();
@@ -481,13 +481,13 @@
EXPECT_EQ(kSequenceNumbers[0], received_blocks[0].extendedHighSeqNum);
rtcp::ReportBlock rb2;
- rb2.SetMediaSsrc(kReceiverMainSsrc);
- rb2.SetExtHighestSeqNum(kSequenceNumbers[1]);
- rb2.SetFractionLost(kFracLost[1]);
- rb2.SetCumulativeLost(kCumLost[1]);
+ rb2.To(kReceiverMainSsrc);
+ rb2.WithExtHighestSeqNum(kSequenceNumbers[1]);
+ rb2.WithFractionLost(kFracLost[1]);
+ rb2.WithCumulativeLost(kCumLost[1]);
rtcp::ReceiverReport rr2;
- rr2.SetSenderSsrc(kSenderSsrc2);
- rr2.AddReportBlock(rb2);
+ rr2.From(kSenderSsrc2);
+ rr2.WithReportBlock(rb2);
EXPECT_CALL(rtp_rtcp_impl_, OnReceivedRtcpReportBlocks(SizeIs(1)));
EXPECT_CALL(bandwidth_observer_,
@@ -519,11 +519,11 @@
-1, rtcp_receiver_.RTT(kSenderSsrc, nullptr, nullptr, nullptr, nullptr));
rtcp::ReportBlock rb;
- rb.SetMediaSsrc(kReceiverMainSsrc);
+ rb.To(kReceiverMainSsrc);
rtcp::ReceiverReport rr;
- rr.SetSenderSsrc(kSenderSsrc);
- rr.AddReportBlock(rb);
+ rr.From(kSenderSsrc);
+ rr.WithReportBlock(rb);
int64_t now = system_clock_.TimeInMilliseconds();
EXPECT_CALL(rtp_rtcp_impl_, OnReceivedRtcpReportBlocks(_));
@@ -544,10 +544,10 @@
// App packets are ignored.
TEST_F(RtcpReceiverTest, InjectApp) {
rtcp::App app;
- app.SetSubType(30);
- app.SetName(0x17a177e);
+ app.WithSubType(30);
+ app.WithName(0x17a177e);
const uint8_t kData[] = {'t', 'e', 's', 't', 'd', 'a', 't', 'a'};
- app.SetData(kData, sizeof(kData));
+ app.WithData(kData, sizeof(kData));
InjectRtcpPacket(app);
}
@@ -557,7 +557,7 @@
MockRtcpCallbackImpl callback;
rtcp_receiver_.RegisterRtcpStatisticsCallback(&callback);
rtcp::Sdes sdes;
- sdes.AddCName(kSenderSsrc, kCname);
+ sdes.WithCName(kSenderSsrc, kCname);
EXPECT_CALL(callback, CNameChanged(StrEq(kCname), kSenderSsrc));
InjectRtcpPacket(sdes);
@@ -570,7 +570,7 @@
TEST_F(RtcpReceiverTest, InjectByePacket_RemovesCname) {
const char kCname[] = "alice@host";
rtcp::Sdes sdes;
- sdes.AddCName(kSenderSsrc, kCname);
+ sdes.WithCName(kSenderSsrc, kCname);
InjectRtcpPacket(sdes);
@@ -579,7 +579,7 @@
// Verify that BYE removes the CNAME.
rtcp::Bye bye;
- bye.SetSenderSsrc(kSenderSsrc);
+ bye.From(kSenderSsrc);
InjectRtcpPacket(bye);
@@ -588,13 +588,13 @@
TEST_F(RtcpReceiverTest, InjectByePacket_RemovesReportBlocks) {
rtcp::ReportBlock rb1;
- rb1.SetMediaSsrc(kReceiverMainSsrc);
+ rb1.To(kReceiverMainSsrc);
rtcp::ReportBlock rb2;
- rb2.SetMediaSsrc(kReceiverExtraSsrc);
+ rb2.To(kReceiverExtraSsrc);
rtcp::ReceiverReport rr;
- rr.SetSenderSsrc(kSenderSsrc);
- rr.AddReportBlock(rb1);
- rr.AddReportBlock(rb2);
+ rr.From(kSenderSsrc);
+ rr.WithReportBlock(rb1);
+ rr.WithReportBlock(rb2);
EXPECT_CALL(rtp_rtcp_impl_, OnReceivedRtcpReportBlocks(_));
EXPECT_CALL(bandwidth_observer_, OnReceivedRtcpReceiverReport(_, _, _));
@@ -606,7 +606,7 @@
// Verify that BYE removes the report blocks.
rtcp::Bye bye;
- bye.SetSenderSsrc(kSenderSsrc);
+ bye.From(kSenderSsrc);
InjectRtcpPacket(bye);
@@ -626,7 +626,7 @@
TEST_F(RtcpReceiverTest, InjectPliPacket) {
rtcp::Pli pli;
- pli.SetMediaSsrc(kReceiverMainSsrc);
+ pli.To(kReceiverMainSsrc);
EXPECT_CALL(
packet_type_counter_observer_,
@@ -639,7 +639,7 @@
TEST_F(RtcpReceiverTest, PliPacketNotToUsIgnored) {
rtcp::Pli pli;
- pli.SetMediaSsrc(kNotToUsSsrc);
+ pli.To(kNotToUsSsrc);
EXPECT_CALL(
packet_type_counter_observer_,
@@ -651,7 +651,7 @@
TEST_F(RtcpReceiverTest, InjectFirPacket) {
rtcp::Fir fir;
- fir.AddRequestTo(kReceiverMainSsrc, 13);
+ fir.WithRequestTo(kReceiverMainSsrc, 13);
EXPECT_CALL(
packet_type_counter_observer_,
@@ -664,7 +664,7 @@
TEST_F(RtcpReceiverTest, FirPacketNotToUsIgnored) {
rtcp::Fir fir;
- fir.AddRequestTo(kNotToUsSsrc, 13);
+ fir.WithRequestTo(kNotToUsSsrc, 13);
EXPECT_CALL(intra_frame_observer_, OnReceivedIntraFrameRequest(_)).Times(0);
InjectRtcpPacket(fir);
@@ -673,7 +673,7 @@
TEST_F(RtcpReceiverTest, InjectSliPacket) {
const uint8_t kPictureId = 40;
rtcp::Sli sli;
- sli.AddPictureId(kPictureId);
+ sli.WithPictureId(kPictureId);
EXPECT_CALL(intra_frame_observer_, OnReceivedSLI(_, kPictureId));
InjectRtcpPacket(sli);
@@ -681,7 +681,7 @@
TEST_F(RtcpReceiverTest, ExtendedReportsPacketWithZeroReportBlocksIgnored) {
rtcp::ExtendedReports xr;
- xr.SetSenderSsrc(kSenderSsrc);
+ xr.From(kSenderSsrc);
InjectRtcpPacket(xr);
}
@@ -690,23 +690,23 @@
TEST_F(RtcpReceiverTest, InjectExtendedReportsVoipPacket) {
const uint8_t kLossRate = 123;
rtcp::VoipMetric voip_metric;
- voip_metric.SetMediaSsrc(kReceiverMainSsrc);
+ voip_metric.To(kReceiverMainSsrc);
RTCPVoIPMetric metric;
metric.lossRate = kLossRate;
- voip_metric.SetVoipMetric(metric);
+ voip_metric.WithVoipMetric(metric);
rtcp::ExtendedReports xr;
- xr.SetSenderSsrc(kSenderSsrc);
- xr.AddVoipMetric(voip_metric);
+ xr.From(kSenderSsrc);
+ xr.WithVoipMetric(voip_metric);
InjectRtcpPacket(xr);
}
TEST_F(RtcpReceiverTest, ExtendedReportsVoipPacketNotToUsIgnored) {
rtcp::VoipMetric voip_metric;
- voip_metric.SetMediaSsrc(kNotToUsSsrc);
+ voip_metric.To(kNotToUsSsrc);
rtcp::ExtendedReports xr;
- xr.SetSenderSsrc(kSenderSsrc);
- xr.AddVoipMetric(voip_metric);
+ xr.From(kSenderSsrc);
+ xr.WithVoipMetric(voip_metric);
InjectRtcpPacket(xr);
}
@@ -714,10 +714,10 @@
TEST_F(RtcpReceiverTest, InjectExtendedReportsReceiverReferenceTimePacket) {
const NtpTime kNtp(0x10203, 0x40506);
rtcp::Rrtr rrtr;
- rrtr.SetNtp(kNtp);
+ rrtr.WithNtp(kNtp);
rtcp::ExtendedReports xr;
- xr.SetSenderSsrc(kSenderSsrc);
- xr.AddRrtr(rrtr);
+ xr.From(kSenderSsrc);
+ xr.WithRrtr(rrtr);
RtcpReceiveTimeInfo rrtime;
EXPECT_FALSE(rtcp_receiver_.LastReceivedXrReferenceTimeInfo(&rrtime));
@@ -739,10 +739,10 @@
rtcp_receiver_.SetRtcpXrRrtrStatus(true);
rtcp::Dlrr dlrr;
- dlrr.AddDlrrItem(kNotToUsSsrc, 0x12345, 0x67890);
+ dlrr.WithDlrrItem(kNotToUsSsrc, 0x12345, 0x67890);
rtcp::ExtendedReports xr;
- xr.SetSenderSsrc(kSenderSsrc);
- xr.AddDlrr(dlrr);
+ xr.From(kSenderSsrc);
+ xr.WithDlrr(dlrr);
InjectRtcpPacket(xr);
@@ -758,10 +758,10 @@
EXPECT_FALSE(rtcp_receiver_.GetAndResetXrRrRtt(&rtt_ms));
rtcp::Dlrr dlrr;
- dlrr.AddDlrrItem(kReceiverMainSsrc, kLastRR, kDelay);
+ dlrr.WithDlrrItem(kReceiverMainSsrc, kLastRR, kDelay);
rtcp::ExtendedReports xr;
- xr.SetSenderSsrc(kSenderSsrc);
- xr.AddDlrr(dlrr);
+ xr.From(kSenderSsrc);
+ xr.WithDlrr(dlrr);
InjectRtcpPacket(xr);
@@ -777,12 +777,12 @@
rtcp_receiver_.SetRtcpXrRrtrStatus(true);
rtcp::ExtendedReports xr;
- xr.SetSenderSsrc(kSenderSsrc);
+ xr.From(kSenderSsrc);
rtcp::Dlrr dlrr;
- dlrr.AddDlrrItem(kReceiverMainSsrc, kLastRR, kDelay);
- dlrr.AddDlrrItem(kReceiverMainSsrc + 1, 0x12345, 0x67890);
- dlrr.AddDlrrItem(kReceiverMainSsrc + 2, 0x12345, 0x67890);
- xr.AddDlrr(dlrr);
+ dlrr.WithDlrrItem(kReceiverMainSsrc, kLastRR, kDelay);
+ dlrr.WithDlrrItem(kReceiverMainSsrc + 1, 0x12345, 0x67890);
+ dlrr.WithDlrrItem(kReceiverMainSsrc + 2, 0x12345, 0x67890);
+ xr.WithDlrr(dlrr);
InjectRtcpPacket(xr);
@@ -798,14 +798,14 @@
rtcp::Rrtr rrtr;
rtcp::Dlrr dlrr;
- dlrr.AddDlrrItem(kReceiverMainSsrc, 0x12345, 0x67890);
+ dlrr.WithDlrrItem(kReceiverMainSsrc, 0x12345, 0x67890);
rtcp::VoipMetric metric;
- metric.SetMediaSsrc(kReceiverMainSsrc);
+ metric.To(kReceiverMainSsrc);
rtcp::ExtendedReports xr;
- xr.SetSenderSsrc(kSenderSsrc);
- xr.AddRrtr(rrtr);
- xr.AddDlrr(dlrr);
- xr.AddVoipMetric(metric);
+ xr.From(kSenderSsrc);
+ xr.WithRrtr(rrtr);
+ xr.WithDlrr(dlrr);
+ xr.WithVoipMetric(metric);
InjectRtcpPacket(xr);
@@ -820,14 +820,14 @@
rtcp::Rrtr rrtr;
rtcp::Dlrr dlrr;
- dlrr.AddDlrrItem(kReceiverMainSsrc, 0x12345, 0x67890);
+ dlrr.WithDlrrItem(kReceiverMainSsrc, 0x12345, 0x67890);
rtcp::VoipMetric metric;
- metric.SetMediaSsrc(kReceiverMainSsrc);
+ metric.To(kReceiverMainSsrc);
rtcp::ExtendedReports xr;
- xr.SetSenderSsrc(kSenderSsrc);
- xr.AddRrtr(rrtr);
- xr.AddDlrr(dlrr);
- xr.AddVoipMetric(metric);
+ xr.From(kSenderSsrc);
+ xr.WithRrtr(rrtr);
+ xr.WithDlrr(dlrr);
+ xr.WithVoipMetric(metric);
rtc::Buffer packet = xr.Build();
// Modify the DLRR block to have an unsupported block type, from 5 to 6.
@@ -861,10 +861,10 @@
system_clock_.AdvanceTimeMilliseconds(kRttMs + kDelayMs);
rtcp::Dlrr dlrr;
- dlrr.AddDlrrItem(kReceiverMainSsrc, sent_ntp, kDelayNtp);
+ dlrr.WithDlrrItem(kReceiverMainSsrc, sent_ntp, kDelayNtp);
rtcp::ExtendedReports xr;
- xr.SetSenderSsrc(kSenderSsrc);
- xr.AddDlrr(dlrr);
+ xr.From(kSenderSsrc);
+ xr.WithDlrr(dlrr);
InjectRtcpPacket(xr);
@@ -884,10 +884,10 @@
rtcp_receiver_.SetRtcpXrRrtrStatus(true);
rtcp::Dlrr dlrr;
- dlrr.AddDlrrItem(kReceiverMainSsrc, sent_ntp, kDelayNtp);
+ dlrr.WithDlrrItem(kReceiverMainSsrc, sent_ntp, kDelayNtp);
rtcp::ExtendedReports xr;
- xr.SetSenderSsrc(kSenderSsrc);
- xr.AddDlrr(dlrr);
+ xr.From(kSenderSsrc);
+ xr.WithDlrr(dlrr);
InjectRtcpPacket(xr);
@@ -906,10 +906,10 @@
const uint32_t kNtpMid = CompactNtp(kNtp);
rtcp::Rrtr rrtr;
- rrtr.SetNtp(kNtp);
+ rrtr.WithNtp(kNtp);
rtcp::ExtendedReports xr;
- xr.SetSenderSsrc(kSenderSsrc);
- xr.AddRrtr(rrtr);
+ xr.From(kSenderSsrc);
+ xr.WithRrtr(rrtr);
InjectRtcpPacket(xr);
@@ -935,11 +935,11 @@
// Add a RR and advance the clock just enough to not trigger a timeout.
rtcp::ReportBlock rb1;
- rb1.SetMediaSsrc(kReceiverMainSsrc);
- rb1.SetExtHighestSeqNum(kSequenceNumber);
+ rb1.To(kReceiverMainSsrc);
+ rb1.WithExtHighestSeqNum(kSequenceNumber);
rtcp::ReceiverReport rr1;
- rr1.SetSenderSsrc(kSenderSsrc);
- rr1.AddReportBlock(rb1);
+ rr1.From(kSenderSsrc);
+ rr1.WithReportBlock(rb1);
EXPECT_CALL(rtp_rtcp_impl_, OnReceivedRtcpReportBlocks(_));
EXPECT_CALL(bandwidth_observer_, OnReceivedRtcpReceiverReport(_, _, _));
@@ -970,11 +970,11 @@
// Add a new RR with increase sequence number to reset timers.
rtcp::ReportBlock rb2;
- rb2.SetMediaSsrc(kReceiverMainSsrc);
- rb2.SetExtHighestSeqNum(kSequenceNumber + 1);
+ rb2.To(kReceiverMainSsrc);
+ rb2.WithExtHighestSeqNum(kSequenceNumber + 1);
rtcp::ReceiverReport rr2;
- rr2.SetSenderSsrc(kSenderSsrc);
- rr2.AddReportBlock(rb2);
+ rr2.From(kSenderSsrc);
+ rr2.WithReportBlock(rb2);
EXPECT_CALL(rtp_rtcp_impl_, OnReceivedRtcpReportBlocks(_));
EXPECT_CALL(bandwidth_observer_, OnReceivedRtcpReceiverReport(_, _, _));
@@ -1004,10 +1004,10 @@
TEST_F(RtcpReceiverTest, TmmbrPacketAccepted) {
const uint32_t kBitrateBps = 30000;
rtcp::Tmmbr tmmbr;
- tmmbr.SetSenderSsrc(kSenderSsrc);
- tmmbr.AddTmmbr(rtcp::TmmbItem(kReceiverMainSsrc, kBitrateBps, 0));
+ tmmbr.From(kSenderSsrc);
+ tmmbr.WithTmmbr(rtcp::TmmbItem(kReceiverMainSsrc, kBitrateBps, 0));
rtcp::SenderReport sr;
- sr.SetSenderSsrc(kSenderSsrc);
+ sr.From(kSenderSsrc);
rtcp::CompoundPacket compound;
compound.Append(&sr);
compound.Append(&tmmbr);
@@ -1027,11 +1027,11 @@
TEST_F(RtcpReceiverTest, TmmbrPacketNotForUsIgnored) {
const uint32_t kBitrateBps = 30000;
rtcp::Tmmbr tmmbr;
- tmmbr.SetSenderSsrc(kSenderSsrc);
- tmmbr.AddTmmbr(rtcp::TmmbItem(kNotToUsSsrc, kBitrateBps, 0));
+ tmmbr.From(kSenderSsrc);
+ tmmbr.WithTmmbr(rtcp::TmmbItem(kNotToUsSsrc, kBitrateBps, 0));
rtcp::SenderReport sr;
- sr.SetSenderSsrc(kSenderSsrc);
+ sr.From(kSenderSsrc);
rtcp::CompoundPacket compound;
compound.Append(&sr);
compound.Append(&tmmbr);
@@ -1046,10 +1046,10 @@
TEST_F(RtcpReceiverTest, TmmbrPacketZeroRateIgnored) {
rtcp::Tmmbr tmmbr;
- tmmbr.SetSenderSsrc(kSenderSsrc);
- tmmbr.AddTmmbr(rtcp::TmmbItem(kReceiverMainSsrc, 0, 0));
+ tmmbr.From(kSenderSsrc);
+ tmmbr.WithTmmbr(rtcp::TmmbItem(kReceiverMainSsrc, 0, 0));
rtcp::SenderReport sr;
- sr.SetSenderSsrc(kSenderSsrc);
+ sr.From(kSenderSsrc);
rtcp::CompoundPacket compound;
compound.Append(&sr);
compound.Append(&tmmbr);
@@ -1067,10 +1067,10 @@
// The times of arrival are starttime + 0, starttime + 5 and starttime + 10.
for (uint32_t ssrc = kSenderSsrc; ssrc < kSenderSsrc + 3; ++ssrc) {
rtcp::Tmmbr tmmbr;
- tmmbr.SetSenderSsrc(ssrc);
- tmmbr.AddTmmbr(rtcp::TmmbItem(kReceiverMainSsrc, 30000, 0));
+ tmmbr.From(ssrc);
+ tmmbr.WithTmmbr(rtcp::TmmbItem(kReceiverMainSsrc, 30000, 0));
rtcp::SenderReport sr;
- sr.SetSenderSsrc(ssrc);
+ sr.From(ssrc);
rtcp::CompoundPacket compound;
compound.Append(&sr);
compound.Append(&tmmbr);
@@ -1108,15 +1108,15 @@
// First packet, all numbers should just propagate.
rtcp::ReportBlock rb1;
- rb1.SetMediaSsrc(kReceiverMainSsrc);
- rb1.SetExtHighestSeqNum(kSequenceNumber);
- rb1.SetFractionLost(kFractionLoss);
- rb1.SetCumulativeLost(kCumulativeLoss);
- rb1.SetJitter(kJitter);
+ rb1.To(kReceiverMainSsrc);
+ rb1.WithExtHighestSeqNum(kSequenceNumber);
+ rb1.WithFractionLost(kFractionLoss);
+ rb1.WithCumulativeLost(kCumulativeLoss);
+ rb1.WithJitter(kJitter);
rtcp::ReceiverReport rr1;
- rr1.SetSenderSsrc(kSenderSsrc);
- rr1.AddReportBlock(rb1);
+ rr1.From(kSenderSsrc);
+ rr1.WithReportBlock(rb1);
EXPECT_CALL(
callback,
StatisticsUpdated(
@@ -1134,15 +1134,15 @@
// Add arbitrary numbers, callback should not be called.
rtcp::ReportBlock rb2;
- rb2.SetMediaSsrc(kReceiverMainSsrc);
- rb2.SetExtHighestSeqNum(kSequenceNumber + 1);
- rb2.SetFractionLost(42);
- rb2.SetCumulativeLost(137);
- rb2.SetJitter(4711);
+ rb2.To(kReceiverMainSsrc);
+ rb2.WithExtHighestSeqNum(kSequenceNumber + 1);
+ rb2.WithFractionLost(42);
+ rb2.WithCumulativeLost(137);
+ rb2.WithJitter(4711);
rtcp::ReceiverReport rr2;
- rr2.SetSenderSsrc(kSenderSsrc);
- rr2.AddReportBlock(rb2);
+ rr2.From(kSenderSsrc);
+ rr2.WithReportBlock(rb2);
EXPECT_CALL(rtp_rtcp_impl_, OnReceivedRtcpReportBlocks(_));
EXPECT_CALL(bandwidth_observer_, OnReceivedRtcpReceiverReport(_, _, _));
@@ -1152,10 +1152,10 @@
TEST_F(RtcpReceiverTest, ReceivesTransportFeedback) {
rtcp::TransportFeedback packet;
- packet.SetMediaSsrc(kReceiverMainSsrc);
- packet.SetSenderSsrc(kSenderSsrc);
- packet.SetBase(1, 1000);
- packet.AddReceivedPacket(1, 1000);
+ packet.To(kReceiverMainSsrc);
+ packet.From(kSenderSsrc);
+ packet.WithBase(1, 1000);
+ packet.WithReceivedPacket(1, 1000);
EXPECT_CALL(
transport_feedback_observer_,
@@ -1168,8 +1168,8 @@
TEST_F(RtcpReceiverTest, ReceivesRemb) {
const uint32_t kBitrateBps = 500000;
rtcp::Remb remb;
- remb.SetSenderSsrc(kSenderSsrc);
- remb.SetBitrateBps(kBitrateBps);
+ remb.From(kSenderSsrc);
+ remb.WithBitrateBps(kBitrateBps);
EXPECT_CALL(bandwidth_observer_, OnReceivedEstimatedBitrate(kBitrateBps));
InjectRtcpPacket(remb);
@@ -1178,15 +1178,15 @@
TEST_F(RtcpReceiverTest, HandlesInvalidTransportFeedback) {
// Send a compound packet with a TransportFeedback followed by something else.
rtcp::TransportFeedback packet;
- packet.SetMediaSsrc(kReceiverMainSsrc);
- packet.SetSenderSsrc(kSenderSsrc);
- packet.SetBase(1, 1000);
- packet.AddReceivedPacket(1, 1000);
+ packet.To(kReceiverMainSsrc);
+ packet.From(kSenderSsrc);
+ packet.WithBase(1, 1000);
+ packet.WithReceivedPacket(1, 1000);
static uint32_t kBitrateBps = 50000;
rtcp::Remb remb;
- remb.SetSenderSsrc(kSenderSsrc);
- remb.SetBitrateBps(kBitrateBps);
+ remb.From(kSenderSsrc);
+ remb.WithBitrateBps(kBitrateBps);
rtcp::CompoundPacket compound;
compound.Append(&packet);
compound.Append(&remb);
@@ -1214,9 +1214,9 @@
nack_set.insert(std::begin(kNackList2), std::end(kNackList2));
rtcp::Nack nack;
- nack.SetSenderSsrc(kSenderSsrc);
- nack.SetMediaSsrc(kReceiverMainSsrc);
- nack.SetPacketIds(kNackList1, kNackListLength1);
+ nack.From(kSenderSsrc);
+ nack.To(kReceiverMainSsrc);
+ nack.WithList(kNackList1, kNackListLength1);
EXPECT_CALL(rtp_rtcp_impl_, OnReceivedNack(ElementsAreArray(kNackList1)));
EXPECT_CALL(
@@ -1229,9 +1229,9 @@
InjectRtcpPacket(nack);
rtcp::Nack nack2;
- nack2.SetSenderSsrc(kSenderSsrc);
- nack2.SetMediaSsrc(kReceiverMainSsrc);
- nack2.SetPacketIds(kNackList2, kNackListLength2);
+ nack2.From(kSenderSsrc);
+ nack2.To(kReceiverMainSsrc);
+ nack2.WithList(kNackList2, kNackListLength2);
EXPECT_CALL(rtp_rtcp_impl_, OnReceivedNack(ElementsAreArray(kNackList2)));
EXPECT_CALL(packet_type_counter_observer_,
RtcpPacketTypesCounterUpdated(
@@ -1248,9 +1248,9 @@
const size_t kNackListLength1 = std::end(kNackList1) - std::begin(kNackList1);
rtcp::Nack nack;
- nack.SetSenderSsrc(kSenderSsrc);
- nack.SetMediaSsrc(kNotToUsSsrc);
- nack.SetPacketIds(kNackList1, kNackListLength1);
+ nack.From(kSenderSsrc);
+ nack.To(kNotToUsSsrc);
+ nack.WithList(kNackList1, kNackListLength1);
EXPECT_CALL(packet_type_counter_observer_,
RtcpPacketTypesCounterUpdated(
@@ -1260,8 +1260,8 @@
TEST_F(RtcpReceiverTest, ForceSenderReport) {
rtcp::RapidResyncRequest rr;
- rr.SetSenderSsrc(kSenderSsrc);
- rr.SetMediaSsrc(kReceiverMainSsrc);
+ rr.From(kSenderSsrc);
+ rr.To(kReceiverMainSsrc);
EXPECT_CALL(rtp_rtcp_impl_, OnRequestSendReport());
InjectRtcpPacket(rr);
diff --git a/webrtc/modules/rtp_rtcp/source/rtcp_sender.cc b/webrtc/modules/rtp_rtcp/source/rtcp_sender.cc
index 859ac05..7762e66 100644
--- a/webrtc/modules/rtp_rtcp/source/rtcp_sender.cc
+++ b/webrtc/modules/rtp_rtcp/source/rtcp_sender.cc
@@ -449,14 +449,14 @@
(ctx.feedback_state_.frequency_hz / 1000);
rtcp::SenderReport* report = new rtcp::SenderReport();
- report->SetSenderSsrc(ssrc_);
- report->SetNtp(NtpTime(ctx.ntp_sec_, ctx.ntp_frac_));
- report->SetRtpTimestamp(rtp_timestamp);
- report->SetPacketCount(ctx.feedback_state_.packets_sent);
- report->SetOctetCount(ctx.feedback_state_.media_bytes_sent);
+ report->From(ssrc_);
+ report->WithNtp(NtpTime(ctx.ntp_sec_, ctx.ntp_frac_));
+ report->WithRtpTimestamp(rtp_timestamp);
+ report->WithPacketCount(ctx.feedback_state_.packets_sent);
+ report->WithOctetCount(ctx.feedback_state_.media_bytes_sent);
for (auto it : report_blocks_)
- report->AddReportBlock(it.second);
+ report->WithReportBlock(it.second);
report_blocks_.clear();
@@ -469,19 +469,19 @@
RTC_CHECK_LT(length_cname, static_cast<size_t>(RTCP_CNAME_SIZE));
rtcp::Sdes* sdes = new rtcp::Sdes();
- sdes->AddCName(ssrc_, cname_);
+ sdes->WithCName(ssrc_, cname_);
for (const auto it : csrc_cnames_)
- sdes->AddCName(it.first, it.second);
+ sdes->WithCName(it.first, it.second);
return std::unique_ptr<rtcp::RtcpPacket>(sdes);
}
std::unique_ptr<rtcp::RtcpPacket> RTCPSender::BuildRR(const RtcpContext& ctx) {
rtcp::ReceiverReport* report = new rtcp::ReceiverReport();
- report->SetSenderSsrc(ssrc_);
+ report->From(ssrc_);
for (auto it : report_blocks_)
- report->AddReportBlock(it.second);
+ report->WithReportBlock(it.second);
report_blocks_.clear();
return std::unique_ptr<rtcp::RtcpPacket>(report);
@@ -489,8 +489,8 @@
std::unique_ptr<rtcp::RtcpPacket> RTCPSender::BuildPLI(const RtcpContext& ctx) {
rtcp::Pli* pli = new rtcp::Pli();
- pli->SetSenderSsrc(ssrc_);
- pli->SetMediaSsrc(remote_ssrc_);
+ pli->From(ssrc_);
+ pli->To(remote_ssrc_);
TRACE_EVENT_INSTANT0(TRACE_DISABLED_BY_DEFAULT("webrtc_rtp"),
"RTCPSender::PLI");
@@ -506,8 +506,8 @@
++sequence_number_fir_; // Do not increase if repetition.
rtcp::Fir* fir = new rtcp::Fir();
- fir->SetSenderSsrc(ssrc_);
- fir->AddRequestTo(remote_ssrc_, sequence_number_fir_);
+ fir->From(ssrc_);
+ fir->WithRequestTo(remote_ssrc_, sequence_number_fir_);
TRACE_EVENT_INSTANT0(TRACE_DISABLED_BY_DEFAULT("webrtc_rtp"),
"RTCPSender::FIR");
@@ -527,10 +527,10 @@
*/
std::unique_ptr<rtcp::RtcpPacket> RTCPSender::BuildSLI(const RtcpContext& ctx) {
rtcp::Sli* sli = new rtcp::Sli();
- sli->SetSenderSsrc(ssrc_);
- sli->SetMediaSsrc(remote_ssrc_);
+ sli->From(ssrc_);
+ sli->To(remote_ssrc_);
// Crop picture id to 6 least significant bits.
- sli->AddPictureId(ctx.picture_id_ & 0x3F);
+ sli->WithPictureId(ctx.picture_id_ & 0x3F);
return std::unique_ptr<rtcp::RtcpPacket>(sli);
}
@@ -553,10 +553,10 @@
return nullptr;
rtcp::Rpsi* rpsi = new rtcp::Rpsi();
- rpsi->SetSenderSsrc(ssrc_);
- rpsi->SetMediaSsrc(remote_ssrc_);
- rpsi->SetPayloadType(ctx.feedback_state_.send_payload_type);
- rpsi->SetPictureId(ctx.picture_id_);
+ rpsi->From(ssrc_);
+ rpsi->To(remote_ssrc_);
+ rpsi->WithPayloadType(ctx.feedback_state_.send_payload_type);
+ rpsi->WithPictureId(ctx.picture_id_);
return std::unique_ptr<rtcp::RtcpPacket>(rpsi);
}
@@ -564,9 +564,10 @@
std::unique_ptr<rtcp::RtcpPacket> RTCPSender::BuildREMB(
const RtcpContext& ctx) {
rtcp::Remb* remb = new rtcp::Remb();
- remb->SetSenderSsrc(ssrc_);
- remb->SetBitrateBps(remb_bitrate_);
- remb->SetSsrcs(remb_ssrcs_);
+ remb->From(ssrc_);
+ for (uint32_t ssrc : remb_ssrcs_)
+ remb->AppliesTo(ssrc);
+ remb->WithBitrateBps(remb_bitrate_);
TRACE_EVENT_INSTANT0(TRACE_DISABLED_BY_DEFAULT("webrtc_rtp"),
"RTCPSender::REMB");
@@ -625,12 +626,12 @@
return nullptr;
rtcp::Tmmbr* tmmbr = new rtcp::Tmmbr();
- tmmbr->SetSenderSsrc(ssrc_);
+ tmmbr->From(ssrc_);
rtcp::TmmbItem request;
request.set_ssrc(remote_ssrc_);
request.set_bitrate_bps(tmmbr_send_bps_);
request.set_packet_overhead(packet_oh_send_);
- tmmbr->AddTmmbr(request);
+ tmmbr->WithTmmbr(request);
return std::unique_ptr<rtcp::RtcpPacket>(tmmbr);
}
@@ -638,10 +639,10 @@
std::unique_ptr<rtcp::RtcpPacket> RTCPSender::BuildTMMBN(
const RtcpContext& ctx) {
rtcp::Tmmbn* tmmbn = new rtcp::Tmmbn();
- tmmbn->SetSenderSsrc(ssrc_);
+ tmmbn->From(ssrc_);
for (const rtcp::TmmbItem& tmmbr : tmmbn_to_send_) {
if (tmmbr.bitrate_bps() > 0) {
- tmmbn->AddTmmbr(tmmbr);
+ tmmbn->WithTmmbr(tmmbr);
}
}
@@ -650,10 +651,10 @@
std::unique_ptr<rtcp::RtcpPacket> RTCPSender::BuildAPP(const RtcpContext& ctx) {
rtcp::App* app = new rtcp::App();
- app->SetSsrc(ssrc_);
- app->SetSubType(app_sub_type_);
- app->SetName(app_name_);
- app->SetData(app_data_.get(), app_length_);
+ app->From(ssrc_);
+ app->WithSubType(app_sub_type_);
+ app->WithName(app_name_);
+ app->WithData(app_data_.get(), app_length_);
return std::unique_ptr<rtcp::RtcpPacket>(app);
}
@@ -661,9 +662,9 @@
std::unique_ptr<rtcp::RtcpPacket> RTCPSender::BuildNACK(
const RtcpContext& ctx) {
rtcp::Nack* nack = new rtcp::Nack();
- nack->SetSenderSsrc(ssrc_);
- nack->SetMediaSsrc(remote_ssrc_);
- nack->SetPacketIds(ctx.nack_list_, ctx.nack_size_);
+ nack->From(ssrc_);
+ nack->To(remote_ssrc_);
+ nack->WithList(ctx.nack_list_, ctx.nack_size_);
// Report stats.
NACKStringBuilder stringBuilder;
@@ -686,8 +687,9 @@
std::unique_ptr<rtcp::RtcpPacket> RTCPSender::BuildBYE(const RtcpContext& ctx) {
rtcp::Bye* bye = new rtcp::Bye();
- bye->SetSenderSsrc(ssrc_);
- bye->SetCsrcs(csrcs_);
+ bye->From(ssrc_);
+ for (uint32_t csrc : csrcs_)
+ bye->WithCsrc(csrc);
return std::unique_ptr<rtcp::RtcpPacket>(bye);
}
@@ -696,12 +698,12 @@
const RtcpContext& ctx) {
rtcp::ExtendedReports* xr = new rtcp::ExtendedReports();
- xr->SetSenderSsrc(ssrc_);
+ xr->From(ssrc_);
rtcp::Rrtr rrtr;
- rrtr.SetNtp(NtpTime(ctx.ntp_sec_, ctx.ntp_frac_));
+ rrtr.WithNtp(NtpTime(ctx.ntp_sec_, ctx.ntp_frac_));
- xr->AddRrtr(rrtr);
+ xr->WithRrtr(rrtr);
// TODO(sprang): Merge XR report sending to contain all of RRTR, DLRR, VOIP?
@@ -711,13 +713,13 @@
std::unique_ptr<rtcp::RtcpPacket> RTCPSender::BuildDlrr(
const RtcpContext& ctx) {
rtcp::ExtendedReports* xr = new rtcp::ExtendedReports();
- xr->SetSenderSsrc(ssrc_);
+ xr->From(ssrc_);
rtcp::Dlrr dlrr;
const RtcpReceiveTimeInfo& info = ctx.feedback_state_.last_xr_rr;
- dlrr.AddDlrrItem(info.sourceSSRC, info.lastRR, info.delaySinceLastRR);
+ dlrr.WithDlrrItem(info.sourceSSRC, info.lastRR, info.delaySinceLastRR);
- xr->AddDlrr(dlrr);
+ xr->WithDlrr(dlrr);
return std::unique_ptr<rtcp::RtcpPacket>(xr);
}
@@ -726,13 +728,13 @@
std::unique_ptr<rtcp::RtcpPacket> RTCPSender::BuildVoIPMetric(
const RtcpContext& context) {
rtcp::ExtendedReports* xr = new rtcp::ExtendedReports();
- xr->SetSenderSsrc(ssrc_);
+ xr->From(ssrc_);
rtcp::VoipMetric voip;
- voip.SetMediaSsrc(remote_ssrc_);
- voip.SetVoipMetric(xr_voip_metric_);
+ voip.To(remote_ssrc_);
+ voip.WithVoipMetric(xr_voip_metric_);
- xr->AddVoipMetric(voip);
+ xr->WithVoipMetric(voip);
return std::unique_ptr<rtcp::RtcpPacket>(xr);
}
@@ -903,16 +905,16 @@
}
RTC_DCHECK(report_blocks_.find(ssrc) == report_blocks_.end());
rtcp::ReportBlock* block = &report_blocks_[ssrc];
- block->SetMediaSsrc(ssrc);
- block->SetFractionLost(stats.fraction_lost);
- if (!block->SetCumulativeLost(stats.cumulative_lost)) {
+ block->To(ssrc);
+ block->WithFractionLost(stats.fraction_lost);
+ if (!block->WithCumulativeLost(stats.cumulative_lost)) {
report_blocks_.erase(ssrc);
LOG(LS_WARNING) << "Cumulative lost is oversized.";
return false;
}
- block->SetExtHighestSeqNum(stats.extended_max_sequence_number);
- block->SetJitter(stats.jitter);
- block->SetLastSr(feedback_state.remote_sr);
+ block->WithExtHighestSeqNum(stats.extended_max_sequence_number);
+ block->WithJitter(stats.jitter);
+ block->WithLastSr(feedback_state.remote_sr);
// TODO(sprang): Do we really need separate time stamps for each report?
// Get our NTP as late as possible to avoid a race.
@@ -932,7 +934,7 @@
receiveTime <<= 16;
receiveTime += (feedback_state.last_rr_ntp_frac & 0xffff0000) >> 16;
- block->SetDelayLastSr(now - receiveTime);
+ block->WithDelayLastSr(now - receiveTime);
}
return true;
}
diff --git a/webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl_unittest.cc b/webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl_unittest.cc
index b43f95d..dfd928c 100644
--- a/webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl_unittest.cc
+++ b/webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl_unittest.cc
@@ -216,9 +216,9 @@
uint16_t list[1];
list[0] = sequence_number;
const uint16_t kListLength = sizeof(list) / sizeof(list[0]);
- nack.SetSenderSsrc(sender ? kReceiverSsrc : kSenderSsrc);
- nack.SetMediaSsrc(sender ? kSenderSsrc : kReceiverSsrc);
- nack.SetPacketIds(list, kListLength);
+ nack.From(sender ? kReceiverSsrc : kSenderSsrc);
+ nack.To(sender ? kSenderSsrc : kReceiverSsrc);
+ nack.WithList(list, kListLength);
rtc::Buffer packet = nack.Build();
EXPECT_EQ(0, module->impl_->IncomingRtcpPacket(packet.data(),
packet.size()));
diff --git a/webrtc/video/end_to_end_tests.cc b/webrtc/video/end_to_end_tests.cc
index b3d667e..14e370e 100644
--- a/webrtc/video/end_to_end_tests.cc
+++ b/webrtc/video/end_to_end_tests.cc
@@ -531,10 +531,10 @@
} else {
// Send a NACK as often as necessary until retransmission is received.
rtcp::Nack nack;
- nack.SetSenderSsrc(local_ssrc_);
- nack.SetMediaSsrc(remote_ssrc_);
+ nack.From(local_ssrc_);
+ nack.To(remote_ssrc_);
uint16_t nack_list[] = {*sequence_number_to_retransmit_};
- nack.SetPacketIds(nack_list, 1);
+ nack.WithList(nack_list, 1);
rtc::Buffer buffer = nack.Build();
EXPECT_TRUE(receive_transport_->SendRtcp(buffer.data(), buffer.size()));