mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-28 23:31:56 +00:00
Bug 1344970 - rename mozRtt to roundTripTime r=jib,smaug
MozReview-Commit-ID: 3kES8JUPd3n --HG-- extra : rebase_source : e49846845d7cbd43f96d13cb1881e0383517f197
This commit is contained in:
parent
08d6dac87a
commit
9352ee95aa
@ -1648,9 +1648,12 @@ PeerConnectionWrapper.prototype = {
|
||||
ok(rem.bytesReceived <= res.bytesSent, "No more than sent bytes");
|
||||
}
|
||||
ok(rem.jitter !== undefined, "Rtcp jitter");
|
||||
ok(rem.mozRtt !== undefined, "Rtcp rtt");
|
||||
ok(rem.mozRtt >= 0, "Rtcp rtt " + rem.mozRtt + " >= 0");
|
||||
ok(rem.mozRtt < 60000, "Rtcp rtt " + rem.mozRtt + " < 1 min");
|
||||
if (rem.roundTripTime) {
|
||||
ok(rem.roundTripTime > 0,
|
||||
"Rtcp rtt " + rem.roundTripTime + " >= 0");
|
||||
ok(rem.roundTripTime < 60000,
|
||||
"Rtcp rtt " + rem.roundTripTime + " < 1 min");
|
||||
}
|
||||
} else {
|
||||
ok(rem.type == "outbound-rtp", "Rtcp is outbound");
|
||||
ok(rem.packetsSent !== undefined, "Rtcp packetsSent");
|
||||
|
@ -14,7 +14,7 @@ var statsExpectedByType = {
|
||||
"inbound-rtp": {
|
||||
expected: ["id", "timestamp", "type", "ssrc", "isRemote", "mediaType",
|
||||
"packetsReceived", "packetsLost", "bytesReceived", "jitter",],
|
||||
optional: ["mozRtt", "remoteId", "nackCount",],
|
||||
optional: ["roundTripTime", "remoteId", "nackCount",],
|
||||
localVideoOnly: ["discardedPackets", "framerateStdDev", "framerateMean",
|
||||
"bitrateMean", "bitrateStdDev", "firCount", "pliCount",],
|
||||
unimplemented: ["mediaTrackId", "transportId", "codecId", "framesDecoded",
|
||||
@ -22,6 +22,7 @@ var statsExpectedByType = {
|
||||
"sliCount", "qpSum", "packetsRepaired", "fractionLost",
|
||||
"burstPacketsLost", "burstLossCount", "burstDiscardCount",
|
||||
"gapDiscardRate", "gapLossRate",],
|
||||
deprecated: ["mozRtt"],
|
||||
},
|
||||
"outbound-rtp": {
|
||||
expected: ["id", "timestamp", "type", "ssrc", "isRemote", "mediaType",
|
||||
@ -31,7 +32,8 @@ var statsExpectedByType = {
|
||||
"framerateMean", "framerateStdDev", "framesEncoded", "firCount",
|
||||
"pliCount",],
|
||||
unimplemented: ["mediaTrackId", "transportId", "codecId",
|
||||
"sliCount", "qpSum", "roundTripTime", "targetBitrate",],
|
||||
"sliCount", "qpSum", "targetBitrate",],
|
||||
deprecated: [],
|
||||
},
|
||||
"codec": { skip: true },
|
||||
"peer-connection": { skip: true },
|
||||
@ -81,6 +83,14 @@ var checkExpectedFields = report => report.forEach(stat => {
|
||||
ok(!Object.keys(stat).includes(field), "Unimplemented field " + stat.type
|
||||
+ "." + field + " does not exist.");
|
||||
});
|
||||
|
||||
//
|
||||
// Ensure that all deprecated fields are not present
|
||||
//
|
||||
expectations.deprecated.forEach(field => {
|
||||
ok(!Object.keys(stat).includes(field), "Deprecated field " + stat.type
|
||||
+ "." + field + " does not exist.");
|
||||
});
|
||||
});
|
||||
|
||||
var pedanticChecks = report => {
|
||||
@ -201,12 +211,13 @@ var pedanticChecks = report => {
|
||||
// Optional fields
|
||||
//
|
||||
|
||||
// mozRtt
|
||||
// roundTripTime
|
||||
if (stat.inner.isRemote) {
|
||||
ok(stat.mozRtt >= 0, stat.type + ".mozRtt is sane.");
|
||||
ok(stat.roundTripTime >= 0, stat.type + ".roundTripTime is sane with" +
|
||||
"value of:" + stat.roundTripTime);
|
||||
} else {
|
||||
is(stat.mozRtt, undefined, stat.type
|
||||
+ ".mozRtt is only set when isRemote is true");
|
||||
is(stat.roundTripTime, undefined, stat.type
|
||||
+ ".roundTripTime is only set when isRemote is true");
|
||||
}
|
||||
|
||||
//
|
||||
@ -362,40 +373,46 @@ var pedanticChecks = report => {
|
||||
|
||||
// This MUST be run after PC_*_WAIT_FOR_MEDIA_FLOW to ensure that we have RTP
|
||||
// before checking for RTCP.
|
||||
var waitForRtcp = async pc => {
|
||||
var waitForSyncedRtcp = async pc => {
|
||||
// Ensures that RTCP is present
|
||||
let ensureRtcp = async () => pc.getStats().then(stats => {
|
||||
let ensureSyncedRtcp = async () => {
|
||||
let stats = await pc.getStats();
|
||||
for (let [k, v] of stats) {
|
||||
if (v.type.endsWith("bound-rtp") && !v.remoteId) {
|
||||
throw new Error(v.id + " is missing remoteId: "
|
||||
+ JSON.stringify(v));
|
||||
}
|
||||
if (v.type == "inbound-rtp" && v.isRemote == true
|
||||
&& v.roundTripTime === undefined) {
|
||||
throw new Error(v.id + " is missing roundTripTime: "
|
||||
+ JSON.stringify(v));
|
||||
}
|
||||
}
|
||||
return stats;
|
||||
});
|
||||
|
||||
}
|
||||
const waitPeriod = 500;
|
||||
for (let totalTime = 10000; totalTime > 0; totalTime -= waitPeriod) {
|
||||
const maxTime = 15000;
|
||||
for (let totalTime = maxTime; totalTime > 0; totalTime -= waitPeriod) {
|
||||
try {
|
||||
return await ensureRtcp();
|
||||
return await ensureSyncedRtcp();
|
||||
} catch (e) {
|
||||
info(e);
|
||||
await wait(waitPeriod);
|
||||
}
|
||||
}
|
||||
throw new Error("Waiting for RTCP timed out after at least " + totalTime
|
||||
throw new Error("Waiting for synced RTCP timed out after at least " + maxTime
|
||||
+ "ms");
|
||||
}
|
||||
|
||||
var PC_LOCAL_TEST_LOCAL_STATS = test => {
|
||||
return waitForRtcp(test.pcLocal).then(stats => {
|
||||
return waitForSyncedRtcp(test.pcLocal).then(stats => {
|
||||
checkExpectedFields(stats);
|
||||
pedanticChecks(stats);
|
||||
});
|
||||
}
|
||||
|
||||
var PC_REMOTE_TEST_REMOTE_STATS = test => {
|
||||
return waitForRtcp(test.pcRemote).then(stats => {
|
||||
return waitForSyncedRtcp(test.pcRemote).then(stats => {
|
||||
checkExpectedFields(stats);
|
||||
pedanticChecks(stats);
|
||||
});
|
||||
|
@ -344,7 +344,7 @@ struct ParamTraits<mozilla::dom::RTCInboundRTPStreamStats>
|
||||
WriteParam(aMsg, aParam.mJitter);
|
||||
WriteParam(aMsg, aParam.mMozAvSyncDelay);
|
||||
WriteParam(aMsg, aParam.mMozJitterBufferDelay);
|
||||
WriteParam(aMsg, aParam.mMozRtt);
|
||||
WriteParam(aMsg, aParam.mRoundTripTime);
|
||||
WriteParam(aMsg, aParam.mPacketsLost);
|
||||
WriteParam(aMsg, aParam.mPacketsReceived);
|
||||
WriteRTCRTPStreamStats(aMsg, aParam);
|
||||
@ -358,7 +358,7 @@ struct ParamTraits<mozilla::dom::RTCInboundRTPStreamStats>
|
||||
!ReadParam(aMsg, aIter, &(aResult->mJitter)) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->mMozAvSyncDelay)) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->mMozJitterBufferDelay)) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->mMozRtt)) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->mRoundTripTime)) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->mPacketsLost)) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->mPacketsReceived)) ||
|
||||
!ReadRTCRTPStreamStats(aMsg, aIter, aResult) ||
|
||||
|
@ -42,7 +42,7 @@ dictionary RTCRTPStreamStats : RTCStats {
|
||||
|
||||
// Local only measurements, RTCP related but not communicated via RTCP. Not
|
||||
// present in RTCP case.
|
||||
unsigned long firCount;
|
||||
unsigned long firCount;
|
||||
unsigned long pliCount;
|
||||
unsigned long nackCount;
|
||||
};
|
||||
@ -54,7 +54,7 @@ dictionary RTCInboundRTPStreamStats : RTCRTPStreamStats {
|
||||
unsigned long packetsLost;
|
||||
long mozAvSyncDelay;
|
||||
long mozJitterBufferDelay;
|
||||
long mozRtt;
|
||||
long roundTripTime;
|
||||
|
||||
// Video decoder measurement, not present in RTCP case
|
||||
unsigned long discardedPackets;
|
||||
|
@ -223,6 +223,9 @@ bool WebrtcAudioConduit::GetRTCPReceiverReport(DOMHighResTimeStamp* timestamp,
|
||||
fractionLost,
|
||||
*cumulativeLost,
|
||||
*rttMs);
|
||||
// Note: rrtMs is 0 when unavailable before the VoE rework. It is likely
|
||||
// that after the audio moves to the new Call API that rttMs will be -1
|
||||
// when unavailable.
|
||||
if (!result) {
|
||||
return false;
|
||||
}
|
||||
|
@ -876,12 +876,7 @@ bool WebrtcVideoConduit::GetRTCPReceiverReport(DOMHighResTimeStamp* timestamp,
|
||||
*cumulativeLost = ind->second.rtcp_stats.cumulative_lost;
|
||||
*bytesReceived = ind->second.rtp_stats.MediaPayloadBytes();
|
||||
*packetsReceived = ind->second.rtp_stats.transmitted.packets;
|
||||
int64_t rtt = mSendStream->GetRtt(); // TODO: BUG 1241066, mozRtt is 0 or 1
|
||||
if (rtt >= 0) {
|
||||
*rttMs = rtt;
|
||||
} else {
|
||||
*rttMs = 0;
|
||||
}
|
||||
int64_t rtt = mSendStream->GetRtt();
|
||||
#ifdef DEBUG
|
||||
if (rtt > INT32_MAX) {
|
||||
CSFLogError(logTag,
|
||||
@ -889,6 +884,11 @@ bool WebrtcVideoConduit::GetRTCPReceiverReport(DOMHighResTimeStamp* timestamp,
|
||||
" maximum size of an RTCP RTT.", __FUNCTION__, this);
|
||||
}
|
||||
#endif
|
||||
if (rtt > 0) {
|
||||
*rttMs = rtt;
|
||||
} else {
|
||||
*rttMs = 0;
|
||||
}
|
||||
// Note: timestamp is not correct per the spec... should be time the rtcp
|
||||
// was received (remote) or sent (local)
|
||||
*timestamp = webrtc::Clock::GetRealTimeClock()->TimeInMilliseconds();
|
||||
|
@ -267,11 +267,11 @@ EverySecondTelemetryCallback_s(nsAutoPtr<RTCStatsQueries> aQueryList) {
|
||||
}
|
||||
Accumulate(id, s.mJitter.Value());
|
||||
}
|
||||
if (s.mMozRtt.WasPassed()) {
|
||||
if (s.mRoundTripTime.WasPassed()) {
|
||||
MOZ_ASSERT(s.mIsRemote);
|
||||
HistogramID id = isAudio ? WEBRTC_AUDIO_QUALITY_OUTBOUND_RTT :
|
||||
WEBRTC_VIDEO_QUALITY_OUTBOUND_RTT;
|
||||
Accumulate(id, s.mMozRtt.Value());
|
||||
Accumulate(id, s.mRoundTripTime.Value());
|
||||
}
|
||||
if (lastInboundStats && s.mBytesReceived.WasPassed()) {
|
||||
auto& laststats = *lastInboundStats;
|
||||
|
@ -3640,7 +3640,9 @@ PeerConnectionImpl::ExecuteStatsQuery_s(RTCStatsQuery *query) {
|
||||
s.mPacketsReceived.Construct(packetsReceived);
|
||||
s.mBytesReceived.Construct(bytesReceived);
|
||||
s.mPacketsLost.Construct(packetsLost);
|
||||
s.mMozRtt.Construct(rtt);
|
||||
if (rtt > 0) {
|
||||
s.mRoundTripTime.Construct(rtt);
|
||||
}
|
||||
query->report->mInboundRTPStreamStats.Value().AppendElement(s,
|
||||
fallible);
|
||||
}
|
||||
|
@ -612,8 +612,8 @@ RTPStats.prototype = {
|
||||
|
||||
statsString += ` ${getString("lost_label")}: ${stats.packetsLost} ${getString("jitter_label")}: ${stats.jitter}`;
|
||||
|
||||
if (stats.mozRtt) {
|
||||
statsString += ` RTT: ${stats.mozRtt} ms`;
|
||||
if (stats.roundTripTime) {
|
||||
statsString += ` RTT: ${stats.roundTripTime} ms`;
|
||||
}
|
||||
} else if (stats.packetsSent) {
|
||||
statsString += ` ${getString("sent_label")}: ${stats.packetsSent} ${getString("packets")}`;
|
||||
|
Loading…
Reference in New Issue
Block a user