Remove external report blocks from RtcpSender and rtp_rtcp interface.
Feature does not seem to be used and complicates other refactoring of the rtcp module. BUG= R=asapersson@webrtc.org, henrik.lundin@webrtc.org Review URL: https://webrtc-codereview.appspot.com/54569004 Cr-Commit-Position: refs/heads/master@{#9304}
This commit is contained in:
parent
23c2e55479
commit
11beccd712
@ -456,21 +456,6 @@ class RtpRtcp : public Module {
|
||||
virtual int32_t RemoteRTCPStat(
|
||||
std::vector<RTCPReportBlock>* receiveBlocks) const = 0;
|
||||
|
||||
/*
|
||||
* Set received RTCP report block
|
||||
*
|
||||
* return -1 on failure else 0
|
||||
*/
|
||||
virtual int32_t AddRTCPReportBlock(uint32_t SSRC,
|
||||
const RTCPReportBlock* receiveBlock) = 0;
|
||||
|
||||
/*
|
||||
* RemoveRTCPReportBlock
|
||||
*
|
||||
* return -1 on failure else 0
|
||||
*/
|
||||
virtual int32_t RemoveRTCPReportBlock(uint32_t SSRC) = 0;
|
||||
|
||||
/*
|
||||
* (APP) Application specific data
|
||||
*
|
||||
|
@ -173,10 +173,6 @@ class MockRtpRtcp : public RtpRtcp {
|
||||
int32_t(RTCPSenderInfo* senderInfo));
|
||||
MOCK_CONST_METHOD1(RemoteRTCPStat,
|
||||
int32_t(std::vector<RTCPReportBlock>* receiveBlocks));
|
||||
MOCK_METHOD2(AddRTCPReportBlock,
|
||||
int32_t(const uint32_t SSRC, const RTCPReportBlock* receiveBlock));
|
||||
MOCK_METHOD1(RemoveRTCPReportBlock,
|
||||
int32_t(const uint32_t SSRC));
|
||||
MOCK_METHOD4(SetRTCPApplicationSpecificData,
|
||||
int32_t(const uint8_t subType, const uint32_t name, const uint8_t* data, const uint16_t length));
|
||||
MOCK_METHOD1(SetRTCPVoIPMetrics,
|
||||
|
@ -184,9 +184,6 @@ RTCPSender::~RTCPSender() {
|
||||
for (auto it : internal_report_blocks_)
|
||||
delete it.second;
|
||||
|
||||
for (auto it : external_report_blocks_)
|
||||
delete it.second;
|
||||
|
||||
for (auto it : csrc_cnames_)
|
||||
delete it.second;
|
||||
}
|
||||
@ -467,13 +464,6 @@ bool RTCPSender::SendTimeOfXrRrReport(uint32_t mid_ntp,
|
||||
return true;
|
||||
}
|
||||
|
||||
int32_t RTCPSender::AddExternalReportBlock(
|
||||
uint32_t SSRC,
|
||||
const RTCPReportBlock* reportBlock) {
|
||||
CriticalSectionScoped lock(critical_section_rtcp_sender_.get());
|
||||
return AddReportBlock(SSRC, &external_report_blocks_, reportBlock);
|
||||
}
|
||||
|
||||
int32_t RTCPSender::AddReportBlock(
|
||||
uint32_t SSRC,
|
||||
std::map<uint32_t, RTCPReportBlock*>* report_blocks,
|
||||
@ -496,20 +486,6 @@ int32_t RTCPSender::AddReportBlock(
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t RTCPSender::RemoveExternalReportBlock(uint32_t SSRC) {
|
||||
CriticalSectionScoped lock(critical_section_rtcp_sender_.get());
|
||||
|
||||
std::map<uint32_t, RTCPReportBlock*>::iterator it =
|
||||
external_report_blocks_.find(SSRC);
|
||||
|
||||
if (it == external_report_blocks_.end()) {
|
||||
return -1;
|
||||
}
|
||||
delete it->second;
|
||||
external_report_blocks_.erase(it);
|
||||
return 0;
|
||||
}
|
||||
|
||||
RTCPSender::BuildResult RTCPSender::BuildSR(RtcpContext* ctx) {
|
||||
// sanity
|
||||
if (ctx->position + 52 >= IP_PACKET_SIZE) {
|
||||
@ -716,13 +692,6 @@ RTCPSender::BuildResult RTCPSender::BuildRR(RtcpContext* ctx) {
|
||||
|
||||
RTCPSender::BuildResult RTCPSender::BuildExtendedJitterReport(
|
||||
RtcpContext* ctx) {
|
||||
if (external_report_blocks_.size() > 0) {
|
||||
// TODO(andresp): Remove external report blocks since they are not
|
||||
// supported.
|
||||
LOG(LS_ERROR) << "Handling of external report blocks not implemented.";
|
||||
return BuildResult::kError;
|
||||
}
|
||||
|
||||
// sanity
|
||||
if (ctx->position + 8 >= IP_PACKET_SIZE)
|
||||
return BuildResult::kTruncated;
|
||||
@ -1661,8 +1630,7 @@ bool RTCPSender::RtcpXrReceiverReferenceTime() const {
|
||||
RTCPSender::BuildResult RTCPSender::WriteAllReportBlocksToBuffer(
|
||||
RtcpContext* ctx,
|
||||
uint8_t* numberOfReportBlocks) {
|
||||
*numberOfReportBlocks = external_report_blocks_.size();
|
||||
*numberOfReportBlocks += internal_report_blocks_.size();
|
||||
*numberOfReportBlocks = internal_report_blocks_.size();
|
||||
if ((ctx->position + *numberOfReportBlocks * 24) >= IP_PACKET_SIZE) {
|
||||
LOG(LS_WARNING) << "Can't fit all report blocks.";
|
||||
return BuildResult::kError;
|
||||
@ -1672,7 +1640,6 @@ RTCPSender::BuildResult RTCPSender::WriteAllReportBlocksToBuffer(
|
||||
delete internal_report_blocks_.begin()->second;
|
||||
internal_report_blocks_.erase(internal_report_blocks_.begin());
|
||||
}
|
||||
WriteReportBlocksToBuffer(ctx, external_report_blocks_);
|
||||
return BuildResult::kSuccess;
|
||||
}
|
||||
|
||||
|
@ -121,11 +121,6 @@ public:
|
||||
bool repeat = false,
|
||||
uint64_t pictureID = 0);
|
||||
|
||||
int32_t AddExternalReportBlock(uint32_t SSRC,
|
||||
const RTCPReportBlock* receiveBlock);
|
||||
|
||||
int32_t RemoveExternalReportBlock(uint32_t SSRC);
|
||||
|
||||
bool REMB() const;
|
||||
|
||||
void SetREMBStatus(bool enable);
|
||||
@ -273,8 +268,6 @@ private:
|
||||
GUARDED_BY(critical_section_rtcp_sender_);
|
||||
std::map<uint32_t, RTCPReportBlock*> internal_report_blocks_
|
||||
GUARDED_BY(critical_section_rtcp_sender_);
|
||||
std::map<uint32_t, RTCPReportBlock*> external_report_blocks_
|
||||
GUARDED_BY(critical_section_rtcp_sender_);
|
||||
std::map<uint32_t, RTCPUtility::RTCPCnameInformation*> csrc_cnames_
|
||||
GUARDED_BY(critical_section_rtcp_sender_);
|
||||
|
||||
|
@ -628,17 +628,6 @@ int32_t ModuleRtpRtcpImpl::RemoteRTCPStat(
|
||||
return rtcp_receiver_.StatisticsReceived(receive_blocks);
|
||||
}
|
||||
|
||||
int32_t ModuleRtpRtcpImpl::AddRTCPReportBlock(
|
||||
const uint32_t ssrc,
|
||||
const RTCPReportBlock* report_block) {
|
||||
return rtcp_sender_.AddExternalReportBlock(ssrc, report_block);
|
||||
}
|
||||
|
||||
int32_t ModuleRtpRtcpImpl::RemoveRTCPReportBlock(
|
||||
const uint32_t ssrc) {
|
||||
return rtcp_sender_.RemoveExternalReportBlock(ssrc);
|
||||
}
|
||||
|
||||
// (REMB) Receiver Estimated Max Bitrate.
|
||||
bool ModuleRtpRtcpImpl::REMB() const {
|
||||
return rtcp_sender_.REMB();
|
||||
|
@ -183,12 +183,6 @@ class ModuleRtpRtcpImpl : public RtpRtcp {
|
||||
int32_t RemoteRTCPStat(
|
||||
std::vector<RTCPReportBlock>* receive_blocks) const override;
|
||||
|
||||
// Set received RTCP report block.
|
||||
int32_t AddRTCPReportBlock(uint32_t ssrc,
|
||||
const RTCPReportBlock* receive_block) override;
|
||||
|
||||
int32_t RemoveRTCPReportBlock(uint32_t ssrc) override;
|
||||
|
||||
// (REMB) Receiver Estimated Max Bitrate.
|
||||
bool REMB() const override;
|
||||
|
||||
|
@ -246,103 +246,6 @@ TEST_F(RtpRtcpRtcpTest, RTCP_CNAME) {
|
||||
EXPECT_EQ(-1, module2->RemoteCNAME(rtp_receiver2_->SSRC(), cName));
|
||||
}
|
||||
|
||||
TEST_F(RtpRtcpRtcpTest, RTCP) {
|
||||
RTCPReportBlock reportBlock;
|
||||
reportBlock.remoteSSRC = 1;
|
||||
reportBlock.sourceSSRC = 2;
|
||||
reportBlock.cumulativeLost = 1;
|
||||
reportBlock.delaySinceLastSR = 2;
|
||||
reportBlock.extendedHighSeqNum = 3;
|
||||
reportBlock.fractionLost= 4;
|
||||
reportBlock.jitter = 5;
|
||||
reportBlock.lastSR = 6;
|
||||
|
||||
// Set report blocks.
|
||||
EXPECT_EQ(0, module1->AddRTCPReportBlock(test_csrcs[0], &reportBlock));
|
||||
|
||||
reportBlock.lastSR= 7;
|
||||
EXPECT_EQ(0, module1->AddRTCPReportBlock(test_csrcs[1], &reportBlock));
|
||||
|
||||
uint32_t name = 't' << 24;
|
||||
name += 'e' << 16;
|
||||
name += 's' << 8;
|
||||
name += 't';
|
||||
EXPECT_EQ(0, module1->SetRTCPApplicationSpecificData(
|
||||
3,
|
||||
name,
|
||||
(const uint8_t *)"test test test test test test test test test"\
|
||||
" test test test test test test test test test test test test test"\
|
||||
" test test test test test test test test test test test test test"\
|
||||
" test test test test test test test test test test test test test"\
|
||||
" test test test test test test test test test test test test ",
|
||||
300));
|
||||
|
||||
// send RTCP packet, triggered by timer
|
||||
fake_clock.AdvanceTimeMilliseconds(7500);
|
||||
module1->Process();
|
||||
fake_clock.AdvanceTimeMilliseconds(100);
|
||||
module2->Process();
|
||||
|
||||
uint32_t receivedNTPsecs = 0;
|
||||
uint32_t receivedNTPfrac = 0;
|
||||
uint32_t RTCPArrivalTimeSecs = 0;
|
||||
uint32_t RTCPArrivalTimeFrac = 0;
|
||||
EXPECT_EQ(0, module2->RemoteNTP(&receivedNTPsecs,
|
||||
&receivedNTPfrac,
|
||||
&RTCPArrivalTimeSecs,
|
||||
&RTCPArrivalTimeFrac,
|
||||
NULL));
|
||||
|
||||
|
||||
// get all report blocks
|
||||
std::vector<RTCPReportBlock> report_blocks;
|
||||
EXPECT_EQ(0, module1->RemoteRTCPStat(&report_blocks));
|
||||
ASSERT_EQ(1u, report_blocks.size());
|
||||
const RTCPReportBlock& reportBlockReceived = report_blocks[0];
|
||||
|
||||
float secSinceLastReport =
|
||||
static_cast<float>(reportBlockReceived.delaySinceLastSR) / 65536.0f;
|
||||
EXPECT_GE(0.101f, secSinceLastReport);
|
||||
EXPECT_LE(0.100f, secSinceLastReport);
|
||||
EXPECT_EQ(test_sequence_number, reportBlockReceived.extendedHighSeqNum);
|
||||
EXPECT_EQ(0, reportBlockReceived.fractionLost);
|
||||
|
||||
EXPECT_EQ(static_cast<uint32_t>(0),
|
||||
reportBlockReceived.cumulativeLost);
|
||||
|
||||
StreamStatistician *statistician =
|
||||
receive_statistics2_->GetStatistician(reportBlockReceived.sourceSSRC);
|
||||
RtcpStatistics stats;
|
||||
EXPECT_TRUE(statistician->GetStatistics(&stats, true));
|
||||
EXPECT_EQ(0, stats.fraction_lost);
|
||||
EXPECT_EQ((uint32_t)0, stats.cumulative_lost);
|
||||
EXPECT_EQ(test_sequence_number, stats.extended_max_sequence_number);
|
||||
EXPECT_EQ(reportBlockReceived.jitter, stats.jitter);
|
||||
|
||||
int64_t RTT;
|
||||
int64_t avgRTT;
|
||||
int64_t minRTT;
|
||||
int64_t maxRTT;
|
||||
|
||||
// Get RoundTripTime.
|
||||
EXPECT_EQ(0, module1->RTT(test_ssrc + 1, &RTT, &avgRTT, &minRTT, &maxRTT));
|
||||
EXPECT_GE(10, RTT);
|
||||
EXPECT_GE(10, avgRTT);
|
||||
EXPECT_GE(10, minRTT);
|
||||
EXPECT_GE(10, maxRTT);
|
||||
|
||||
// Set report blocks.
|
||||
EXPECT_EQ(0, module1->AddRTCPReportBlock(test_csrcs[0], &reportBlock));
|
||||
|
||||
// Test receive report.
|
||||
EXPECT_EQ(0, module1->SetSendingStatus(false));
|
||||
|
||||
// Send RTCP packet, triggered by timer.
|
||||
fake_clock.AdvanceTimeMilliseconds(5000);
|
||||
module1->Process();
|
||||
module2->Process();
|
||||
}
|
||||
|
||||
TEST_F(RtpRtcpRtcpTest, RemoteRTCPStatRemote) {
|
||||
std::vector<RTCPReportBlock> report_blocks;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user