Replace legacy RtpRtcp::GetRemoteStat function with GetLatestReportBlockData
Bug: webrtc:10678 Change-Id: I9f7429a8d52c45e075c652c1b8b2948bdab91c02 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/208283 Reviewed-by: Sam Zackrisson <saza@webrtc.org> Commit-Queue: Danil Chapovalov <danilchap@webrtc.org> Cr-Commit-Position: refs/heads/master@{#33450}
This commit is contained in:
committed by
Commit Bot
parent
fd87944042
commit
5eda59c96f
@ -976,11 +976,9 @@ int ChannelReceive::GetRtpTimestampRateHz() const {
|
||||
}
|
||||
|
||||
int64_t ChannelReceive::GetRTT() const {
|
||||
std::vector<RTCPReportBlock> report_blocks;
|
||||
rtp_rtcp_->RemoteRTCPStat(&report_blocks);
|
||||
std::vector<ReportBlockData> report_blocks =
|
||||
rtp_rtcp_->GetLatestReportBlockData();
|
||||
|
||||
// TODO(nisse): Could we check the return value from the ->RTT() call below,
|
||||
// instead of checking if we have any report blocks?
|
||||
if (report_blocks.empty()) {
|
||||
MutexLock lock(&assoc_send_channel_lock_);
|
||||
// Tries to get RTT from an associated channel.
|
||||
@ -990,16 +988,14 @@ int64_t ChannelReceive::GetRTT() const {
|
||||
return associated_send_channel_->GetRTT();
|
||||
}
|
||||
|
||||
int64_t rtt = 0;
|
||||
int64_t avg_rtt = 0;
|
||||
int64_t max_rtt = 0;
|
||||
int64_t min_rtt = 0;
|
||||
// TODO(nisse): This method computes RTT based on sender reports, even though
|
||||
// a receive stream is not supposed to do that.
|
||||
if (rtp_rtcp_->RTT(remote_ssrc_, &rtt, &avg_rtt, &min_rtt, &max_rtt) != 0) {
|
||||
return 0;
|
||||
for (const ReportBlockData& data : report_blocks) {
|
||||
if (data.report_block().sender_ssrc == remote_ssrc_) {
|
||||
return data.last_rtt_ms();
|
||||
}
|
||||
}
|
||||
return rtt;
|
||||
return 0;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
@ -749,25 +749,20 @@ std::vector<ReportBlock> ChannelSend::GetRemoteRTCPReportBlocks() const {
|
||||
// Get the report blocks from the latest received RTCP Sender or Receiver
|
||||
// Report. Each element in the vector contains the sender's SSRC and a
|
||||
// report block according to RFC 3550.
|
||||
std::vector<RTCPReportBlock> rtcp_report_blocks;
|
||||
|
||||
int ret = rtp_rtcp_->RemoteRTCPStat(&rtcp_report_blocks);
|
||||
RTC_DCHECK_EQ(0, ret);
|
||||
|
||||
std::vector<ReportBlock> report_blocks;
|
||||
|
||||
std::vector<RTCPReportBlock>::const_iterator it = rtcp_report_blocks.begin();
|
||||
for (; it != rtcp_report_blocks.end(); ++it) {
|
||||
for (const ReportBlockData& data : rtp_rtcp_->GetLatestReportBlockData()) {
|
||||
ReportBlock report_block;
|
||||
report_block.sender_SSRC = it->sender_ssrc;
|
||||
report_block.source_SSRC = it->source_ssrc;
|
||||
report_block.fraction_lost = it->fraction_lost;
|
||||
report_block.cumulative_num_packets_lost = it->packets_lost;
|
||||
report_block.sender_SSRC = data.report_block().sender_ssrc;
|
||||
report_block.source_SSRC = data.report_block().source_ssrc;
|
||||
report_block.fraction_lost = data.report_block().fraction_lost;
|
||||
report_block.cumulative_num_packets_lost = data.report_block().packets_lost;
|
||||
report_block.extended_highest_sequence_number =
|
||||
it->extended_highest_sequence_number;
|
||||
report_block.interarrival_jitter = it->jitter;
|
||||
report_block.last_SR_timestamp = it->last_sender_report_timestamp;
|
||||
report_block.delay_since_last_SR = it->delay_since_last_sender_report;
|
||||
data.report_block().extended_highest_sequence_number;
|
||||
report_block.interarrival_jitter = data.report_block().jitter;
|
||||
report_block.last_SR_timestamp =
|
||||
data.report_block().last_sender_report_timestamp;
|
||||
report_block.delay_since_last_SR =
|
||||
data.report_block().delay_since_last_sender_report;
|
||||
report_blocks.push_back(report_block);
|
||||
}
|
||||
return report_blocks;
|
||||
@ -868,24 +863,15 @@ RtpRtcpInterface* ChannelSend::GetRtpRtcp() const {
|
||||
}
|
||||
|
||||
int64_t ChannelSend::GetRTT() const {
|
||||
std::vector<RTCPReportBlock> report_blocks;
|
||||
rtp_rtcp_->RemoteRTCPStat(&report_blocks);
|
||||
|
||||
std::vector<ReportBlockData> report_blocks =
|
||||
rtp_rtcp_->GetLatestReportBlockData();
|
||||
if (report_blocks.empty()) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int64_t rtt = 0;
|
||||
int64_t avg_rtt = 0;
|
||||
int64_t max_rtt = 0;
|
||||
int64_t min_rtt = 0;
|
||||
// We don't know in advance the remote ssrc used by the other end's receiver
|
||||
// reports, so use the SSRC of the first report block for calculating the RTT.
|
||||
if (rtp_rtcp_->RTT(report_blocks[0].sender_ssrc, &rtt, &avg_rtt, &min_rtt,
|
||||
&max_rtt) != 0) {
|
||||
return 0;
|
||||
}
|
||||
return rtt;
|
||||
// reports, so use the first report block for the RTT.
|
||||
return report_blocks.front().last_rtt_ms();
|
||||
}
|
||||
|
||||
void ChannelSend::SetFrameEncryptor(
|
||||
|
||||
Reference in New Issue
Block a user