diff options
author | Bjorn A Mellem <mellem@webrtc.org> | 2019-07-30 08:34:03 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2019-08-01 01:08:24 +0000 |
commit | da4f09315f6daa2bc9f66150e4a508bac53cd19d (patch) | |
tree | 9af57b1a0db525f926059f2e1d9096059f26e754 /audio/channel_send.cc | |
parent | fd643a4782c9d70b683b8638e4f71e06e3650680 (diff) | |
download | webrtc-da4f09315f6daa2bc9f66150e4a508bac53cd19d.tar.gz |
Reland "Only include payload in bytes sent/received."
This is a reland of 74a1b4b1321b426392d4c32e4a02361226ad5358
Original change's description:
> Only include payload in bytes sent/received.
>
> According to https://www.w3.org/TR/webrtc-stats/#sentrtpstats-dict* and
> https://tools.ietf.org/html/rfc3550#section-6.4.1, the bytes sent
> statistic should not include headers or padding.
>
> Similarly, according to
> https://www.w3.org/TR/webrtc-stats/#inboundrtpstats-dict*, bytes
> received are calculated the same way as bytes sent (eg. not including
> padding or headers).
>
> This change stops adding padding and headers to these statistics.
>
> Bug: webrtc:8516,webrtc:10525
> Change-Id: I891ad5a11a493cc3212afe93e13f62795bf4031f
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/146180
> Reviewed-by: Stefan Holmer <stefan@webrtc.org>
> Reviewed-by: Erik Språng <sprang@webrtc.org>
> Reviewed-by: Steve Anton <steveanton@webrtc.org>
> Reviewed-by: Henrik Boström <hbos@webrtc.org>
> Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org>
> Reviewed-by: Oskar Sundbom <ossu@webrtc.org>
> Commit-Queue: Bjorn Mellem <mellem@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#28647}
Bug: webrtc:8516, webrtc:10525
Change-Id: Iaa1613e5becdfaa0af0f6b9f00e5b871937a719c
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/147520
Reviewed-by: Steve Anton <steveanton@webrtc.org>
Reviewed-by: Fredrik Solenberg <solenberg@webrtc.org>
Commit-Queue: Bjorn Mellem <mellem@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#28731}
Diffstat (limited to 'audio/channel_send.cc')
-rw-r--r-- | audio/channel_send.cc | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/audio/channel_send.cc b/audio/channel_send.cc index 8ce33a46c1..4df06f3a2e 100644 --- a/audio/channel_send.cc +++ b/audio/channel_send.cc @@ -53,6 +53,11 @@ namespace { constexpr int64_t kMaxRetransmissionWindowMs = 1000; constexpr int64_t kMinRetransmissionWindowMs = 30; +// Field trial which controls whether to report standard-compliant bytes +// sent/received per stream. If enabled, padding and headers are not included +// in bytes sent or received. +constexpr char kUseStandardBytesStats[] = "WebRTC-UseStandardBytesStats"; + MediaTransportEncodedAudioFrame::FrameType MediaTransportFrameTypeForWebrtcFrameType(webrtc::AudioFrameType frame_type) { switch (frame_type) { @@ -266,6 +271,7 @@ class ChannelSend : public ChannelSendInterface, rtc::ThreadChecker construction_thread_; const bool use_twcc_plr_for_ana_; + const bool use_standard_bytes_stats_; bool encoder_queue_is_active_ RTC_GUARDED_BY(encoder_queue_) = false; @@ -654,6 +660,8 @@ ChannelSend::ChannelSend(Clock* clock, new RateLimiter(clock, kMaxRetransmissionWindowMs)), use_twcc_plr_for_ana_( webrtc::field_trial::FindFullName("UseTwccPlrForAna") == "Enabled"), + use_standard_bytes_stats_( + webrtc::field_trial::IsEnabled(kUseStandardBytesStats)), media_transport_config_(media_transport_config), frame_encryptor_(frame_encryptor), crypto_options_(crypto_options), @@ -1078,13 +1086,17 @@ CallSendStatistics ChannelSend::GetRTCPStatistics() const { 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; + if (use_standard_bytes_stats_) { + stats.bytesSent = rtp_stats.transmitted.payload_bytes + + rtx_stats.transmitted.payload_bytes; + } else { + 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; |