Cleanup usasge of ReportBlockData::report_block accessor in pc/

This reduces dependency on the struct RTCPReportBlock and would allow to
delete it in favor of class ReportBlockData

Bug: None
Change-Id: I93874c4f54cf62af0c16ae26e2231b8fb49f195d
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/304161
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Auto-Submit: Danil Chapovalov <danilchap@webrtc.org>
Commit-Queue: Henrik Boström <hbos@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#39985}
This commit is contained in:
Danil Chapovalov 2023-05-04 10:56:07 +02:00 committed by WebRTC LUCI CQ
parent 36d4155112
commit d5b51674a1
2 changed files with 15 additions and 23 deletions

View File

@ -849,34 +849,31 @@ CreateOutboundRTPStreamStatsFromVideoSenderInfo(
std::unique_ptr<RTCRemoteInboundRtpStreamStats>
ProduceRemoteInboundRtpStreamStatsFromReportBlockData(
const std::string& transport_id,
const ReportBlockData& report_block_data,
const ReportBlockData& report_block,
cricket::MediaType media_type,
const std::map<std::string, RTCOutboundRtpStreamStats*>& outbound_rtps,
const RTCStatsReport& report) {
const auto& report_block = report_block_data.report_block();
// RTCStats' timestamp generally refers to when the metric was sampled, but
// for "remote-[outbound/inbound]-rtp" it refers to the local time when the
// Report Block was received.
auto remote_inbound = std::make_unique<RTCRemoteInboundRtpStreamStats>(
RTCRemoteInboundRtpStreamStatsIdFromSourceSsrc(media_type,
report_block.source_ssrc),
report_block_data.report_block_timestamp_utc());
remote_inbound->ssrc = report_block.source_ssrc;
RTCRemoteInboundRtpStreamStatsIdFromSourceSsrc(
media_type, report_block.source_ssrc()),
report_block.report_block_timestamp_utc());
remote_inbound->ssrc = report_block.source_ssrc();
remote_inbound->kind =
media_type == cricket::MEDIA_TYPE_AUDIO ? "audio" : "video";
remote_inbound->packets_lost = report_block.packets_lost;
remote_inbound->fraction_lost =
static_cast<double>(report_block.fraction_lost) / (1 << 8);
if (report_block_data.num_rtts() > 0) {
remote_inbound->round_trip_time =
report_block_data.last_rtt().seconds<double>();
remote_inbound->packets_lost = report_block.cumulative_lost();
remote_inbound->fraction_lost = report_block.fraction_lost();
if (report_block.num_rtts() > 0) {
remote_inbound->round_trip_time = report_block.last_rtt().seconds<double>();
}
remote_inbound->total_round_trip_time =
report_block_data.sum_rtts().seconds<double>();
remote_inbound->round_trip_time_measurements = report_block_data.num_rtts();
report_block.sum_rtts().seconds<double>();
remote_inbound->round_trip_time_measurements = report_block.num_rtts();
std::string local_id = RTCOutboundRtpStreamStatsIDFromSSRC(
transport_id, media_type, report_block.source_ssrc);
transport_id, media_type, report_block.source_ssrc());
// Look up local stat from `outbound_rtps` where the pointers are non-const.
auto local_id_it = outbound_rtps.find(local_id);
if (local_id_it != outbound_rtps.end()) {
@ -907,11 +904,8 @@ ProduceRemoteInboundRtpStreamStatsFromReportBlockData(
remote_inbound->codec_id = *outbound_rtp.codec_id;
const auto& codec = codec_from_id->cast_to<RTCCodecStats>();
if (codec.clock_rate.is_defined()) {
// The Report Block jitter is expressed in RTP timestamp units
// (https://tools.ietf.org/html/rfc3550#section-6.4.1). To convert this
// to seconds we divide by the codec's clock rate.
remote_inbound->jitter =
static_cast<double>(report_block.jitter) / *codec.clock_rate;
report_block.jitter(*codec.clock_rate).seconds<double>();
}
}
}

View File

@ -3556,8 +3556,7 @@ class RTCStatsCollectorTestWithParamKind
for (const auto& report_block_data : report_block_datas) {
cricket::VoiceSenderInfo sender;
sender.local_stats.push_back(cricket::SsrcSenderInfo());
sender.local_stats[0].ssrc =
report_block_data.report_block().source_ssrc;
sender.local_stats[0].ssrc = report_block_data.source_ssrc();
if (codec.has_value()) {
sender.codec_payload_type = codec->payload_type;
voice_media_info.send_codecs.insert(
@ -3574,8 +3573,7 @@ class RTCStatsCollectorTestWithParamKind
for (const auto& report_block_data : report_block_datas) {
cricket::VideoSenderInfo sender;
sender.local_stats.push_back(cricket::SsrcSenderInfo());
sender.local_stats[0].ssrc =
report_block_data.report_block().source_ssrc;
sender.local_stats[0].ssrc = report_block_data.source_ssrc();
if (codec.has_value()) {
sender.codec_payload_type = codec->payload_type;
video_media_info.send_codecs.insert(