Reland "Fix GetStats bytesSent/Received, wireup headerBytesSent/Received"
This is a reland of fbde32e596f06893d6dda13eb7d29f4c251cf08b
The chromium problem should be fixed with
https://chromium-review.googlesource.com/c/chromium/src/+/1862437
Original change's description:
> Fix GetStats bytesSent/Received, wireup headerBytesSent/Received
>
> Changes the standard GetStats, legacy GetStats unchanged.
>
> Bug: webrtc:10525
> Change-Id: Ie10fe8079f1d8b4cc6bbe513f6a2fc91477b5441
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/156084
> Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
> Reviewed-by: Henrik Boström <hbos@webrtc.org>
> Reviewed-by: Harald Alvestrand <hta@webrtc.org>
> Commit-Queue: Niels Moller <nisse@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#29462}
Tbr: kwiberg@webrtc.org
Bug: webrtc:10525
Change-Id: I3b61f9535aa3f1fca2ed84f068233803d4ec9fe2
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/157045
Reviewed-by: Niels Moller <nisse@webrtc.org>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#29485}
diff --git a/api/stats/rtcstats_objects.h b/api/stats/rtcstats_objects.h
index 5fab85e..f26c574 100644
--- a/api/stats/rtcstats_objects.h
+++ b/api/stats/rtcstats_objects.h
@@ -413,6 +413,7 @@
RTCStatsMember<uint64_t> fec_packets_received;
RTCStatsMember<uint64_t> fec_packets_discarded;
RTCStatsMember<uint64_t> bytes_received;
+ RTCStatsMember<uint64_t> header_bytes_received;
RTCStatsMember<int32_t> packets_lost; // Signed per RFC 3550
RTCStatsMember<double> last_packet_received_timestamp;
// TODO(hbos): Collect and populate this value for both "audio" and "video",
@@ -466,6 +467,7 @@
RTCStatsMember<uint32_t> packets_sent;
RTCStatsMember<uint64_t> retransmitted_packets_sent;
RTCStatsMember<uint64_t> bytes_sent;
+ RTCStatsMember<uint64_t> header_bytes_sent;
RTCStatsMember<uint64_t> retransmitted_bytes_sent;
// TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7066
RTCStatsMember<double> target_bitrate;
diff --git a/audio/audio_receive_stream.cc b/audio/audio_receive_stream.cc
index 14dfd90..517f0de 100644
--- a/audio/audio_receive_stream.cc
+++ b/audio/audio_receive_stream.cc
@@ -188,7 +188,11 @@
return stats;
}
- stats.bytes_rcvd = call_stats.bytesReceived;
+ stats.payload_bytes_rcvd = call_stats.payload_bytes_rcvd;
+ stats.header_and_padding_bytes_rcvd =
+ call_stats.header_and_padding_bytes_rcvd;
+ stats.bytes_rcvd =
+ stats.payload_bytes_rcvd + stats.header_and_padding_bytes_rcvd;
stats.packets_rcvd = call_stats.packetsReceived;
stats.packets_lost = call_stats.cumulativeLost;
stats.capture_start_ntp_time_ms = call_stats.capture_start_ntp_time_ms_;
diff --git a/audio/audio_receive_stream_unittest.cc b/audio/audio_receive_stream_unittest.cc
index a14e8e1..ae6605c 100644
--- a/audio/audio_receive_stream_unittest.cc
+++ b/audio/audio_receive_stream_unittest.cc
@@ -63,7 +63,7 @@
const double kTotalOutputEnergy = 0.25;
const double kTotalOutputDuration = 0.5;
-const CallReceiveStatistics kCallStats = {678, 234, -12, 567, 890, 123};
+const CallReceiveStatistics kCallStats = {678, 234, -12, 567, 78, 890, 123};
const std::pair<int, SdpAudioFormat> kReceiveCodec = {
123,
{"codec_name_recv", 96000, 0}};
@@ -266,7 +266,9 @@
helper.SetupMockForGetStats();
AudioReceiveStream::Stats stats = recv_stream->GetStats();
EXPECT_EQ(kRemoteSsrc, stats.remote_ssrc);
- EXPECT_EQ(static_cast<int64_t>(kCallStats.bytesReceived), stats.bytes_rcvd);
+ EXPECT_EQ(kCallStats.payload_bytes_rcvd, stats.payload_bytes_rcvd);
+ EXPECT_EQ(kCallStats.header_and_padding_bytes_rcvd,
+ stats.header_and_padding_bytes_rcvd);
EXPECT_EQ(static_cast<uint32_t>(kCallStats.packetsReceived),
stats.packets_rcvd);
EXPECT_EQ(kCallStats.cumulativeLost, stats.packets_lost);
diff --git a/audio/audio_send_stream.cc b/audio/audio_send_stream.cc
index dbca457..e86667d 100644
--- a/audio/audio_send_stream.cc
+++ b/audio/audio_send_stream.cc
@@ -440,7 +440,11 @@
stats.target_bitrate_bps = channel_send_->GetBitrate();
webrtc::CallSendStatistics call_stats = channel_send_->GetRTCPStatistics();
- stats.bytes_sent = call_stats.bytesSent;
+ stats.payload_bytes_sent = call_stats.payload_bytes_sent;
+ stats.header_and_padding_bytes_sent =
+ call_stats.header_and_padding_bytes_sent;
+ stats.bytes_sent =
+ stats.payload_bytes_sent + stats.header_and_padding_bytes_sent;
stats.retransmitted_bytes_sent = call_stats.retransmitted_bytes_sent;
stats.packets_sent = call_stats.packetsSent;
stats.retransmitted_packets_sent = call_stats.retransmitted_packets_sent;
diff --git a/audio/audio_send_stream_unittest.cc b/audio/audio_send_stream_unittest.cc
index a49c0ee..ad959f2 100644
--- a/audio/audio_send_stream_unittest.cc
+++ b/audio/audio_send_stream_unittest.cc
@@ -64,7 +64,7 @@
const double kEchoReturnLossEnhancement = 101;
const double kResidualEchoLikelihood = -1.0f;
const double kResidualEchoLikelihoodMax = 23.0f;
-const CallSendStatistics kCallStats = {112, 13456, 17890};
+const CallSendStatistics kCallStats = {112, 12, 13456, 17890};
const ReportBlock kReportBlock = {456, 780, 123, 567, 890, 132, 143, 13354};
const int kTelephoneEventPayloadType = 123;
const int kTelephoneEventPayloadFrequency = 65432;
@@ -414,7 +414,9 @@
helper.SetupMockForGetStats();
AudioSendStream::Stats stats = send_stream->GetStats(true);
EXPECT_EQ(kSsrc, stats.local_ssrc);
- EXPECT_EQ(static_cast<int64_t>(kCallStats.bytesSent), stats.bytes_sent);
+ EXPECT_EQ(kCallStats.payload_bytes_sent, stats.payload_bytes_sent);
+ EXPECT_EQ(kCallStats.header_and_padding_bytes_sent,
+ stats.header_and_padding_bytes_sent);
EXPECT_EQ(kCallStats.packetsSent, stats.packets_sent);
EXPECT_EQ(kReportBlock.cumulative_num_packets_lost, stats.packets_lost);
EXPECT_EQ(Q8ToFloat(kReportBlock.fraction_lost), stats.fraction_lost);
diff --git a/audio/channel_receive.cc b/audio/channel_receive.cc
index 486dcb1..fa1463a 100644
--- a/audio/channel_receive.cc
+++ b/audio/channel_receive.cc
@@ -43,7 +43,6 @@
#include "rtc_base/race_checker.h"
#include "rtc_base/thread_checker.h"
#include "rtc_base/time_utils.h"
-#include "system_wrappers/include/field_trial.h"
#include "system_wrappers/include/metrics.h"
namespace webrtc {
@@ -57,11 +56,6 @@
constexpr int kVoiceEngineMinMinPlayoutDelayMs = 0;
constexpr int kVoiceEngineMaxMinPlayoutDelayMs = 10000;
-// 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";
-
RTPHeader CreateRTPHeaderForMediaTransportFrame(
const MediaTransportEncodedAudioFrame& frame,
uint64_t channel_id) {
@@ -278,8 +272,6 @@
// E2EE Audio Frame Decryption
rtc::scoped_refptr<FrameDecryptorInterface> frame_decryptor_;
webrtc::CryptoOptions crypto_options_;
-
- const bool use_standard_bytes_stats_;
};
void ChannelReceive::OnReceivedPayloadData(
@@ -484,9 +476,7 @@
associated_send_channel_(nullptr),
media_transport_config_(media_transport_config),
frame_decryptor_(frame_decryptor),
- crypto_options_(crypto_options),
- use_standard_bytes_stats_(
- webrtc::field_trial::IsEnabled(kUseStandardBytesStats)) {
+ crypto_options_(crypto_options) {
// TODO(nisse): Use _moduleProcessThreadPtr instead?
module_process_thread_checker_.Detach();
@@ -734,16 +724,17 @@
// --- Data counters
if (statistician) {
- if (use_standard_bytes_stats_) {
- stats.bytesReceived = rtp_stats.packet_counter.payload_bytes;
- } else {
- stats.bytesReceived = rtp_stats.packet_counter.TotalBytes();
- }
+ stats.payload_bytes_rcvd = rtp_stats.packet_counter.payload_bytes;
+
+ stats.header_and_padding_bytes_rcvd =
+ rtp_stats.packet_counter.header_bytes +
+ rtp_stats.packet_counter.padding_bytes;
stats.packetsReceived = rtp_stats.packet_counter.packets;
stats.last_packet_received_timestamp_ms =
rtp_stats.last_packet_received_timestamp_ms;
} else {
- stats.bytesReceived = 0;
+ stats.payload_bytes_rcvd = 0;
+ stats.header_and_padding_bytes_rcvd = 0;
stats.packetsReceived = 0;
stats.last_packet_received_timestamp_ms = absl::nullopt;
}
diff --git a/audio/channel_receive.h b/audio/channel_receive.h
index 7527ef2..5f71ea3 100644
--- a/audio/channel_receive.h
+++ b/audio/channel_receive.h
@@ -54,7 +54,8 @@
unsigned int cumulativeLost;
unsigned int jitterSamples;
int64_t rttMs;
- size_t bytesReceived;
+ int64_t payload_bytes_rcvd = 0;
+ int64_t header_and_padding_bytes_rcvd = 0;
int packetsReceived;
// The capture ntp time (in local timebase) of the first played out audio
// frame.
diff --git a/audio/channel_send.cc b/audio/channel_send.cc
index 2a969ab..f803bf9 100644
--- a/audio/channel_send.cc
+++ b/audio/channel_send.cc
@@ -52,11 +52,6 @@
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) {
@@ -263,7 +258,6 @@
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;
@@ -609,8 +603,6 @@
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),
@@ -1019,17 +1011,12 @@
StreamDataCounters rtp_stats;
StreamDataCounters rtx_stats;
_rtpRtcpModule->GetSendStreamDataCounters(&rtp_stats, &rtx_stats);
- 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;
- }
+ stats.payload_bytes_sent =
+ rtp_stats.transmitted.payload_bytes + rtx_stats.transmitted.payload_bytes;
+ stats.header_and_padding_bytes_sent =
+ rtp_stats.transmitted.padding_bytes + rtp_stats.transmitted.header_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;
diff --git a/audio/channel_send.h b/audio/channel_send.h
index 6f94610..11f8332 100644
--- a/audio/channel_send.h
+++ b/audio/channel_send.h
@@ -36,7 +36,8 @@
struct CallSendStatistics {
int64_t rttMs;
- size_t bytesSent;
+ int64_t payload_bytes_sent;
+ int64_t header_and_padding_bytes_sent;
// https://w3c.github.io/webrtc-stats/#dom-rtcoutboundrtpstreamstats-retransmittedbytessent
uint64_t retransmitted_bytes_sent;
int packetsSent;
diff --git a/audio/test/audio_stats_test.cc b/audio/test/audio_stats_test.cc
index ec55db3..c91183c 100644
--- a/audio/test/audio_stats_test.cc
+++ b/audio/test/audio_stats_test.cc
@@ -46,7 +46,7 @@
void OnStreamsStopped() override {
AudioSendStream::Stats send_stats = send_stream()->GetStats();
- EXPECT_PRED2(IsNear, kBytesSent, send_stats.bytes_sent);
+ EXPECT_PRED2(IsNear, kBytesSent, send_stats.payload_bytes_sent);
EXPECT_PRED2(IsNear, kPacketsSent, send_stats.packets_sent);
EXPECT_EQ(0, send_stats.packets_lost);
EXPECT_EQ(0.0f, send_stats.fraction_lost);
@@ -66,7 +66,7 @@
EXPECT_EQ(false, send_stats.typing_noise_detected);
AudioReceiveStream::Stats recv_stats = receive_stream()->GetStats();
- EXPECT_PRED2(IsNear, kBytesSent, recv_stats.bytes_rcvd);
+ EXPECT_PRED2(IsNear, kBytesSent, recv_stats.payload_bytes_rcvd);
EXPECT_PRED2(IsNear, kPacketsSent, recv_stats.packets_rcvd);
EXPECT_EQ(0u, recv_stats.packets_lost);
EXPECT_EQ("opus", send_stats.codec_name);
diff --git a/call/audio_receive_stream.h b/call/audio_receive_stream.h
index 935aaed..2999c3c 100644
--- a/call/audio_receive_stream.h
+++ b/call/audio_receive_stream.h
@@ -36,7 +36,11 @@
Stats();
~Stats();
uint32_t remote_ssrc = 0;
- int64_t bytes_rcvd = 0;
+ // TODO(nisse): Sum of below two values. Deprecated, delete as soon as
+ // downstream applications are updated.
+ int64_t bytes_rcvd;
+ int64_t payload_bytes_rcvd = 0;
+ int64_t header_and_padding_bytes_rcvd = 0;
uint32_t packets_rcvd = 0;
uint64_t fec_packets_received = 0;
uint64_t fec_packets_discarded = 0;
diff --git a/call/audio_send_stream.h b/call/audio_send_stream.h
index fb711c4..f2dab9a 100644
--- a/call/audio_send_stream.h
+++ b/call/audio_send_stream.h
@@ -43,7 +43,11 @@
// TODO(solenberg): Harmonize naming and defaults with receive stream stats.
uint32_t local_ssrc = 0;
- int64_t bytes_sent = 0;
+ // TODO(nisse): Sum of below two values. Deprecated, delete as soon as
+ // downstream applications are updated.
+ int64_t bytes_sent;
+ int64_t payload_bytes_sent = 0;
+ int64_t header_and_padding_bytes_sent = 0;
// https://w3c.github.io/webrtc-stats/#dom-rtcoutboundrtpstreamstats-retransmittedbytessent
uint64_t retransmitted_bytes_sent = 0;
int32_t packets_sent = 0;
diff --git a/media/base/media_channel.h b/media/base/media_channel.h
index 8f6b04b..c3e8be5 100644
--- a/media/base/media_channel.h
+++ b/media/base/media_channel.h
@@ -393,7 +393,13 @@
return 0;
}
}
- int64_t bytes_sent = 0;
+ // TODO(nisse): Sum of below two values. Deprecated, delete as soon as
+ // downstream applications are updated.
+ int64_t bytes_sent;
+ // https://w3c.github.io/webrtc-stats/#dom-rtcsentrtpstreamstats-bytessent
+ int64_t payload_bytes_sent = 0;
+ // https://w3c.github.io/webrtc-stats/#dom-rtcoutboundrtpstreamstats-headerbytessent
+ int64_t header_and_padding_bytes_sent = 0;
// https://w3c.github.io/webrtc-stats/#dom-rtcoutboundrtpstreamstats-retransmittedbytessent
uint64_t retransmitted_bytes_sent = 0;
int packets_sent = 0;
@@ -447,7 +453,13 @@
}
}
- int64_t bytes_rcvd = 0;
+ // TODO(nisse): Sum of below two values. Deprecated, delete as soon as
+ // downstream applications are updated.
+ int64_t bytes_rcvd;
+ // https://w3c.github.io/webrtc-stats/#dom-rtcinboundrtpstreamstats-bytesreceived
+ int64_t payload_bytes_rcvd = 0;
+ // https://w3c.github.io/webrtc-stats/#dom-rtcinboundrtpstreamstats-headerbytesreceived
+ int64_t header_and_padding_bytes_rcvd = 0;
int packets_rcvd = 0;
int packets_lost = 0;
// TODO(bugs.webrtc.org/10679): Unused, delete as soon as downstream code is
diff --git a/media/engine/webrtc_video_engine.cc b/media/engine/webrtc_video_engine.cc
index 7bce942..74647a8 100644
--- a/media/engine/webrtc_video_engine.cc
+++ b/media/engine/webrtc_video_engine.cc
@@ -48,11 +48,6 @@
const int kMinLayerSize = 16;
-// 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";
-
// If this field trial is enabled, we will enable sending FlexFEC and disable
// sending ULPFEC whenever the former has been negotiated in the SDPs.
bool IsFlexfecFieldTrialEnabled() {
@@ -1808,9 +1803,7 @@
encoder_sink_(nullptr),
parameters_(std::move(config), options, max_bitrate_bps, codec_settings),
rtp_parameters_(CreateRtpParametersWithEncodings(sp)),
- sending_(false),
- use_standard_bytes_stats_(
- webrtc::field_trial::IsEnabled(kUseStandardBytesStats)) {
+ sending_(false) {
// Maximum packet size may come in RtpConfig from external transport, for
// example from QuicTransportInterface implementation, so do not exceed
// given max_packet_size.
@@ -2379,13 +2372,10 @@
it != stats.substreams.end(); ++it) {
// TODO(pbos): Wire up additional stats, such as padding bytes.
webrtc::VideoSendStream::StreamStats stream_stats = it->second;
- if (use_standard_bytes_stats_) {
- info.bytes_sent += stream_stats.rtp_stats.transmitted.payload_bytes;
- } else {
- info.bytes_sent += stream_stats.rtp_stats.transmitted.payload_bytes +
- stream_stats.rtp_stats.transmitted.header_bytes +
- stream_stats.rtp_stats.transmitted.padding_bytes;
- }
+ info.payload_bytes_sent += stream_stats.rtp_stats.transmitted.payload_bytes;
+ info.header_and_padding_bytes_sent +=
+ stream_stats.rtp_stats.transmitted.header_bytes +
+ stream_stats.rtp_stats.transmitted.padding_bytes;
info.packets_sent += stream_stats.rtp_stats.transmitted.packets;
info.total_packet_send_delay_ms += stream_stats.total_packet_send_delay_ms;
// TODO(https://crbug.com/webrtc/10555): RTX retransmissions should show up
@@ -2409,6 +2399,8 @@
info.report_block_datas.push_back(stream_stats.report_block_data.value());
}
}
+ info.bytes_sent =
+ info.payload_bytes_sent + info.header_and_padding_bytes_sent;
if (!stats.substreams.empty()) {
// TODO(pbos): Report fraction lost per SSRC.
@@ -2501,9 +2493,7 @@
decoder_factory_(decoder_factory),
sink_(NULL),
first_frame_timestamp_(-1),
- estimated_remote_start_ntp_time_ms_(0),
- use_standard_bytes_stats_(
- webrtc::field_trial::IsEnabled(kUseStandardBytesStats)) {
+ estimated_remote_start_ntp_time_ms_(0) {
config_.renderer = this;
ConfigureCodecs(recv_codecs);
ConfigureFlexfecCodec(flexfec_config.payload_type);
@@ -2799,11 +2789,12 @@
if (stats.current_payload_type != -1) {
info.codec_payload_type = stats.current_payload_type;
}
- if (use_standard_bytes_stats_) {
- info.bytes_rcvd = stats.rtp_stats.packet_counter.payload_bytes;
- } else {
- info.bytes_rcvd = stats.rtp_stats.packet_counter.TotalBytes();
- }
+ info.payload_bytes_rcvd = stats.rtp_stats.packet_counter.payload_bytes;
+ info.header_and_padding_bytes_rcvd =
+ stats.rtp_stats.packet_counter.header_bytes +
+ stats.rtp_stats.packet_counter.padding_bytes;
+ info.bytes_rcvd =
+ info.payload_bytes_rcvd + info.header_and_padding_bytes_rcvd;
info.packets_rcvd = stats.rtp_stats.packet_counter.packets;
info.packets_lost = stats.rtp_stats.packets_lost;
diff --git a/media/engine/webrtc_video_engine.h b/media/engine/webrtc_video_engine.h
index 6e48304..5e5ab6e 100644
--- a/media/engine/webrtc_video_engine.h
+++ b/media/engine/webrtc_video_engine.h
@@ -380,8 +380,6 @@
bool sending_ RTC_GUARDED_BY(&thread_checker_);
- const bool use_standard_bytes_stats_;
-
// In order for the |invoker_| to protect other members from being
// destructed as they are used in asynchronous tasks it has to be destructed
// first.
@@ -471,8 +469,6 @@
// Start NTP time is estimated as current remote NTP time (estimated from
// RTCP) minus the elapsed time, as soon as remote NTP time is available.
int64_t estimated_remote_start_ntp_time_ms_ RTC_GUARDED_BY(sink_lock_);
-
- const bool use_standard_bytes_stats_;
};
void Construct(webrtc::Call* call, WebRtcVideoEngine* engine);
diff --git a/media/engine/webrtc_video_engine_unittest.cc b/media/engine/webrtc_video_engine_unittest.cc
index b4a0a61..62bbf24 100644
--- a/media/engine/webrtc_video_engine_unittest.cc
+++ b/media/engine/webrtc_video_engine_unittest.cc
@@ -1599,8 +1599,6 @@
// Test that stats work properly for a 1-1 call.
TEST_F(WebRtcVideoChannelBaseTest, GetStats) {
- webrtc::test::ScopedFieldTrials field_trials(
- "WebRTC-UseStandardBytesStats/Enabled/");
SetUp();
const int kDurationSec = 3;
@@ -1613,7 +1611,7 @@
ASSERT_EQ(1U, info.senders.size());
// TODO(whyuan): bytes_sent and bytes_rcvd are different. Are both payload?
// For webrtc, bytes_sent does not include the RTP header length.
- EXPECT_EQ(info.senders[0].bytes_sent,
+ EXPECT_EQ(info.senders[0].payload_bytes_sent,
NumRtpBytes() - kRtpHeaderSize * NumRtpPackets());
EXPECT_EQ(NumRtpPackets(), info.senders[0].packets_sent);
EXPECT_EQ(0.0, info.senders[0].fraction_lost);
@@ -1638,7 +1636,7 @@
ASSERT_TRUE(info.receivers[0].codec_payload_type);
EXPECT_EQ(DefaultCodec().id, *info.receivers[0].codec_payload_type);
EXPECT_EQ(NumRtpBytes() - kRtpHeaderSize * NumRtpPackets(),
- info.receivers[0].bytes_rcvd);
+ info.receivers[0].payload_bytes_rcvd);
EXPECT_EQ(NumRtpPackets(), info.receivers[0].packets_rcvd);
EXPECT_EQ(0, info.receivers[0].packets_lost);
// TODO(asapersson): Not set for webrtc. Handle missing stats.
@@ -1659,8 +1657,6 @@
// Test that stats work properly for a conf call with multiple recv streams.
TEST_F(WebRtcVideoChannelBaseTest, GetStatsMultipleRecvStreams) {
- webrtc::test::ScopedFieldTrials field_trials(
- "WebRTC-UseStandardBytesStats/Enabled/");
SetUp();
cricket::FakeVideoRenderer renderer1, renderer2;
@@ -1694,7 +1690,7 @@
// TODO(whyuan): bytes_sent and bytes_rcvd are different. Are both payload?
// For webrtc, bytes_sent does not include the RTP header length.
EXPECT_EQ_WAIT(NumRtpBytes() - kRtpHeaderSize * NumRtpPackets(),
- GetSenderStats(0).bytes_sent, kTimeout);
+ GetSenderStats(0).payload_bytes_sent, kTimeout);
EXPECT_EQ_WAIT(NumRtpPackets(), GetSenderStats(0).packets_sent, kTimeout);
EXPECT_EQ(kVideoWidth, GetSenderStats(0).send_frame_width);
EXPECT_EQ(kVideoHeight, GetSenderStats(0).send_frame_height);
@@ -1704,7 +1700,7 @@
EXPECT_EQ(1U, GetReceiverStats(i).ssrcs().size());
EXPECT_EQ(i + 1, GetReceiverStats(i).ssrcs()[0]);
EXPECT_EQ_WAIT(NumRtpBytes() - kRtpHeaderSize * NumRtpPackets(),
- GetReceiverStats(i).bytes_rcvd, kTimeout);
+ GetReceiverStats(i).payload_bytes_rcvd, kTimeout);
EXPECT_EQ_WAIT(NumRtpPackets(), GetReceiverStats(i).packets_rcvd, kTimeout);
EXPECT_EQ_WAIT(kVideoWidth, GetReceiverStats(i).frame_width, kTimeout);
EXPECT_EQ_WAIT(kVideoHeight, GetReceiverStats(i).frame_height, kTimeout);
@@ -5282,9 +5278,6 @@
}
TEST_F(WebRtcVideoChannelTest, GetStatsTranslatesReceivePacketStatsCorrectly) {
- webrtc::test::ScopedFieldTrials field_trials(
- "WebRTC-UseStandardBytesStats/Enabled/");
-
FakeVideoReceiveStream* stream = AddRecvStream();
webrtc::VideoReceiveStream::Stats stats;
stats.rtp_stats.packet_counter.payload_bytes = 2;
@@ -5297,7 +5290,7 @@
cricket::VideoMediaInfo info;
ASSERT_TRUE(channel_->GetStats(&info));
EXPECT_EQ(stats.rtp_stats.packet_counter.payload_bytes,
- rtc::checked_cast<size_t>(info.receivers[0].bytes_rcvd));
+ rtc::checked_cast<size_t>(info.receivers[0].payload_bytes_rcvd));
EXPECT_EQ(stats.rtp_stats.packet_counter.packets,
rtc::checked_cast<unsigned int>(info.receivers[0].packets_rcvd));
EXPECT_EQ(stats.rtp_stats.packets_lost, info.receivers[0].packets_lost);
diff --git a/media/engine/webrtc_voice_engine.cc b/media/engine/webrtc_voice_engine.cc
index bef9d23..a3b27a5 100644
--- a/media/engine/webrtc_voice_engine.cc
+++ b/media/engine/webrtc_voice_engine.cc
@@ -2158,7 +2158,10 @@
stream.second->GetStats(recv_streams_.size() > 0);
VoiceSenderInfo sinfo;
sinfo.add_ssrc(stats.local_ssrc);
- sinfo.bytes_sent = stats.bytes_sent;
+ sinfo.payload_bytes_sent = stats.payload_bytes_sent;
+ sinfo.header_and_padding_bytes_sent = stats.header_and_padding_bytes_sent;
+ sinfo.bytes_sent =
+ sinfo.payload_bytes_sent + sinfo.header_and_padding_bytes_sent;
sinfo.retransmitted_bytes_sent = stats.retransmitted_bytes_sent;
sinfo.packets_sent = stats.packets_sent;
sinfo.retransmitted_packets_sent = stats.retransmitted_packets_sent;
@@ -2201,7 +2204,10 @@
webrtc::AudioReceiveStream::Stats stats = stream.second->GetStats();
VoiceReceiverInfo rinfo;
rinfo.add_ssrc(stats.remote_ssrc);
- rinfo.bytes_rcvd = stats.bytes_rcvd;
+ rinfo.payload_bytes_rcvd = stats.payload_bytes_rcvd;
+ rinfo.header_and_padding_bytes_rcvd = stats.header_and_padding_bytes_rcvd;
+ rinfo.bytes_rcvd =
+ rinfo.payload_bytes_rcvd + rinfo.header_and_padding_bytes_rcvd;
rinfo.packets_rcvd = stats.packets_rcvd;
rinfo.fec_packets_received = stats.fec_packets_received;
rinfo.fec_packets_discarded = stats.fec_packets_discarded;
diff --git a/media/engine/webrtc_voice_engine_unittest.cc b/media/engine/webrtc_voice_engine_unittest.cc
index 8fac2a1..711cbbb 100644
--- a/media/engine/webrtc_voice_engine_unittest.cc
+++ b/media/engine/webrtc_voice_engine_unittest.cc
@@ -566,7 +566,8 @@
webrtc::AudioSendStream::Stats GetAudioSendStreamStats() const {
webrtc::AudioSendStream::Stats stats;
stats.local_ssrc = 12;
- stats.bytes_sent = 345;
+ stats.payload_bytes_sent = 345;
+ stats.header_and_padding_bytes_sent = 56;
stats.packets_sent = 678;
stats.packets_lost = 9012;
stats.fraction_lost = 34.56f;
@@ -600,7 +601,9 @@
bool is_sending) {
const auto stats = GetAudioSendStreamStats();
EXPECT_EQ(info.ssrc(), stats.local_ssrc);
- EXPECT_EQ(info.bytes_sent, stats.bytes_sent);
+ EXPECT_EQ(info.payload_bytes_sent, stats.payload_bytes_sent);
+ EXPECT_EQ(info.header_and_padding_bytes_sent,
+ stats.header_and_padding_bytes_sent);
EXPECT_EQ(info.packets_sent, stats.packets_sent);
EXPECT_EQ(info.packets_lost, stats.packets_lost);
EXPECT_EQ(info.fraction_lost, stats.fraction_lost);
@@ -642,7 +645,8 @@
webrtc::AudioReceiveStream::Stats GetAudioReceiveStreamStats() const {
webrtc::AudioReceiveStream::Stats stats;
stats.remote_ssrc = 123;
- stats.bytes_rcvd = 456;
+ stats.payload_bytes_rcvd = 456;
+ stats.header_and_padding_bytes_rcvd = 67;
stats.packets_rcvd = 768;
stats.packets_lost = 101;
stats.codec_name = "codec_name_recv";
@@ -682,7 +686,9 @@
void VerifyVoiceReceiverInfo(const cricket::VoiceReceiverInfo& info) {
const auto stats = GetAudioReceiveStreamStats();
EXPECT_EQ(info.ssrc(), stats.remote_ssrc);
- EXPECT_EQ(info.bytes_rcvd, stats.bytes_rcvd);
+ EXPECT_EQ(info.payload_bytes_rcvd, stats.payload_bytes_rcvd);
+ EXPECT_EQ(info.header_and_padding_bytes_rcvd,
+ stats.header_and_padding_bytes_rcvd);
EXPECT_EQ(rtc::checked_cast<unsigned int>(info.packets_rcvd),
stats.packets_rcvd);
EXPECT_EQ(rtc::checked_cast<unsigned int>(info.packets_lost),
diff --git a/pc/rtc_stats_collector.cc b/pc/rtc_stats_collector.cc
index 50c49a7..9d6cf77 100644
--- a/pc/rtc_stats_collector.cc
+++ b/pc/rtc_stats_collector.cc
@@ -256,7 +256,9 @@
inbound_stats->packets_received =
static_cast<uint32_t>(media_receiver_info.packets_rcvd);
inbound_stats->bytes_received =
- static_cast<uint64_t>(media_receiver_info.bytes_rcvd);
+ static_cast<uint64_t>(media_receiver_info.payload_bytes_rcvd);
+ inbound_stats->header_bytes_received =
+ static_cast<uint64_t>(media_receiver_info.header_and_padding_bytes_rcvd);
inbound_stats->packets_lost =
static_cast<int32_t>(media_receiver_info.packets_lost);
}
@@ -343,7 +345,9 @@
outbound_stats->retransmitted_packets_sent =
media_sender_info.retransmitted_packets_sent;
outbound_stats->bytes_sent =
- static_cast<uint64_t>(media_sender_info.bytes_sent);
+ static_cast<uint64_t>(media_sender_info.payload_bytes_sent);
+ outbound_stats->header_bytes_sent =
+ static_cast<uint64_t>(media_sender_info.header_and_padding_bytes_sent);
outbound_stats->retransmitted_bytes_sent =
media_sender_info.retransmitted_bytes_sent;
}
diff --git a/pc/rtc_stats_collector_unittest.cc b/pc/rtc_stats_collector_unittest.cc
index 1420fcc..86f8ba9 100644
--- a/pc/rtc_stats_collector_unittest.cc
+++ b/pc/rtc_stats_collector_unittest.cc
@@ -1739,7 +1739,8 @@
voice_media_info.receivers[0].packets_rcvd = 2;
voice_media_info.receivers[0].fec_packets_discarded = 5566;
voice_media_info.receivers[0].fec_packets_received = 6677;
- voice_media_info.receivers[0].bytes_rcvd = 3;
+ voice_media_info.receivers[0].payload_bytes_rcvd = 3;
+ voice_media_info.receivers[0].header_and_padding_bytes_rcvd = 4;
voice_media_info.receivers[0].codec_payload_type = 42;
voice_media_info.receivers[0].jitter_ms = 4500;
voice_media_info.receivers[0].last_packet_received_timestamp_ms =
@@ -1776,6 +1777,7 @@
expected_audio.fec_packets_discarded = 5566;
expected_audio.fec_packets_received = 6677;
expected_audio.bytes_received = 3;
+ expected_audio.header_bytes_received = 4;
expected_audio.packets_lost = -1;
// |expected_audio.last_packet_received_timestamp| should be undefined.
expected_audio.jitter = 4.5;
@@ -1809,7 +1811,8 @@
video_media_info.receivers[0].local_stats[0].ssrc = 1;
video_media_info.receivers[0].packets_rcvd = 2;
video_media_info.receivers[0].packets_lost = 42;
- video_media_info.receivers[0].bytes_rcvd = 3;
+ video_media_info.receivers[0].payload_bytes_rcvd = 3;
+ video_media_info.receivers[0].header_and_padding_bytes_rcvd = 12;
video_media_info.receivers[0].codec_payload_type = 42;
video_media_info.receivers[0].firs_sent = 5;
video_media_info.receivers[0].plis_sent = 6;
@@ -1852,6 +1855,7 @@
expected_video.nack_count = 7;
expected_video.packets_received = 2;
expected_video.bytes_received = 3;
+ expected_video.header_bytes_received = 12;
expected_video.packets_lost = 42;
expected_video.frames_decoded = 8;
expected_video.key_frames_decoded = 3;
@@ -1896,7 +1900,8 @@
voice_media_info.senders[0].local_stats[0].ssrc = 1;
voice_media_info.senders[0].packets_sent = 2;
voice_media_info.senders[0].retransmitted_packets_sent = 20;
- voice_media_info.senders[0].bytes_sent = 3;
+ voice_media_info.senders[0].payload_bytes_sent = 3;
+ voice_media_info.senders[0].header_and_padding_bytes_sent = 12;
voice_media_info.senders[0].retransmitted_bytes_sent = 30;
voice_media_info.senders[0].codec_payload_type = 42;
@@ -1929,6 +1934,7 @@
expected_audio.packets_sent = 2;
expected_audio.retransmitted_packets_sent = 20;
expected_audio.bytes_sent = 3;
+ expected_audio.header_bytes_sent = 12;
expected_audio.retransmitted_bytes_sent = 30;
ASSERT_TRUE(report->Get(expected_audio.id()));
@@ -1956,7 +1962,8 @@
video_media_info.senders[0].nacks_rcvd = 4;
video_media_info.senders[0].packets_sent = 5;
video_media_info.senders[0].retransmitted_packets_sent = 50;
- video_media_info.senders[0].bytes_sent = 6;
+ video_media_info.senders[0].payload_bytes_sent = 6;
+ video_media_info.senders[0].header_and_padding_bytes_sent = 12;
video_media_info.senders[0].retransmitted_bytes_sent = 60;
video_media_info.senders[0].codec_payload_type = 42;
video_media_info.senders[0].frames_encoded = 8;
@@ -2008,6 +2015,7 @@
expected_video.packets_sent = 5;
expected_video.retransmitted_packets_sent = 50;
expected_video.bytes_sent = 6;
+ expected_video.header_bytes_sent = 12;
expected_video.retransmitted_bytes_sent = 60;
expected_video.frames_encoded = 8;
expected_video.key_frames_encoded = 3;
@@ -2196,7 +2204,8 @@
voice_media_info.senders[0].local_stats[0].ssrc = 1;
voice_media_info.senders[0].packets_sent = 2;
voice_media_info.senders[0].retransmitted_packets_sent = 20;
- voice_media_info.senders[0].bytes_sent = 3;
+ voice_media_info.senders[0].payload_bytes_sent = 3;
+ voice_media_info.senders[0].header_and_padding_bytes_sent = 4;
voice_media_info.senders[0].retransmitted_bytes_sent = 30;
voice_media_info.senders[0].codec_payload_type = 42;
@@ -2230,6 +2239,7 @@
expected_audio.packets_sent = 2;
expected_audio.retransmitted_packets_sent = 20;
expected_audio.bytes_sent = 3;
+ expected_audio.header_bytes_sent = 4;
expected_audio.retransmitted_bytes_sent = 30;
ASSERT_TRUE(report->Get(expected_audio.id()));
diff --git a/pc/rtc_stats_integrationtest.cc b/pc/rtc_stats_integrationtest.cc
index 7cb3028..0d51af0 100644
--- a/pc/rtc_stats_integrationtest.cc
+++ b/pc/rtc_stats_integrationtest.cc
@@ -797,6 +797,8 @@
inbound_stream.fec_packets_discarded);
}
verifier.TestMemberIsNonNegative<uint64_t>(inbound_stream.bytes_received);
+ verifier.TestMemberIsNonNegative<uint64_t>(
+ inbound_stream.header_bytes_received);
// packets_lost is defined as signed, but this should never happen in
// this test. See RFC 3550.
verifier.TestMemberIsNonNegative<int32_t>(inbound_stream.packets_lost);
@@ -856,6 +858,8 @@
outbound_stream.retransmitted_packets_sent);
verifier.TestMemberIsNonNegative<uint64_t>(outbound_stream.bytes_sent);
verifier.TestMemberIsNonNegative<uint64_t>(
+ outbound_stream.header_bytes_sent);
+ verifier.TestMemberIsNonNegative<uint64_t>(
outbound_stream.retransmitted_bytes_sent);
verifier.TestMemberIsUndefined(outbound_stream.target_bitrate);
if (outbound_stream.media_type.is_defined() &&
diff --git a/pc/stats_collector.cc b/pc/stats_collector.cc
index 1fb2a5b..c5999da 100644
--- a/pc/stats_collector.cc
+++ b/pc/stats_collector.cc
@@ -19,10 +19,16 @@
#include "pc/peer_connection.h"
#include "rtc_base/checks.h"
#include "rtc_base/third_party/base64/base64.h"
+#include "system_wrappers/include/field_trial.h"
namespace webrtc {
namespace {
+// 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";
+
// The following is the enum RTCStatsIceCandidateType from
// http://w3c.github.io/webrtc-stats/#rtcstatsicecandidatetype-enum such that
// our stats report for ice candidate type could conform to that.
@@ -82,9 +88,14 @@
}
void ExtractCommonSendProperties(const cricket::MediaSenderInfo& info,
- StatsReport* report) {
+ StatsReport* report,
+ bool use_standard_bytes_stats) {
report->AddString(StatsReport::kStatsValueNameCodecName, info.codec_name);
- report->AddInt64(StatsReport::kStatsValueNameBytesSent, info.bytes_sent);
+ int64_t bytes_sent = info.payload_bytes_sent;
+ if (!use_standard_bytes_stats) {
+ bytes_sent += info.header_and_padding_bytes_sent;
+ }
+ report->AddInt64(StatsReport::kStatsValueNameBytesSent, bytes_sent);
if (info.rtt_ms >= 0) {
report->AddInt64(StatsReport::kStatsValueNameRtt, info.rtt_ms);
}
@@ -131,7 +142,9 @@
}
}
-void ExtractStats(const cricket::VoiceReceiverInfo& info, StatsReport* report) {
+void ExtractStats(const cricket::VoiceReceiverInfo& info,
+ StatsReport* report,
+ bool use_standard_bytes_stats) {
ExtractCommonReceiveProperties(info, report);
const FloatForAdd floats[] = {
{StatsReport::kStatsValueNameExpandRate, info.expand_rate},
@@ -179,7 +192,11 @@
report->AddInt(StatsReport::kStatsValueNameDecodingCodecPLC,
info.decoding_codec_plc);
- report->AddInt64(StatsReport::kStatsValueNameBytesReceived, info.bytes_rcvd);
+ int64_t bytes_rcvd = info.payload_bytes_rcvd;
+ if (!use_standard_bytes_stats) {
+ bytes_rcvd += info.header_and_padding_bytes_rcvd;
+ }
+ report->AddInt64(StatsReport::kStatsValueNameBytesReceived, bytes_rcvd);
if (info.capture_start_ntp_time_ms >= 0) {
report->AddInt64(StatsReport::kStatsValueNameCaptureStartNtpTimeMs,
info.capture_start_ntp_time_ms);
@@ -187,8 +204,10 @@
report->AddString(StatsReport::kStatsValueNameMediaType, "audio");
}
-void ExtractStats(const cricket::VoiceSenderInfo& info, StatsReport* report) {
- ExtractCommonSendProperties(info, report);
+void ExtractStats(const cricket::VoiceSenderInfo& info,
+ StatsReport* report,
+ bool use_standard_bytes_stats) {
+ ExtractCommonSendProperties(info, report, use_standard_bytes_stats);
SetAudioProcessingStats(report, info.typing_noise_detected,
info.apm_statistics);
@@ -246,11 +265,17 @@
}
}
-void ExtractStats(const cricket::VideoReceiverInfo& info, StatsReport* report) {
+void ExtractStats(const cricket::VideoReceiverInfo& info,
+ StatsReport* report,
+ bool use_standard_bytes_stats) {
ExtractCommonReceiveProperties(info, report);
report->AddString(StatsReport::kStatsValueNameCodecImplementationName,
info.decoder_implementation_name);
- report->AddInt64(StatsReport::kStatsValueNameBytesReceived, info.bytes_rcvd);
+ int64_t bytes_rcvd = info.payload_bytes_rcvd;
+ if (!use_standard_bytes_stats) {
+ bytes_rcvd += info.header_and_padding_bytes_rcvd;
+ }
+ report->AddInt64(StatsReport::kStatsValueNameBytesReceived, bytes_rcvd);
if (info.capture_start_ntp_time_ms >= 0) {
report->AddInt64(StatsReport::kStatsValueNameCaptureStartNtpTimeMs,
info.capture_start_ntp_time_ms);
@@ -301,8 +326,10 @@
webrtc::videocontenttypehelpers::ToString(info.content_type));
}
-void ExtractStats(const cricket::VideoSenderInfo& info, StatsReport* report) {
- ExtractCommonSendProperties(info, report);
+void ExtractStats(const cricket::VideoSenderInfo& info,
+ StatsReport* report,
+ bool use_standard_bytes_stats) {
+ ExtractCommonSendProperties(info, report, use_standard_bytes_stats);
report->AddString(StatsReport::kStatsValueNameCodecImplementationName,
info.encoder_implementation_name);
@@ -417,7 +444,7 @@
StatsReport* report =
collector->PrepareReport(true, ssrc, track_id, transport_id, direction);
if (report)
- ExtractStats(d, report);
+ ExtractStats(d, report, collector->UseStandardBytesStats());
if (!d.remote_stats.empty()) {
report = collector->PrepareReport(false, ssrc, track_id, transport_id,
@@ -470,7 +497,10 @@
}
StatsCollector::StatsCollector(PeerConnectionInternal* pc)
- : pc_(pc), stats_gathering_started_(0) {
+ : pc_(pc),
+ stats_gathering_started_(0),
+ use_standard_bytes_stats_(
+ webrtc::field_trial::IsEnabled(kUseStandardBytesStats)) {
RTC_DCHECK(pc_);
}
diff --git a/pc/stats_collector.h b/pc/stats_collector.h
index fa9d587..041fe2f 100644
--- a/pc/stats_collector.h
+++ b/pc/stats_collector.h
@@ -94,6 +94,8 @@
// ignored.
void ClearUpdateStatsCacheForTest();
+ bool UseStandardBytesStats() const { return use_standard_bytes_stats_; }
+
private:
friend class StatsCollectorTest;
@@ -143,6 +145,7 @@
// Raw pointer to the peer connection the statistics are gathered from.
PeerConnectionInternal* const pc_;
double stats_gathering_started_;
+ const bool use_standard_bytes_stats_;
// TODO(tommi): We appear to be holding on to raw pointers to reference
// counted objects? We should be using scoped_refptr here.
diff --git a/pc/stats_collector_unittest.cc b/pc/stats_collector_unittest.cc
index a06b322..c6b57c2 100644
--- a/pc/stats_collector_unittest.cc
+++ b/pc/stats_collector_unittest.cc
@@ -324,7 +324,9 @@
EXPECT_EQ(rtc::ToString(info.audio_level), value_in_report);
EXPECT_TRUE(GetValue(report, StatsReport::kStatsValueNameBytesReceived,
&value_in_report));
- EXPECT_EQ(rtc::ToString(info.bytes_rcvd), value_in_report);
+ EXPECT_EQ(rtc::ToString(info.payload_bytes_rcvd +
+ info.header_and_padding_bytes_rcvd),
+ value_in_report);
EXPECT_TRUE(GetValue(report, StatsReport::kStatsValueNameJitterReceived,
&value_in_report));
EXPECT_EQ(rtc::ToString(info.jitter_ms), value_in_report);
@@ -397,7 +399,9 @@
EXPECT_EQ(sinfo.codec_name, value_in_report);
EXPECT_TRUE(GetValue(report, StatsReport::kStatsValueNameBytesSent,
&value_in_report));
- EXPECT_EQ(rtc::ToString(sinfo.bytes_sent), value_in_report);
+ EXPECT_EQ(rtc::ToString(sinfo.payload_bytes_sent +
+ sinfo.header_and_padding_bytes_sent),
+ value_in_report);
EXPECT_TRUE(GetValue(report, StatsReport::kStatsValueNamePacketsSent,
&value_in_report));
EXPECT_EQ(rtc::ToString(sinfo.packets_sent), value_in_report);
@@ -528,7 +532,8 @@
uint32_t ssrc = kSsrcOfTrack) {
voice_sender_info->add_ssrc(ssrc);
voice_sender_info->codec_name = "fake_codec";
- voice_sender_info->bytes_sent = 100;
+ voice_sender_info->payload_bytes_sent = 88;
+ voice_sender_info->header_and_padding_bytes_sent = 12;
voice_sender_info->packets_sent = 101;
voice_sender_info->rtt_ms = 102;
voice_sender_info->fraction_lost = 103;
@@ -563,7 +568,8 @@
void InitVoiceReceiverInfo(cricket::VoiceReceiverInfo* voice_receiver_info) {
voice_receiver_info->add_ssrc(kSsrcOfTrack);
- voice_receiver_info->bytes_rcvd = 110;
+ voice_receiver_info->payload_bytes_rcvd = 98;
+ voice_receiver_info->header_and_padding_bytes_rcvd = 12;
voice_receiver_info->packets_rcvd = 111;
voice_receiver_info->packets_lost = 114;
voice_receiver_info->jitter_ms = 116;
@@ -904,7 +910,8 @@
VideoSenderInfo video_sender_info;
video_sender_info.add_ssrc(1234);
- video_sender_info.bytes_sent = kBytesSent;
+ video_sender_info.payload_bytes_sent = kBytesSent;
+ video_sender_info.header_and_padding_bytes_sent = 0;
VideoMediaInfo video_info;
video_info.senders.push_back(video_sender_info);
@@ -936,7 +943,8 @@
VoiceSenderInfo voice_sender_info;
voice_sender_info.add_ssrc(1234);
- voice_sender_info.bytes_sent = kBytesSent;
+ voice_sender_info.payload_bytes_sent = kBytesSent - 12;
+ voice_sender_info.header_and_padding_bytes_sent = 12;
VoiceMediaInfo voice_info;
voice_info.senders.push_back(voice_sender_info);
@@ -984,7 +992,9 @@
VideoSenderInfo video_sender_info;
video_sender_info.add_ssrc(1234);
- video_sender_info.bytes_sent = kBytesSent;
+ video_sender_info.payload_bytes_sent = kBytesSent - 12;
+ video_sender_info.header_and_padding_bytes_sent = 12;
+
VideoMediaInfo video_info;
video_info.senders.push_back(video_sender_info);
@@ -1081,7 +1091,8 @@
VideoSenderInfo video_sender_info;
video_sender_info.add_ssrc(1234);
- video_sender_info.bytes_sent = kBytesSent;
+ video_sender_info.payload_bytes_sent = kBytesSent - 12;
+ video_sender_info.header_and_padding_bytes_sent = 12;
VideoMediaInfo video_info;
video_info.senders.push_back(video_sender_info);
@@ -1135,7 +1146,8 @@
VideoSenderInfo video_sender_info;
video_sender_info.add_ssrc(1234);
- video_sender_info.bytes_sent = kBytesSent;
+ video_sender_info.payload_bytes_sent = kBytesSent - 12;
+ video_sender_info.header_and_padding_bytes_sent = 12;
VideoMediaInfo video_info;
video_info.senders.push_back(video_sender_info);
diff --git a/stats/rtcstats_objects.cc b/stats/rtcstats_objects.cc
index 3f8d752..99594a8 100644
--- a/stats/rtcstats_objects.cc
+++ b/stats/rtcstats_objects.cc
@@ -598,6 +598,7 @@
RTCInboundRTPStreamStats, RTCRTPStreamStats, "inbound-rtp",
&packets_received,
&bytes_received,
+ &header_bytes_received,
&packets_lost,
&last_packet_received_timestamp,
&jitter,
@@ -630,6 +631,7 @@
fec_packets_received("fecPacketsReceived"),
fec_packets_discarded("fecPacketsDiscarded"),
bytes_received("bytesReceived"),
+ header_bytes_received("headerBytesReceived"),
packets_lost("packetsLost"),
last_packet_received_timestamp("lastPacketReceivedTimestamp"),
jitter("jitter"),
@@ -657,6 +659,7 @@
fec_packets_received(other.fec_packets_received),
fec_packets_discarded(other.fec_packets_discarded),
bytes_received(other.bytes_received),
+ header_bytes_received(other.header_bytes_received),
packets_lost(other.packets_lost),
last_packet_received_timestamp(other.last_packet_received_timestamp),
jitter(other.jitter),
@@ -686,6 +689,7 @@
&packets_sent,
&retransmitted_packets_sent,
&bytes_sent,
+ &header_bytes_sent,
&retransmitted_bytes_sent,
&target_bitrate,
&frames_encoded,
@@ -710,6 +714,7 @@
packets_sent("packetsSent"),
retransmitted_packets_sent("retransmittedPacketsSent"),
bytes_sent("bytesSent"),
+ header_bytes_sent("headerBytesSent"),
retransmitted_bytes_sent("retransmittedBytesSent"),
target_bitrate("targetBitrate"),
frames_encoded("framesEncoded"),
@@ -730,6 +735,7 @@
packets_sent(other.packets_sent),
retransmitted_packets_sent(other.retransmitted_packets_sent),
bytes_sent(other.bytes_sent),
+ header_bytes_sent(other.header_bytes_sent),
retransmitted_bytes_sent(other.retransmitted_bytes_sent),
target_bitrate(other.target_bitrate),
frames_encoded(other.frames_encoded),