Remove SetRTCPApplicationSpecificData.

Also removing some related code that appears to be unused.
This is a part of simplifying the RtpRtcpInterface implementation.

Bug: webrtc:11581
Change-Id: I580bfdc1b821d571cb7437d7713a49ee4de2d19a
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/176568
Reviewed-by: Erik Språng <sprang@webrtc.org>
Commit-Queue: Tommi <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31464}
This commit is contained in:
Tomas Gunnarsson
2020-06-08 11:21:42 +02:00
committed by Commit Bot
parent 2dcf348011
commit 9766b890a8
10 changed files with 23 additions and 120 deletions

View File

@ -39,6 +39,14 @@ class RtpRtcp : public Module, public RtpRtcpInterface {
RTPExtensionType type,
uint8_t id) = 0;
// (APP) Sets application specific data.
// Returns -1 on failure else 0.
RTC_DEPRECATED virtual int32_t SetRTCPApplicationSpecificData(
uint8_t sub_type,
uint32_t name,
const uint8_t* data,
uint16_t length) = 0;
// Requests new key frame.
// using PLI, https://tools.ietf.org/html/rfc4585#section-6.3.1.1
void SendPictureLossIndication() { SendRTCP(kRtcpPli); }

View File

@ -91,7 +91,6 @@ enum RTCPPacketType : uint32_t {
kRtcpTmmbr = 0x0100,
kRtcpTmmbn = 0x0200,
kRtcpSrReq = 0x0400,
kRtcpApp = 0x1000,
kRtcpLossNotification = 0x2000,
kRtcpRemb = 0x10000,
kRtcpTransmissionTimeOffset = 0x20000,

View File

@ -160,11 +160,6 @@ class MockRtpRtcpInterface : public RtpRtcpInterface {
GetLatestReportBlockData,
(),
(const, override));
MOCK_METHOD(
int32_t,
SetRTCPApplicationSpecificData,
(uint8_t sub_type, uint32_t name, const uint8_t* data, uint16_t length),
(override));
MOCK_METHOD(void, SetRtcpXrRrtrStatus, (bool enable), (override));
MOCK_METHOD(bool, RtcpXrRrtrStatus, (), (const, override));
MOCK_METHOD(void,

View File

@ -176,11 +176,6 @@ RTCPSender::RTCPSender(const RtpRtcpInterface::Configuration& config)
packet_oh_send_(0),
max_packet_size_(IP_PACKET_SIZE - 28), // IPv4 + UDP by default.
app_sub_type_(0),
app_name_(0),
app_data_(nullptr),
app_length_(0),
xr_send_receiver_reference_time_enabled_(false),
packet_type_counter_observer_(config.rtcp_packet_type_counter_observer),
send_video_bitrate_allocation_(false),
@ -194,7 +189,6 @@ RTCPSender::RTCPSender(const RtpRtcpInterface::Configuration& config)
builders_[kRtcpFir] = &RTCPSender::BuildFIR;
builders_[kRtcpRemb] = &RTCPSender::BuildREMB;
builders_[kRtcpBye] = &RTCPSender::BuildBYE;
builders_[kRtcpApp] = &RTCPSender::BuildAPP;
builders_[kRtcpLossNotification] = &RTCPSender::BuildLossNotification;
builders_[kRtcpTmmbr] = &RTCPSender::BuildTMMBR;
builders_[kRtcpTmmbn] = &RTCPSender::BuildTMMBN;
@ -614,9 +608,6 @@ std::unique_ptr<rtcp::RtcpPacket> RTCPSender::BuildTMMBN(
std::unique_ptr<rtcp::RtcpPacket> RTCPSender::BuildAPP(const RtcpContext& ctx) {
rtcp::App* app = new rtcp::App();
app->SetSenderSsrc(ssrc_);
app->SetSubType(app_sub_type_);
app->SetName(app_name_);
app->SetData(app_data_.get(), app_length_);
return std::unique_ptr<rtcp::RtcpPacket>(app);
}
@ -783,14 +774,15 @@ absl::optional<int32_t> RTCPSender::ComputeCompoundRTCPPacket(
auto it = report_flags_.begin();
while (it != report_flags_.end()) {
auto builder_it = builders_.find(it->type);
RTC_DCHECK(builder_it != builders_.end())
<< "Could not find builder for packet type " << it->type;
if (it->is_volatile) {
report_flags_.erase(it++);
} else {
++it;
}
if (builder_it == builders_.end()) {
RTC_NOTREACHED() << "Could not find builder for packet type " << it->type;
} else {
BuilderFunc func = builder_it->second;
std::unique_ptr<rtcp::RtcpPacket> packet = (this->*func)(context);
if (packet == nullptr)
@ -803,6 +795,7 @@ absl::optional<int32_t> RTCPSender::ComputeCompoundRTCPPacket(
out_packet->Append(packet.release());
}
}
}
// Append the BYE now at the end
if (packet_bye) {
@ -906,25 +899,6 @@ void RTCPSender::SetCsrcs(const std::vector<uint32_t>& csrcs) {
csrcs_ = csrcs;
}
int32_t RTCPSender::SetApplicationSpecificData(uint8_t subType,
uint32_t name,
const uint8_t* data,
uint16_t length) {
if (length % 4 != 0) {
RTC_LOG(LS_ERROR) << "Failed to SetApplicationSpecificData.";
return -1;
}
rtc::CritScope lock(&critical_section_rtcp_sender_);
SetFlag(kRtcpApp, true);
app_sub_type_ = subType;
app_name_ = name;
app_data_.reset(new uint8_t[length]);
app_length_ = length;
memcpy(app_data_.get(), data, length);
return 0;
}
void RTCPSender::SendRtcpXrReceiverReferenceTime(bool enable) {
rtc::CritScope lock(&critical_section_rtcp_sender_);
xr_send_receiver_reference_time_enabled_ = enable;

View File

@ -145,12 +145,6 @@ class RTCPSender final {
void SetTmmbn(std::vector<rtcp::TmmbItem> bounding_set)
RTC_LOCKS_EXCLUDED(critical_section_rtcp_sender_);
int32_t SetApplicationSpecificData(uint8_t subType,
uint32_t name,
const uint8_t* data,
uint16_t length)
RTC_LOCKS_EXCLUDED(critical_section_rtcp_sender_);
void SendRtcpXrReceiverReferenceTime(bool enable)
RTC_LOCKS_EXCLUDED(critical_section_rtcp_sender_);
@ -278,13 +272,6 @@ class RTCPSender final {
uint32_t packet_oh_send_ RTC_GUARDED_BY(critical_section_rtcp_sender_);
size_t max_packet_size_ RTC_GUARDED_BY(critical_section_rtcp_sender_);
// APP
uint8_t app_sub_type_ RTC_GUARDED_BY(critical_section_rtcp_sender_);
uint32_t app_name_ RTC_GUARDED_BY(critical_section_rtcp_sender_);
std::unique_ptr<uint8_t[]> app_data_
RTC_GUARDED_BY(critical_section_rtcp_sender_);
uint16_t app_length_ RTC_GUARDED_BY(critical_section_rtcp_sender_);
// True if sending of XR Receiver reference time report is enabled.
bool xr_send_receiver_reference_time_enabled_
RTC_GUARDED_BY(critical_section_rtcp_sender_);

View File

@ -315,47 +315,6 @@ TEST_F(RtcpSenderTest, StopSendingTriggersBye) {
EXPECT_EQ(kSenderSsrc, parser()->bye()->sender_ssrc());
}
TEST_F(RtcpSenderTest, SendApp) {
const uint8_t kSubType = 30;
uint32_t name = 'n' << 24;
name += 'a' << 16;
name += 'm' << 8;
name += 'e';
const uint8_t kData[] = {'t', 'e', 's', 't', 'd', 'a', 't', 'a'};
EXPECT_EQ(0, rtcp_sender_->SetApplicationSpecificData(kSubType, name, kData,
sizeof(kData)));
rtcp_sender_->SetRTCPStatus(RtcpMode::kReducedSize);
EXPECT_EQ(0, rtcp_sender_->SendRTCP(feedback_state(), kRtcpApp));
EXPECT_EQ(1, parser()->app()->num_packets());
EXPECT_EQ(kSubType, parser()->app()->sub_type());
EXPECT_EQ(name, parser()->app()->name());
EXPECT_EQ(sizeof(kData), parser()->app()->data_size());
EXPECT_EQ(0, memcmp(kData, parser()->app()->data(), sizeof(kData)));
}
TEST_F(RtcpSenderTest, SendEmptyApp) {
const uint8_t kSubType = 30;
const uint32_t kName = 0x6E616D65;
EXPECT_EQ(
0, rtcp_sender_->SetApplicationSpecificData(kSubType, kName, nullptr, 0));
rtcp_sender_->SetRTCPStatus(RtcpMode::kReducedSize);
EXPECT_EQ(0, rtcp_sender_->SendRTCP(feedback_state(), kRtcpApp));
EXPECT_EQ(1, parser()->app()->num_packets());
EXPECT_EQ(kSubType, parser()->app()->sub_type());
EXPECT_EQ(kName, parser()->app()->name());
EXPECT_EQ(0U, parser()->app()->data_size());
}
TEST_F(RtcpSenderTest, SetInvalidApplicationSpecificData) {
const uint8_t kData[] = {'t', 'e', 's', 't', 'd', 'a', 't'};
const uint16_t kInvalidDataLength = sizeof(kData) / sizeof(kData[0]);
EXPECT_EQ(-1,
rtcp_sender_->SetApplicationSpecificData(
0, 0, kData, kInvalidDataLength)); // Should by multiple of 4.
}
TEST_F(RtcpSenderTest, SendFir) {
rtcp_sender_->SetRTCPStatus(RtcpMode::kReducedSize);
EXPECT_EQ(0, rtcp_sender_->SendRTCP(feedback_state(), kRtcpFir));

View File

@ -523,7 +523,8 @@ int32_t ModuleRtpRtcpImpl::SetRTCPApplicationSpecificData(
const uint32_t name,
const uint8_t* data,
const uint16_t length) {
return rtcp_sender_.SetApplicationSpecificData(sub_type, name, data, length);
RTC_NOTREACHED() << "Not implemented";
return -1;
}
void ModuleRtpRtcpImpl::SetRtcpXrRrtrStatus(bool enable) {

View File

@ -523,14 +523,6 @@ int32_t ModuleRtpRtcpImpl2::SendRTCP(RTCPPacketType packet_type) {
return rtcp_sender_.SendRTCP(GetFeedbackState(), packet_type);
}
int32_t ModuleRtpRtcpImpl2::SetRTCPApplicationSpecificData(
const uint8_t sub_type,
const uint32_t name,
const uint8_t* data,
const uint16_t length) {
return rtcp_sender_.SetApplicationSpecificData(sub_type, name, data, length);
}
void ModuleRtpRtcpImpl2::SetRtcpXrRrtrStatus(bool enable) {
rtcp_receiver_.SetRtcpXrRrtrStatus(enable);
rtcp_sender_.SendRtcpXrReceiverReferenceTime(enable);

View File

@ -246,12 +246,6 @@ class ModuleRtpRtcpImpl2 final : public RtpRtcpInterface,
void SendCombinedRtcpPacket(
std::vector<std::unique_ptr<rtcp::RtcpPacket>> rtcp_packets) override;
// (APP) Application specific data.
int32_t SetRTCPApplicationSpecificData(uint8_t sub_type,
uint32_t name,
const uint8_t* data,
uint16_t length) override;
// (XR) Receiver reference time report.
void SetRtcpXrRrtrStatus(bool enable) override;

View File

@ -381,12 +381,6 @@ class RtpRtcpInterface : public RtcpFeedbackSenderInterface {
// that pair.
virtual std::vector<ReportBlockData> GetLatestReportBlockData() const = 0;
// (APP) Sets application specific data.
// Returns -1 on failure else 0.
virtual int32_t SetRTCPApplicationSpecificData(uint8_t sub_type,
uint32_t name,
const uint8_t* data,
uint16_t length) = 0;
// (XR) Sets Receiver Reference Time Report (RTTR) status.
virtual void SetRtcpXrRrtrStatus(bool enable) = 0;