Implement QualityLimitationReasonTracker and expose "reason".

This CL implements the logic behind qualityLimitationReason[1] and
qualityLimitationDurations[2]

This CL also exposes qualityLimitationReason in the standard getStats()
API, but does not expose qualityLimitationDurations because that is
blocked on supporting the "record<>" type in RTCStatsMember[3].

[1] https://w3c.github.io/webrtc-stats/#dom-rtcoutboundrtpstreamstats-qualitylimitationreason
[2] https://w3c.github.io/webrtc-stats/#dom-rtcoutboundrtpstreamstats-qualitylimitationdurations
[3] https://crbug.com/webrtc/10685

TBR=stefan@webrtc.org

Bug: webrtc:10451, webrtc:10686
Change-Id: Ifff0be4ddd64eaec23d59c02af99fdbb1feb3841
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/138825
Commit-Queue: Henrik Boström <hbos@webrtc.org>
Reviewed-by: Åsa Persson <asapersson@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#28090}
This commit is contained in:
Henrik Boström
2019-05-28 17:42:38 +02:00
committed by Commit Bot
parent 07fc398ca8
commit ce33b6a4cf
17 changed files with 478 additions and 0 deletions

View File

@ -53,6 +53,12 @@ const char* const RTCNetworkType::kWimax = "wimax";
const char* const RTCNetworkType::kVpn = "vpn";
const char* const RTCNetworkType::kUnknown = "unknown";
// https://w3c.github.io/webrtc-stats/#dom-rtcqualitylimitationreason
const char* const RTCQualityLimitationReason::kNone = "none";
const char* const RTCQualityLimitationReason::kCpu = "cpu";
const char* const RTCQualityLimitationReason::kBandwidth = "bandwidth";
const char* const RTCQualityLimitationReason::kOther = "other";
// https://webrtc.org/experiments/rtp-hdrext/video-content-type/
const char* const RTCContentType::kUnspecified = "unspecified";
const char* const RTCContentType::kScreenshare = "screenshare";
@ -681,6 +687,7 @@ WEBRTC_RTCSTATS_IMPL(
&total_encode_time,
&total_encoded_bytes_target,
&total_packet_send_delay,
&quality_limitation_reason,
&content_type)
// clang-format on
@ -701,6 +708,7 @@ RTCOutboundRTPStreamStats::RTCOutboundRTPStreamStats(std::string&& id,
total_encode_time("totalEncodeTime"),
total_encoded_bytes_target("totalEncodedBytesTarget"),
total_packet_send_delay("totalPacketSendDelay"),
quality_limitation_reason("qualityLimitationReason"),
content_type("contentType") {}
RTCOutboundRTPStreamStats::RTCOutboundRTPStreamStats(
@ -716,6 +724,7 @@ RTCOutboundRTPStreamStats::RTCOutboundRTPStreamStats(
total_encode_time(other.total_encode_time),
total_encoded_bytes_target(other.total_encoded_bytes_target),
total_packet_send_delay(other.total_packet_send_delay),
quality_limitation_reason(other.quality_limitation_reason),
content_type(other.content_type) {}
RTCOutboundRTPStreamStats::~RTCOutboundRTPStreamStats() {}