Implement RTCOutboundRtpStreamStats.retransmitted[Bytes/Packets]Sent.
Spec: https://w3c.github.io/webrtc-stats/#dom-rtcoutboundrtpstreamstats-retransmittedpacketssent
These are already existed in StreamDataCounters. This CL takes care of
the plumbing of these values to the standard stats collector.
TBR=solenberg@webrtc.org
Bug: webrtc:10447
Change-Id: I27d6c3ee3ab627d306303e6ee67e586ddf31cc81
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/132012
Commit-Queue: Henrik Boström <hbos@webrtc.org>
Reviewed-by: Åsa Persson <asapersson@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#27663}
diff --git a/audio/channel_send.cc b/audio/channel_send.cc
index 4e0094e..99e3f90 100644
--- a/audio/channel_send.cc
+++ b/audio/channel_send.cc
@@ -1070,17 +1070,22 @@
CallSendStatistics stats = {0};
stats.rttMs = GetRTT();
- size_t bytesSent(0);
- uint32_t packetsSent(0);
-
- if (_rtpRtcpModule->DataCountersRTP(&bytesSent, &packetsSent) != 0) {
- RTC_DLOG(LS_WARNING)
- << "GetRTPStatistics() failed to retrieve RTP datacounters"
- << " => output will not be complete";
- }
-
- stats.bytesSent = bytesSent;
- stats.packetsSent = packetsSent;
+ StreamDataCounters rtp_stats;
+ StreamDataCounters rtx_stats;
+ _rtpRtcpModule->GetSendStreamDataCounters(&rtp_stats, &rtx_stats);
+ // TODO(https://crbug.com/webrtc/10525): Bytes sent should only include
+ // payload bytes, not header and padding bytes.
+ stats.bytesSent =
+ rtp_stats.transmitted.payload_bytes +
+ rtp_stats.transmitted.padding_bytes + rtp_stats.transmitted.header_bytes +
+ rtx_stats.transmitted.payload_bytes +
+ rtx_stats.transmitted.padding_bytes + rtx_stats.transmitted.header_bytes;
+ // TODO(https://crbug.com/webrtc/10555): RTX retransmissions should show up in
+ // separate outbound-rtp stream objects.
+ stats.retransmitted_bytes_sent = rtp_stats.retransmitted.payload_bytes;
+ stats.packetsSent =
+ rtp_stats.transmitted.packets + rtx_stats.transmitted.packets;
+ stats.retransmitted_packets_sent = rtp_stats.retransmitted.packets;
return stats;
}