RTC[In/Out]boundRTPStreamStats: qpSum,framesDecoded,framesEncoded added.

Recently added to the spec:
RTCRTPStreamStats.qpSum - https://w3c.github.io/webrtc-stats/#dom-rtcrtpstreamstats-qpsum
RTCInboundRTPStreamStats.framesDecoded - https://w3c.github.io/webrtc-stats/#dom-rtcinboundrtpstreamstats-framesdecoded
RTCOutboundRTPStreamStats.framesEncoded - https://w3c.github.io/webrtc-stats/#dom-rtcoutboundrtpstreamstats-framesencoded

These are added and collected. However, the qpSum is only collected in
the outbound case. It should be collected in the inbound case before
closing crbug.com/657855

BUG=chromium:657854, chromium:657855, chromium:657856

Review-Url: https://codereview.webrtc.org/2588373005
Cr-Commit-Position: refs/heads/master@{#15872}
This commit is contained in:
hbos 2017-01-02 08:35:13 -08:00 committed by Commit bot
parent d17a5a7709
commit 6769c49418
5 changed files with 55 additions and 9 deletions

View File

@ -509,6 +509,7 @@ class RTCStatsReportVerifier {
const RTCInboundRTPStreamStats& inbound_stream) {
RTCStatsVerifier verifier(report_, &inbound_stream);
VerifyRTCRTPStreamStats(inbound_stream, &verifier);
verifier.TestMemberIsUndefined(inbound_stream.qp_sum);
verifier.TestMemberIsNonNegative<uint32_t>(inbound_stream.packets_received);
verifier.TestMemberIsNonNegative<uint64_t>(inbound_stream.bytes_received);
verifier.TestMemberIsNonNegative<uint32_t>(inbound_stream.packets_lost);
@ -529,6 +530,12 @@ class RTCStatsReportVerifier {
verifier.TestMemberIsUndefined(inbound_stream.burst_discard_rate);
verifier.TestMemberIsUndefined(inbound_stream.gap_loss_rate);
verifier.TestMemberIsUndefined(inbound_stream.gap_discard_rate);
if (inbound_stream.media_type.is_defined() &&
*inbound_stream.media_type == "video") {
verifier.TestMemberIsDefined(inbound_stream.frames_decoded);
} else {
verifier.TestMemberIsUndefined(inbound_stream.frames_decoded);
}
return verifier.ExpectAllMembersSuccessfullyTested();
}
@ -536,11 +543,23 @@ class RTCStatsReportVerifier {
const RTCOutboundRTPStreamStats& outbound_stream) {
RTCStatsVerifier verifier(report_, &outbound_stream);
VerifyRTCRTPStreamStats(outbound_stream, &verifier);
if (outbound_stream.media_type.is_defined() &&
*outbound_stream.media_type == "video") {
verifier.TestMemberIsNonNegative<uint64_t>(outbound_stream.qp_sum);
} else {
verifier.TestMemberIsUndefined(outbound_stream.qp_sum);
}
verifier.TestMemberIsNonNegative<uint32_t>(outbound_stream.packets_sent);
verifier.TestMemberIsNonNegative<uint64_t>(outbound_stream.bytes_sent);
verifier.TestMemberIsUndefined(outbound_stream.target_bitrate);
// TODO(hbos): Defined in video but not audio case. Why? crbug.com/669877
verifier.MarkMemberTested(outbound_stream.round_trip_time, true);
if (outbound_stream.media_type.is_defined() &&
*outbound_stream.media_type == "video") {
verifier.TestMemberIsDefined(outbound_stream.frames_encoded);
} else {
verifier.TestMemberIsUndefined(outbound_stream.frames_encoded);
}
return verifier.ExpectAllMembersSuccessfullyTested();
}

View File

@ -198,6 +198,7 @@ void SetInboundRTPStreamStatsFromVideoReceiverInfo(
static_cast<uint32_t>(video_receiver_info.plis_sent);
inbound_video->nack_count =
static_cast<uint32_t>(video_receiver_info.nacks_sent);
inbound_video->frames_decoded = video_receiver_info.frames_decoded;
}
// Provides the media independent counters (both audio and video).
@ -242,6 +243,9 @@ void SetOutboundRTPStreamStatsFromVideoSenderInfo(
static_cast<uint32_t>(video_sender_info.plis_rcvd);
outbound_video->nack_count =
static_cast<uint32_t>(video_sender_info.nacks_rcvd);
if (video_sender_info.qp_sum)
outbound_video->qp_sum = *video_sender_info.qp_sum;
outbound_video->frames_encoded = video_sender_info.frames_encoded;
}
void ProduceCertificateStatsFromSSLCertificateStats(

View File

@ -1522,6 +1522,7 @@ TEST_F(RTCStatsCollectorTest, CollectRTCInboundRTPStreamStats_Video) {
video_media_info.receivers[0].firs_sent = 5;
video_media_info.receivers[0].plis_sent = 6;
video_media_info.receivers[0].nacks_sent = 7;
video_media_info.receivers[0].frames_decoded = 8;
RtpCodecParameters codec_parameters;
codec_parameters.payload_type = 42;
@ -1568,6 +1569,7 @@ TEST_F(RTCStatsCollectorTest, CollectRTCInboundRTPStreamStats_Video) {
expected_video.bytes_received = 3;
expected_video.packets_lost = 42;
expected_video.fraction_lost = 4.5;
expected_video.frames_decoded = 8;
ASSERT(report->Get(expected_video.id()));
const RTCInboundRTPStreamStats& video = report->Get(
@ -1664,6 +1666,8 @@ TEST_F(RTCStatsCollectorTest, CollectRTCOutboundRTPStreamStats_Video) {
video_media_info.senders[0].bytes_sent = 6;
video_media_info.senders[0].rtt_ms = 7500;
video_media_info.senders[0].codec_payload_type = rtc::Optional<int>(42);
video_media_info.senders[0].frames_encoded = 8;
video_media_info.senders[0].qp_sum = rtc::Optional<uint64_t>(16);
RtpCodecParameters codec_parameters;
codec_parameters.payload_type = 42;
@ -1709,6 +1713,8 @@ TEST_F(RTCStatsCollectorTest, CollectRTCOutboundRTPStreamStats_Video) {
expected_video.packets_sent = 5;
expected_video.bytes_sent = 6;
expected_video.round_trip_time = 7.5;
expected_video.frames_encoded = 8;
expected_video.qp_sum = 16;
ASSERT(report->Get(expected_video.id()));
const RTCOutboundRTPStreamStats& video = report->Get(
@ -1750,6 +1756,7 @@ TEST_F(RTCStatsCollectorTest, CollectRTCOutboundRTPStreamStats_Default) {
video_media_info.senders[0].bytes_sent = 6;
video_media_info.senders[0].rtt_ms = -1;
video_media_info.senders[0].codec_payload_type = rtc::Optional<int>(42);
video_media_info.senders[0].frames_encoded = 7;
EXPECT_CALL(*voice_media_channel, GetStats(_))
.WillOnce(DoAll(SetArgPointee<0>(voice_media_info), Return(true)));
@ -1809,7 +1816,9 @@ TEST_F(RTCStatsCollectorTest, CollectRTCOutboundRTPStreamStats_Default) {
expected_video.nack_count = 4;
expected_video.packets_sent = 5;
expected_video.bytes_sent = 6;
expected_video.frames_encoded = 7;
// |expected_video.round_trip_time| should be undefined.
// |expected_video.qp_sum| should be undefined.
ASSERT(report->Get(expected_video.id()));
const RTCOutboundRTPStreamStats& video = report->Get(

View File

@ -309,6 +309,9 @@ class RTCRTPStreamStats : public RTCStats {
// TODO(hbos): Not collected by |RTCStatsCollector|. crbug.com/657854
// SLI count is only defined for |media_type == "video"|.
RTCStatsMember<uint32_t> sli_count;
// TODO(hbos): Only collected for the outbound case, should also be collected
// for inbound case by |RTCStatsCollector|. crbug.com/657854, crbug.com/657855
RTCStatsMember<uint64_t> qp_sum;
protected:
RTCRTPStreamStats(const std::string& id, int64_t timestamp_us);
@ -354,6 +357,7 @@ class RTCInboundRTPStreamStats final : public RTCRTPStreamStats {
RTCStatsMember<double> gap_loss_rate;
// TODO(hbos): Not collected by |RTCStatsCollector|. crbug.com/657855
RTCStatsMember<double> gap_discard_rate;
RTCStatsMember<uint32_t> frames_decoded;
};
// https://w3c.github.io/webrtc-stats/#outboundrtpstats-dict*
@ -373,6 +377,7 @@ class RTCOutboundRTPStreamStats final : public RTCRTPStreamStats {
// TODO(hbos): Not collected by |RTCStatsCollector|. crbug.com/657856
RTCStatsMember<double> target_bitrate;
RTCStatsMember<double> round_trip_time;
RTCStatsMember<uint32_t> frames_encoded;
};
// https://w3c.github.io/webrtc-stats/#transportstats-dict*

View File

@ -447,7 +447,8 @@ WEBRTC_RTCSTATS_IMPL(RTCRTPStreamStats, RTCStats, "rtp",
&fir_count,
&pli_count,
&nack_count,
&sli_count);
&sli_count,
&qp_sum);
RTCRTPStreamStats::RTCRTPStreamStats(
const std::string& id, int64_t timestamp_us)
@ -467,7 +468,8 @@ RTCRTPStreamStats::RTCRTPStreamStats(
fir_count("firCount"),
pli_count("pliCount"),
nack_count("nackCount"),
sli_count("sliCount") {
sli_count("sliCount"),
qp_sum("qpSum") {
}
RTCRTPStreamStats::RTCRTPStreamStats(
@ -483,7 +485,8 @@ RTCRTPStreamStats::RTCRTPStreamStats(
fir_count(other.fir_count),
pli_count(other.pli_count),
nack_count(other.nack_count),
sli_count(other.sli_count) {
sli_count(other.sli_count),
qp_sum(other.qp_sum) {
}
RTCRTPStreamStats::~RTCRTPStreamStats() {
@ -505,7 +508,8 @@ WEBRTC_RTCSTATS_IMPL(
&burst_loss_rate,
&burst_discard_rate,
&gap_loss_rate,
&gap_discard_rate);
&gap_discard_rate,
&frames_decoded);
RTCInboundRTPStreamStats::RTCInboundRTPStreamStats(
const std::string& id, int64_t timestamp_us)
@ -529,7 +533,8 @@ RTCInboundRTPStreamStats::RTCInboundRTPStreamStats(
burst_loss_rate("burstLossRate"),
burst_discard_rate("burstDiscardRate"),
gap_loss_rate("gapLossRate"),
gap_discard_rate("gapDiscardRate") {
gap_discard_rate("gapDiscardRate"),
frames_decoded("framesDecoded") {
}
RTCInboundRTPStreamStats::RTCInboundRTPStreamStats(
@ -549,7 +554,8 @@ RTCInboundRTPStreamStats::RTCInboundRTPStreamStats(
burst_loss_rate(other.burst_loss_rate),
burst_discard_rate(other.burst_discard_rate),
gap_loss_rate(other.gap_loss_rate),
gap_discard_rate(other.gap_discard_rate) {
gap_discard_rate(other.gap_discard_rate),
frames_decoded(other.frames_decoded) {
}
RTCInboundRTPStreamStats::~RTCInboundRTPStreamStats() {
@ -560,7 +566,8 @@ WEBRTC_RTCSTATS_IMPL(
&packets_sent,
&bytes_sent,
&target_bitrate,
&round_trip_time);
&round_trip_time,
&frames_encoded);
RTCOutboundRTPStreamStats::RTCOutboundRTPStreamStats(
const std::string& id, int64_t timestamp_us)
@ -573,7 +580,8 @@ RTCOutboundRTPStreamStats::RTCOutboundRTPStreamStats(
packets_sent("packetsSent"),
bytes_sent("bytesSent"),
target_bitrate("targetBitrate"),
round_trip_time("roundTripTime") {
round_trip_time("roundTripTime"),
frames_encoded("framesEncoded") {
}
RTCOutboundRTPStreamStats::RTCOutboundRTPStreamStats(
@ -582,7 +590,8 @@ RTCOutboundRTPStreamStats::RTCOutboundRTPStreamStats(
packets_sent(other.packets_sent),
bytes_sent(other.bytes_sent),
target_bitrate(other.target_bitrate),
round_trip_time(other.round_trip_time) {
round_trip_time(other.round_trip_time),
frames_encoded(other.frames_encoded) {
}
RTCOutboundRTPStreamStats::~RTCOutboundRTPStreamStats() {