Remove dependency from ReportBlockData on legacy RTCPReportBlock

Bug: None
Change-Id: I33a2e7aedf0d7825bc046f576a6594ed893e5554
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/304287
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Reviewed-by: Emil Lundmark <lndmrk@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#40008}
This commit is contained in:
Danil Chapovalov 2023-05-05 16:15:05 +02:00 committed by WebRTC LUCI CQ
parent 0df40d1d14
commit 2eb9dfbedc
4 changed files with 38 additions and 65 deletions

View File

@ -24,17 +24,12 @@ TimeDelta ReportBlockData::jitter(int rtp_clock_rate_hz) const {
void ReportBlockData::SetReportBlock(uint32_t sender_ssrc,
const rtcp::ReportBlock& report_block,
Timestamp report_block_timestamp_utc) {
report_block_.sender_ssrc = sender_ssrc;
report_block_.source_ssrc = report_block.source_ssrc();
report_block_.fraction_lost = report_block.fraction_lost();
report_block_.packets_lost = report_block.cumulative_lost();
report_block_.extended_highest_sequence_number =
report_block.extended_high_seq_num();
report_block_.jitter = report_block.jitter();
report_block_.delay_since_last_sender_report =
report_block.delay_since_last_sr();
report_block_.last_sender_report_timestamp = report_block.last_sr();
sender_ssrc_ = sender_ssrc;
source_ssrc_ = report_block.source_ssrc();
fraction_lost_raw_ = report_block.fraction_lost();
cumulative_lost_ = report_block.cumulative_lost();
extended_highest_sequence_number_ = report_block.extended_high_seq_num();
jitter_ = report_block.jitter();
report_block_timestamp_utc_ = report_block_timestamp_utc;
}

View File

@ -13,7 +13,6 @@
#include "api/units/time_delta.h"
#include "api/units/timestamp.h"
#include "modules/rtp_rtcp/include/rtp_rtcp_defines.h"
#include "modules/rtp_rtcp/source/rtcp_packet/report_block.h"
namespace webrtc {
@ -30,11 +29,11 @@ class ReportBlockData {
// The SSRC identifier for the originator of this report block,
// i.e. remote receiver of the RTP stream.
uint32_t sender_ssrc() const { return report_block_.sender_ssrc; }
uint32_t sender_ssrc() const { return sender_ssrc_; }
// The SSRC identifier of the source to which the information in this
// reception report block pertains, i.e. local sender of the RTP stream.
uint32_t source_ssrc() const { return report_block_.source_ssrc; }
uint32_t source_ssrc() const { return source_ssrc_; }
// The fraction of RTP data packets from 'source_ssrc()' lost since the
// previous report block was sent.
@ -43,7 +42,7 @@ class ReportBlockData {
// Fraction loss as was written in the raw packet: range is [0, 255] where 0
// represents no loss, and 255 represents 99.6% loss (255/256 * 100%).
uint8_t fraction_lost_raw() const { return report_block_.fraction_lost; }
uint8_t fraction_lost_raw() const { return fraction_lost_raw_; }
// The total number of RTP data packets from 'source_ssrc()' that have been
// lost since the beginning of reception. This number is defined to be the
@ -51,13 +50,13 @@ class ReportBlockData {
// where the number of packets received includes any which are late or
// duplicates. Thus, packets that arrive late are not counted as lost, and the
// loss may be negative if there are duplicates.
int cumulative_lost() const { return report_block_.packets_lost; }
int cumulative_lost() const { return cumulative_lost_; }
// The low 16 bits contain the highest sequence number received in an RTP data
// packet from 'source_ssrc()', and the most significant 16 bits extend that
// sequence number with the corresponding count of sequence number cycles.
uint32_t extended_highest_sequence_number() const {
return report_block_.extended_highest_sequence_number;
return extended_highest_sequence_number_;
}
// An estimate of the statistical variance of the RTP data packet interarrival
@ -65,15 +64,11 @@ class ReportBlockData {
// to be the mean deviation (smoothed absolute value) of the difference D in
// packet spacing at the receiver compared to the sender for a pair of
// packets.
uint32_t jitter() const { return report_block_.jitter; }
uint32_t jitter() const { return jitter_; }
// Jitter converted to common time units.
TimeDelta jitter(int rtp_clock_rate_hz) const;
// TODO(danilchap): Deprecate in favor of using ReportBlockData accessors
// directly.
const RTCPReportBlock& report_block() const { return report_block_; }
[[deprecated]] int64_t report_block_timestamp_utc_us() const {
return report_block_timestamp_utc_.us();
}
@ -96,12 +91,10 @@ class ReportBlockData {
size_t num_rtts() const { return num_rtts_; }
bool has_rtt() const { return num_rtts_ != 0; }
void set_source_ssrc(uint32_t ssrc) { report_block_.source_ssrc = ssrc; }
void set_fraction_lost_raw(uint8_t lost) {
report_block_.fraction_lost = lost;
}
void set_cumulative_lost(int lost) { report_block_.packets_lost = lost; }
void set_jitter(uint32_t jitter) { report_block_.jitter = jitter; }
void set_source_ssrc(uint32_t ssrc) { source_ssrc_ = ssrc; }
void set_fraction_lost_raw(uint8_t lost) { fraction_lost_raw_ = lost; }
void set_cumulative_lost(int lost) { cumulative_lost_ = lost; }
void set_jitter(uint32_t jitter) { jitter_ = jitter; }
void SetReportBlock(uint32_t sender_ssrc,
const rtcp::ReportBlock& report_block,
@ -109,7 +102,12 @@ class ReportBlockData {
void AddRoundTripTimeSample(TimeDelta rtt);
private:
RTCPReportBlock report_block_;
uint32_t sender_ssrc_ = 0;
uint32_t source_ssrc_ = 0;
uint8_t fraction_lost_raw_ = 0;
int32_t cumulative_lost_ = 0;
uint32_t extended_highest_sequence_number_ = 0;
uint32_t jitter_ = 0;
Timestamp report_block_timestamp_utc_ = Timestamp::Zero();
TimeDelta last_rtt_ = TimeDelta::Zero();
TimeDelta min_rtt_ = TimeDelta::Zero();

View File

@ -123,42 +123,15 @@ enum RtxMode {
const size_t kRtxHeaderSize = 2;
struct RTCPReportBlock {
RTCPReportBlock()
: sender_ssrc(0),
source_ssrc(0),
fraction_lost(0),
packets_lost(0),
extended_highest_sequence_number(0),
jitter(0),
last_sender_report_timestamp(0),
delay_since_last_sender_report(0) {}
RTCPReportBlock(uint32_t sender_ssrc,
uint32_t source_ssrc,
uint8_t fraction_lost,
int32_t packets_lost,
uint32_t extended_highest_sequence_number,
uint32_t jitter,
uint32_t last_sender_report_timestamp,
uint32_t delay_since_last_sender_report)
: sender_ssrc(sender_ssrc),
source_ssrc(source_ssrc),
fraction_lost(fraction_lost),
packets_lost(packets_lost),
extended_highest_sequence_number(extended_highest_sequence_number),
jitter(jitter),
last_sender_report_timestamp(last_sender_report_timestamp),
delay_since_last_sender_report(delay_since_last_sender_report) {}
// Fields as described by RFC 3550 6.4.2.
uint32_t sender_ssrc; // SSRC of sender of this report.
uint32_t source_ssrc; // SSRC of the RTP packet sender.
uint8_t fraction_lost;
int32_t packets_lost; // 24 bits valid.
uint32_t extended_highest_sequence_number;
uint32_t jitter;
uint32_t last_sender_report_timestamp;
uint32_t delay_since_last_sender_report;
uint32_t sender_ssrc = 0; // SSRC of sender of this report.
uint32_t source_ssrc = 0; // SSRC of the RTP packet sender.
uint8_t fraction_lost = 0;
int32_t packets_lost = 0; // 24 bits valid.
uint32_t extended_highest_sequence_number = 0;
uint32_t jitter = 0;
uint32_t last_sender_report_timestamp = 0;
uint32_t delay_since_last_sender_report = 0;
};
typedef std::list<RTCPReportBlock> ReportBlockList;

View File

@ -647,7 +647,14 @@ void RTCPReceiver::HandleReportBlock(const ReportBlock& report_block,
}
packet_information->report_blocks.push_back(
report_block_data->report_block());
{.sender_ssrc = remote_ssrc,
.source_ssrc = report_block.source_ssrc(),
.fraction_lost = report_block.fraction_lost(),
.packets_lost = report_block.cumulative_lost(),
.extended_highest_sequence_number = report_block.extended_high_seq_num(),
.jitter = report_block.jitter(),
.last_sender_report_timestamp = report_block.last_sr(),
.delay_since_last_sender_report = report_block.delay_since_last_sr()});
packet_information->report_block_datas.push_back(*report_block_data);
}