Bug 1759931 - Implement some missing outbound-rtp stats. r=jib,emilio,ng

Differential Revision: https://phabricator.services.mozilla.com/D141287
This commit is contained in:
Jeff Muizelaar 2022-03-25 13:33:02 +00:00
Родитель 258c7cbfe7
Коммит 43236fc511
4 изменённых файлов: 39 добавлений и 13 удалений

Просмотреть файл

@ -2717,14 +2717,17 @@ nsTArray<RefPtr<dom::RTCStatsPromise>> PeerConnectionImpl::GetSenderStats(
local.mBytesSent.Construct(audioStats->payload_bytes_sent);
local.mNackCount.Construct(
audioStats->rtcp_packet_type_counts.nack_packets);
/*
* Potential new stats that are now available upstream.
local.mHeaderBytesSent.Construct(
audioStats->header_and_padding_bytes_sent);
local.mRetransmittedPacketsSent.Construct(
audioStats->retransmitted_packets_sent);
local.mRetransmittedBytesSent.Construct(
audioStats->retransmitted_bytes_sent);
/*
* Potential new stats that are now available upstream.
* Note: when we last tried exposing this we were getting
* targetBitrate for audio was ending up as 0. We did not
* investigate why.
local.mTargetBitrate.Construct(audioStats->target_bitrate_bps);
*/
if (!report->mOutboundRtpStreamStats.AppendElement(std::move(local),
@ -2805,8 +2808,6 @@ nsTArray<RefPtr<dom::RTCStatsPromise>> PeerConnectionImpl::GetSenderStats(
if (streamStats->qp_sum) {
local.mQpSum.Construct(*streamStats->qp_sum);
}
/*
* Potential new stats that are now available upstream.
local.mHeaderBytesSent.Construct(
streamStats->rtp_stats.transmitted.header_bytes +
streamStats->rtp_stats.transmitted.padding_bytes);
@ -2814,6 +2815,8 @@ nsTArray<RefPtr<dom::RTCStatsPromise>> PeerConnectionImpl::GetSenderStats(
streamStats->rtp_stats.retransmitted.packets);
local.mRetransmittedBytesSent.Construct(
streamStats->rtp_stats.retransmitted.payload_bytes);
/*
* Potential new stats that are now available upstream.
local.mTargetBitrate.Construct(videoStats->target_media_bitrate_bps);
local.mTotalEncodedBytesTarget.Construct(
videoStats->total_encoded_bytes_target);

Просмотреть файл

@ -56,6 +56,9 @@ const statsExpectedByType = {
"packetsSent",
"bytesSent",
"remoteId",
"headerBytesSent",
"retransmittedPacketsSent",
"retransmittedBytesSent",
],
optional: ["nackCount", "qpSum"],
localVideoOnly: ["framesEncoded", "firCount", "pliCount"],
@ -567,6 +570,32 @@ function pedanticChecks(report) {
`${stat.kind} test. value=${stat.bytesSent}`
);
// headerBytesSent
ok(
stat.headerBytesSent > 0 &&
stat.headerBytesSent < (stat.kind == "video" ? video1Min : audio1Min),
`${stat.type}.headerBytesSent is a sane number for a short ` +
`${stat.kind} test. value=${stat.headerBytesSent}`
);
// retransmittedPacketsSent
ok(
stat.retransmittedPacketsSent >= 0 &&
stat.retransmittedPacketsSent <
(stat.kind == "video" ? video1Min : audio1Min),
`${stat.type}.retransmittedPacketsSent is a sane number for a short ` +
`${stat.kind} test. value=${stat.retransmittedPacketsSent}`
);
// retransmittedBytesSent
ok(
stat.retransmittedBytesSent >= 0 &&
stat.retransmittedBytesSent <
(stat.kind == "video" ? video1Min : audio1Min),
`${stat.type}.retransmittedBytesSent is a sane number for a short ` +
`${stat.kind} test. value=${stat.retransmittedBytesSent}`
);
//
// Optional fields
//

Просмотреть файл

@ -87,6 +87,9 @@ dictionary RTCOutboundRtpStreamStats : RTCSentRtpStreamStats {
unsigned long nackCount;
unsigned long firCount;
unsigned long pliCount;
unsigned long long headerBytesSent;
unsigned long long retransmittedPacketsSent;
unsigned long long retransmittedBytesSent;
};
dictionary RTCRemoteOutboundRtpStreamStats : RTCSentRtpStreamStats {

Просмотреть файл

@ -172,9 +172,6 @@
[outbound-rtp's lastPacketSentTimestamp]
expected: FAIL
[outbound-rtp's headerBytesSent]
expected: FAIL
[outbound-rtp's packetsDiscardedOnSend]
expected: FAIL
@ -184,12 +181,6 @@
[outbound-rtp's fecPacketsSent]
expected: FAIL
[outbound-rtp's retransmittedPacketsSent]
expected: FAIL
[outbound-rtp's retransmittedBytesSent]
expected: FAIL
[outbound-rtp's targetBitrate]
expected: FAIL