Bug 1767170 - Add some more outbound-rtp stats. r=ng,webidl,smaug

Differential Revision: https://phabricator.services.mozilla.com/D145177
This commit is contained in:
Jeff Muizelaar 2022-05-03 12:51:36 +00:00
Родитель 997a56b018
Коммит 4e9620adae
5 изменённых файлов: 40 добавлений и 12 удалений

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

@ -352,9 +352,12 @@ struct ParamTraits<mozilla::dom::RTCOutboundRtpStreamStats> {
WriteParam(aWriter, aParam.mHeaderBytesSent);
WriteParam(aWriter, aParam.mRetransmittedPacketsSent);
WriteParam(aWriter, aParam.mRetransmittedBytesSent);
WriteParam(aWriter, aParam.mTotalEncodedBytesTarget);
WriteParam(aWriter, aParam.mFrameWidth);
WriteParam(aWriter, aParam.mFrameHeight);
WriteParam(aWriter, aParam.mFramesSent);
WriteParam(aWriter, aParam.mHugeFramesSent);
WriteParam(aWriter, aParam.mTotalEncodeTime);
WriteRTCSentRtpStreamStats(aWriter, aParam);
}
@ -368,9 +371,12 @@ struct ParamTraits<mozilla::dom::RTCOutboundRtpStreamStats> {
ReadParam(aReader, &(aResult->mHeaderBytesSent)) &&
ReadParam(aReader, &(aResult->mRetransmittedPacketsSent)) &&
ReadParam(aReader, &(aResult->mRetransmittedBytesSent)) &&
ReadParam(aReader, &(aResult->mTotalEncodedBytesTarget)) &&
ReadParam(aReader, &(aResult->mFrameWidth)) &&
ReadParam(aReader, &(aResult->mFrameHeight)) &&
ReadParam(aReader, &(aResult->mFramesSent)) &&
ReadParam(aReader, &(aResult->mHugeFramesSent)) &&
ReadParam(aReader, &(aResult->mTotalEncodeTime)) &&
ReadRTCSentRtpStreamStats(aReader, aResult);
}
};

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

@ -372,14 +372,16 @@ nsTArray<RefPtr<dom::RTCStatsPromise>> RTCRtpSender::GetStatsInternal() {
streamStats->rtp_stats.retransmitted.packets);
local.mRetransmittedBytesSent.Construct(
streamStats->rtp_stats.retransmitted.payload_bytes);
local.mFramesSent.Construct(streamStats->frames_encoded);
local.mTotalEncodedBytesTarget.Construct(
videoStats->total_encoded_bytes_target);
local.mFrameWidth.Construct(streamStats->width);
local.mFrameHeight.Construct(streamStats->height);
local.mFramesSent.Construct(streamStats->frames_encoded);
local.mHugeFramesSent.Construct(streamStats->huge_frames_sent);
local.mTotalEncodeTime.Construct(streamStats->total_encode_time_ms / 1000.);
/*
* Potential new stats that are now available upstream.
local.mTargetBitrate.Construct(videoStats->target_media_bitrate_bps);
local.mTotalEncodedBytesTarget.Construct(
videoStats->total_encoded_bytes_target);
*/
if (!report->mOutboundRtpStreamStats.AppendElement(std::move(local),
fallible)) {

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

@ -63,6 +63,7 @@ const statsExpectedByType = {
"headerBytesSent",
"retransmittedPacketsSent",
"retransmittedBytesSent",
"totalEncodedBytesTarget",
],
optional: ["nackCount", "qpSum"],
localVideoOnly: [
@ -72,6 +73,8 @@ const statsExpectedByType = {
"frameWidth",
"frameHeight",
"framesSent",
"hugeFramesSent",
"totalEncodeTime",
],
unimplemented: ["mediaTrackId", "transportId", "sliCount", "targetBitrate"],
deprecated: ["isRemote"],
@ -634,6 +637,14 @@ function pedanticChecks(report) {
`${stat.kind} test. value=${stat.retransmittedBytesSent}`
);
// totalEncodedBytesTarget
ok(
stat.totalEncodedBytesTarget > 1000,
`${stat.type}.totalEncodedBytesTarget is a sane number for a short ` +
`${stat.kind} test. value=${stat.retransmittedBytesSent}`
);
//
// Optional fields
//
@ -716,6 +727,21 @@ function pedanticChecks(report) {
`${stat.type}.framesSent is a sane number for a short ` +
`${stat.kind} test. value=${stat.framesSent}`
);
// hugeFramesSent
ok(
stat.hugeFramesSent >= 0 && stat.hugeFramesSent < 100000,
`${stat.type}.hugeFramesSent is a sane number for a short ` +
`${stat.kind} test. value=${stat.hugeFramesSent}`
);
// totalEncodeTime
ok(
stat.totalEncodeTime >= 0,
`${stat.type}.totalEncodeTime is a sane number for a short ` +
`${stat.kind} test. value=${stat.totalEncodeTime}`
);
}
} else if (stat.type == "remote-outbound-rtp") {
//

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

@ -94,9 +94,12 @@ dictionary RTCOutboundRtpStreamStats : RTCSentRtpStreamStats {
unsigned long long headerBytesSent;
unsigned long long retransmittedPacketsSent;
unsigned long long retransmittedBytesSent;
unsigned long long totalEncodedBytesTarget;
unsigned long frameWidth;
unsigned long frameHeight;
unsigned long framesSent;
unsigned long hugeFramesSent;
double totalEncodeTime;
};
dictionary RTCRemoteOutboundRtpStreamStats : RTCSentRtpStreamStats {

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

@ -172,18 +172,12 @@
[outbound-rtp's targetBitrate]
expected: FAIL
[outbound-rtp's totalEncodedBytesTarget]
expected: FAIL
[outbound-rtp's frameBitDepth]
expected: FAIL
[outbound-rtp's framesPerSecond]
expected: FAIL
[outbound-rtp's hugeFramesSent]
expected: FAIL
[outbound-rtp's keyFramesEncoded]
expected: FAIL
@ -202,9 +196,6 @@
[outbound-rtp's voiceActivityFlag]
expected: FAIL
[outbound-rtp's totalEncodeTime]
expected: FAIL
[outbound-rtp's totalPacketSendDelay]
expected: FAIL