Sum byte counts for all reports of type kStatsReportTypeSsrc

Bug: webrtc:11003
Change-Id: I6d4bb13710e23e32da36122379226e1a55031008
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/155364
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Commit-Queue: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#29370}
This commit is contained in:
Niels Möller
2019-10-02 13:27:16 +02:00
committed by Commit Bot
parent 2077542378
commit b96a3118ad

View File

@ -43,18 +43,25 @@ void NetworkQualityMetricsReporter::OnStatsReports(
const std::string& pc_label,
const StatsReports& reports) {
rtc::CritScope cs(&lock_);
PCStats& stats = pc_stats_[pc_label];
int64_t payload_bytes_received = 0;
int64_t payload_bytes_sent = 0;
for (const StatsReport* report : reports) {
const auto* received =
report->FindValue(StatsReport::kStatsValueNameBytesReceived);
if (received) {
stats.payload_bytes_received = received->int64_val();
}
const auto* sent = report->FindValue(StatsReport::kStatsValueNameBytesSent);
if (sent) {
stats.payload_bytes_sent = sent->int64_val();
if (report->type() == StatsReport::kStatsReportTypeSsrc) {
const auto* received =
report->FindValue(StatsReport::kStatsValueNameBytesReceived);
if (received) {
payload_bytes_received += received->int64_val();
}
const auto* sent =
report->FindValue(StatsReport::kStatsValueNameBytesSent);
if (sent) {
payload_bytes_sent += sent->int64_val();
}
}
}
PCStats& stats = pc_stats_[pc_label];
stats.payload_bytes_received = payload_bytes_received;
stats.payload_bytes_sent = payload_bytes_sent;
}
void NetworkQualityMetricsReporter::StopAndReportResults() {