Bug 1780282 - Implement some more inbound rtp stats. r=ng,emilio

These are the inbound rtp stats that are P2 for MS Teams.

Differential Revision: https://phabricator.services.mozilla.com/D152213
This commit is contained in:
Jeff Muizelaar 2022-07-22 00:47:31 +00:00
Родитель bb8a4b5e7e
Коммит 2a6bb59540
5 изменённых файлов: 98 добавлений и 33 удалений

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

@ -300,12 +300,17 @@ struct ParamTraits<mozilla::dom::RTCInboundRtpStreamStats> {
WriteParam(aWriter, aParam.mFramesDecoded);
WriteParam(aWriter, aParam.mFrameWidth);
WriteParam(aWriter, aParam.mFrameHeight);
WriteParam(aWriter, aParam.mFramesPerSecond);
WriteParam(aWriter, aParam.mBytesReceived);
WriteParam(aWriter, aParam.mNackCount);
WriteParam(aWriter, aParam.mFirCount);
WriteParam(aWriter, aParam.mPliCount);
WriteParam(aWriter, aParam.mFramesPerSecond);
WriteParam(aWriter, aParam.mFramesReceived);
WriteParam(aWriter, aParam.mJitterBufferDelay);
WriteParam(aWriter, aParam.mJitterBufferEmittedCount);
WriteParam(aWriter, aParam.mTotalSamplesReceived);
WriteParam(aWriter, aParam.mConcealedSamples);
WriteParam(aWriter, aParam.mSilentConcealedSamples);
WriteRTCReceivedRtpStreamStats(aWriter, aParam);
}
@ -314,12 +319,17 @@ struct ParamTraits<mozilla::dom::RTCInboundRtpStreamStats> {
ReadParam(aReader, &(aResult->mFramesDecoded)) &&
ReadParam(aReader, &(aResult->mFrameWidth)) &&
ReadParam(aReader, &(aResult->mFrameHeight)) &&
ReadParam(aReader, &(aResult->mFramesPerSecond)) &&
ReadParam(aReader, &(aResult->mBytesReceived)) &&
ReadParam(aReader, &(aResult->mNackCount)) &&
ReadParam(aReader, &(aResult->mFirCount)) &&
ReadParam(aReader, &(aResult->mPliCount)) &&
ReadParam(aReader, &(aResult->mFramesPerSecond)) &&
ReadParam(aReader, &(aResult->mFramesReceived)) &&
ReadParam(aReader, &(aResult->mJitterBufferDelay)) &&
ReadParam(aReader, &(aResult->mJitterBufferEmittedCount)) &&
ReadParam(aReader, &(aResult->mTotalSamplesReceived)) &&
ReadParam(aReader, &(aResult->mConcealedSamples)) &&
ReadParam(aReader, &(aResult->mSilentConcealedSamples)) &&
ReadRTCReceivedRtpStreamStats(aReader, aResult);
}
};

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

@ -314,6 +314,15 @@ nsTArray<RefPtr<RTCStatsPromise>> RTCRtpReceiver::GetStatsInternal() {
local.mPacketsReceived.Construct(audioStats->packets_rcvd);
local.mPacketsDiscarded.Construct(audioStats->packets_discarded);
local.mBytesReceived.Construct(audioStats->payload_bytes_rcvd);
local.mJitterBufferDelay.Construct(
audioStats->jitter_buffer_delay_seconds);
local.mJitterBufferEmittedCount.Construct(
audioStats->jitter_buffer_emitted_count);
local.mTotalSamplesReceived.Construct(
audioStats->total_samples_received);
local.mConcealedSamples.Construct(audioStats->concealed_samples);
local.mSilentConcealedSamples.Construct(
audioStats->silent_concealed_samples);
/*
* Potential new stats that are now available upstream.
if (audioStats->last_packet_received_timestamp_ms) {
@ -335,15 +344,6 @@ nsTArray<RefPtr<RTCStatsPromise>> RTCRtpReceiver::GetStatsInternal() {
webrtc::Timestamp::Millis(
*audioStats->estimated_playout_ntp_timestamp_ms)));
}
local.mJitterBufferDelay.Construct(
audioStats->jitter_buffer_delay_seconds);
local.mJitterBufferEmittedCount.Construct(
audioStats->jitter_buffer_emitted_count);
local.mTotalSamplesReceived.Construct(
audioStats->total_samples_received);
local.mConcealedSamples.Construct(audioStats->concealed_samples);
local.mSilentConcealedSamples.Construct(
audioStats->silent_concealed_samples);
local.mConcealmentEvents.Construct(
audioStats->concealment_events);
local.mInsertedSamplesForDeceleration.Construct(
@ -435,7 +435,10 @@ nsTArray<RefPtr<RTCStatsPromise>> RTCRtpReceiver::GetStatsInternal() {
local.mFramesReceived.Construct(
videoStats->frame_counts.key_frames +
videoStats->frame_counts.delta_frames);
local.mJitterBufferDelay.Construct(
videoStats->jitter_buffer_delay_seconds);
local.mJitterBufferEmittedCount.Construct(
videoStats->jitter_buffer_emitted_count);
/*
* Potential new stats that are now available upstream.
if (videoStats->qp_sum) {
@ -464,10 +467,6 @@ nsTArray<RefPtr<RTCStatsPromise>> RTCRtpReceiver::GetStatsInternal() {
webrtc::Timestamp::Millis(
*videoStats->estimated_playout_ntp_timestamp_ms)));
}
local.mJitterBufferDelay.Construct(
videoStats->jitter_buffer_delay_seconds);
local.mJitterBufferEmittedCount.Construct(
videoStats->jitter_buffer_emitted_count);
local.mFramesReceived.Construct(
videoStats->frame_counts.key_frames +
videoStats->frame_counts.delta_frames);

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

@ -19,6 +19,8 @@ const statsExpectedByType = {
"packetsDiscarded",
"bytesReceived",
"jitter",
"jitterBufferDelay",
"jitterBufferEmittedCount",
],
optional: ["remoteId", "nackCount"],
localVideoOnly: [
@ -31,6 +33,11 @@ const statsExpectedByType = {
"frameHeight",
"framesReceived",
],
localAudioOnly: [
"totalSamplesReceived",
"concealedSamples",
"silentConcealedSamples",
],
unimplemented: [
"mediaTrackId",
"transportId",
@ -65,6 +72,7 @@ const statsExpectedByType = {
"retransmittedBytesSent",
],
optional: ["nackCount", "qpSum"],
localAudioOnly: [],
localVideoOnly: [
"framesEncoded",
"firCount",
@ -230,7 +238,7 @@ const statsExpectedByType = {
["in", "out"].forEach(pre => {
let s = statsExpectedByType[pre + "bound-rtp"];
s.optional = [...s.optional, ...s.localVideoOnly];
s.optional = [...s.optional, ...s.localVideoOnly, ...s.localAudioOnly];
});
//
@ -490,10 +498,67 @@ function pedanticChecks(report) {
`local only test. value=${stat.jitter}`
);
// jitterBufferEmittedCount
let expectedJitterBufferEmmitedCount = stat.kind == "video" ? 10 : 1000;
ok(
stat.jitterBufferEmittedCount > expectedJitterBufferEmmitedCount,
`${stat.type}.jitterBufferEmittedCount is a sane number for a short ` +
`${stat.kind} test. value=${stat.jitterBufferEmittedCount}`
);
// jitterBufferDelay
let avgJitterBufferDelay =
stat.jitterBufferDelay / stat.jitterBufferEmittedCount;
ok(
avgJitterBufferDelay > 0.01 && avgJitterBufferDelay < 10,
`${stat.type}.jitterBufferDelay is a sane number for a short ` +
`${stat.kind} test. value=${stat.jitterBufferDelay}/${stat.jitterBufferEmittedCount}=${avgJitterBufferDelay}`
);
//
// Optional fields
//
//
// Local audio only stats
//
if (stat.inner.kind != "audio") {
expectations.localAudioOnly.forEach(field => {
ok(
stat[field] === undefined,
`${stat.type} does not have field ${field}` +
` when kind is not 'audio'`
);
});
} else {
expectations.localAudioOnly.forEach(field => {
ok(
stat.inner[field] !== undefined,
stat.type + " has field " + field + " when kind is video"
);
});
// totalSamplesReceived
ok(
stat.totalSamplesReceived > 1000,
`${stat.type}.totalSamplesReceived is a sane number for a short ` +
`${stat.kind} test. value=${stat.totalSamplesReceived}`
);
// concealedSamples
ok(
stat.concealedSamples > 100,
`${stat.type}.concealedSamples is a sane number for a short ` +
`${stat.kind} test. value=${stat.concealedSamples}`
);
// silentConcealedSamples
ok(
stat.silentConcealedSamples >= 0,
`${stat.type}.silentConcealedSamples is a sane number for a short ` +
`${stat.kind} test. value=${stat.silentConcealedSamples}`
);
}
//
// Local video only stats
//

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

@ -6,6 +6,7 @@
* The origin of this IDL file is
* http://dev.w3.org/2011/webrtc/editor/webrtc.html#rtcstatsreport-object
* http://www.w3.org/2011/04/webrtc/wiki/Stats
* https://www.w3.org/TR/webrtc-stats/
*/
enum RTCStatsType {
@ -66,11 +67,16 @@ dictionary RTCInboundRtpStreamStats : RTCReceivedRtpStreamStats {
unsigned long framesDecoded;
unsigned long frameWidth;
unsigned long frameHeight;
double framesPerSecond;
unsigned long long bytesReceived;
unsigned long nackCount;
unsigned long firCount;
unsigned long pliCount;
double framesPerSecond;
double jitterBufferDelay;
unsigned long long jitterBufferEmittedCount;
unsigned long long totalSamplesReceived;
unsigned long long concealedSamples;
unsigned long long silentConcealedSamples;
unsigned long framesReceived;
};

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

@ -35,21 +35,6 @@
[inbound-rtp's estimatedPlayoutTimestamp]
expected: FAIL
[inbound-rtp's jitterBufferDelay]
expected: FAIL
[inbound-rtp's jitterBufferEmittedCount]
expected: FAIL
[inbound-rtp's totalSamplesReceived]
expected: FAIL
[inbound-rtp's concealedSamples]
expected: FAIL
[inbound-rtp's silentConcealedSamples]
expected: FAIL
[inbound-rtp's concealmentEvents]
expected: FAIL