[WebRTC] updated to upstream branch 49 and related.

this patch is based on 38d7a7883...226f2f0bd
This commit is contained in:
roytam1 2021-10-01 10:48:39 +08:00
commit a3239eaa4d
2838 changed files with 151221 additions and 159688 deletions

View file

@ -42,7 +42,6 @@ skip-if = android_version == '18' # android(Bug 1189784, timeouts on 4.3 emulato
skip-if = true # needed by test_enumerateDevices.html on builders
[test_ondevicechange.html]
skip-if = os == 'android'
[test_getUserMedia_active_autoplay.html]
[test_getUserMedia_audioCapture.html]
skip-if = android_version == '18' # android(Bug 1189784, timeouts on 4.3 emulator)
[test_getUserMedia_addTrackRemoveTrack.html]
@ -99,7 +98,7 @@ skip-if = toolkit == 'android' # websockets don't work on android (bug 1266217)
[test_peerConnection_basicAudioNATRelayTCP.html]
skip-if = toolkit == 'android' # websockets don't work on android (bug 1266217)
[test_peerConnection_basicAudioRequireEOC.html]
skip-if = (android_version == '18' && debug) # android(Bug 1189784, timeouts on 4.3 emulator)
skip-if = (android_version == '18') # android(Bug 1189784, timeouts on 4.3 emulator)
[test_peerConnection_basicAudioPcmaPcmuOnly.html]
skip-if = android_version == '18'
[test_peerConnection_basicAudioDynamicPtMissingRtpmap.html]
@ -127,7 +126,7 @@ skip-if = os == 'android' # bug 1043403
[test_peerConnection_bug822674.html]
[test_peerConnection_bug825703.html]
[test_peerConnection_bug827843.html]
skip-if = (android_version == '18' && debug) # android(Bug 1189784, timeouts on 4.3 emulator)
skip-if = (android_version == '18') # android(Bug 1189784, timeouts on 4.3 emulator)
[test_peerConnection_bug834153.html]
[test_peerConnection_bug1013809.html]
skip-if = (android_version == '18') # android(Bug 1189784, timeouts on 4.3 emulator)

View file

@ -1415,13 +1415,17 @@ PeerConnectionWrapper.prototype = {
* A promise that resolves when media is flowing.
*/
waitForRtpFlow(track) {
var hasFlow = stats => {
var rtp = stats.get([...stats.keys()].find(key =>
var hasFlow = (stats, retries) => {
info("Checking for stats in " + JSON.stringify(stats) + " for " + track.kind
+ " track " + track.id + ", retry number " + retries);
var rtp = stats.get([...Object.keys(stats)].find(key =>
!stats.get(key).isRemote && stats.get(key).type.endsWith("boundrtp")));
ok(rtp, "Should have RTP stats for track " + track.id);
if (!rtp) {
return false;
}
info("Should have RTP stats for track " + track.id);
info("RTP stats: "+JSON.stringify(rtp));
var nrPackets = rtp[rtp.type == "outboundrtp" ? "packetsSent"
: "packetsReceived"];
info("Track " + track.id + " has " + nrPackets + " " +
@ -1429,12 +1433,44 @@ PeerConnectionWrapper.prototype = {
return nrPackets > 0;
};
info("Checking RTP packet flow for track " + track.id);
// Time between stats checks
var retryInterval = 500;
// Timeout in ms
var timeoutInterval = 30000;
// Check hasFlow at a reasonable interval
var checkStats = new Promise((resolve, reject)=>{
var retries = 0;
var timer = setInterval(()=>{
this._pc.getStats(track).then(stats=>{
if (hasFlow(stats, retries)) {
clearInterval(timer);
ok(true, "RTP flowing for " + track.kind + " track " + track.id);
resolve();
}
retries = retries + 1;
// This is not accurate but it will tear down
// the timer eventually and probably not
// before timeoutInterval has elapsed.
if ((retries * retryInterval) > timeoutInterval) {
clearInterval(timer);
}
});
}, retryInterval);
});
var retry = (delay) => this._pc.getStats(track)
.then(stats => hasFlow(stats)? ok(true, "RTP flowing for track " + track.id) :
wait(delay).then(retry(1000)));
return retry(200);
info("Checking RTP packet flow for track " + track.id);
var retry = Promise.race([checkStats.then(new Promise((resolve, reject)=>{
info("checkStats completed for " + track.kind + " track " + track.id);
resolve();
})),
new Promise((accept,reject)=>wait(timeoutInterval).then(()=>{
info("Timeout checking for stats for track " + track.id + " after " + timeoutInterval + "ms");
reject("Timeout checking for stats for " + track.kind
+ " track " + track.id + " after " + timeoutInterval + "ms");
})
)]);
return retry;
},
/**
@ -1536,7 +1572,9 @@ PeerConnectionWrapper.prototype = {
var minimum = this.whenCreated - 1000; // on Windows XP (Bug 979649)
if (isWinXP) {
todo(false, "Can't reliably test rtcp timestamps on WinXP (Bug 979649)");
} else if (!twoMachines) {
} else if (false) { // Bug 1325430 - timestamps aren't working properly in update 49
// else if (!twoMachines) {
// Bug 1225729: On android, sometimes the first RTCP of the first
// test run gets this value, likely because no RTP has been sent yet.
if (res.timestamp != 2085978496000) {
@ -1584,8 +1622,17 @@ PeerConnectionWrapper.prototype = {
ok(rem.packetsReceived !== undefined, "Rtcp packetsReceived");
ok(rem.packetsLost !== undefined, "Rtcp packetsLost");
ok(rem.bytesReceived >= rem.packetsReceived, "Rtcp bytesReceived");
if (!this.disableRtpCountChecking) {
ok(rem.packetsReceived <= res.packetsSent, "No more than sent packets");
if (false) { // Bug 1325430 if (!this.disableRtpCountChecking) {
// no guarantee which one is newer!
// Note: this must change when we add a timestamp field to remote RTCP reports
// and make rem.timestamp be the reception time
if (res.timestamp >= rem.timestamp) {
ok(rem.packetsReceived <= res.packetsSent, "No more than sent packets");
} else {
info("REVERSED timestamps: rec:" +
rem.packetsReceived + " time:" + rem.timestamp + " sent:" + res.packetsSent + " time:" + res.timestamp);
}
// Else we may have received more than outdated Rtcp packetsSent
ok(rem.bytesReceived <= res.bytesSent, "No more than sent bytes");
}
ok(rem.jitter !== undefined, "Rtcp jitter");

View file

@ -46,6 +46,18 @@ runNetworkTest(() => {
// i.e., this order of `requestFrame(); draw();` should work.
stream.requestFrame();
h.drawColor(canvas, h.red);
var i = 0;
return setInterval(function() {
try {
info("draw " + i ? "green" : "red");
h.drawColor(canvas, i ? h.green : h.red);
i = 1 - i;
stream.requestFrame();
} catch (e) {
// ignore; stream might have shut down, and we don't bother clearing
// the setInterval.
}
}, 500);
},
function PC_REMOTE_WAIT_FOR_REMOTE_RED() {
return h.waitForPixelColor(mediaElement, h.red, 128,

View file

@ -52,7 +52,7 @@ runNetworkTest(() => {
if (!program) {
ok(false, "Program should link");
return Promise.reject();
return Promise.reject("Program should link");
}
gl.useProgram(program);
@ -100,6 +100,16 @@ runNetworkTest(() => {
},
function DRAW_LOCAL_RED() {
h.drawColor(canvas, h.red);
return setInterval(function() {
try {
info("draw");
h.drawColor(canvas, h.red);
test.pcLocal.canvasStream.requestFrame();
} catch (e) {
// ignore; stream might have shut down, and we don't bother clearing
// the setInterval.
}
}, 500);
},
function WAIT_FOR_REMOTE_RED() {
return h.waitForPixelColor(vremote, h.red, 128,

View file

@ -72,15 +72,38 @@ runNetworkTest(() => {
// After requesting a frame it will be captured at the time of next render.
// Next render will happen at next stable state, at the earliest,
// i.e., this order of `requestFrame(); draw();` should work.
stream1.requestFrame();
h.drawColor(canvas1, h.red);
stream1.requestFrame();
var i = 0;
return setInterval(function() {
try {
info("draw " + i ? "green" : "red");
h.drawColor(canvas1, i ? h.green : h.red);
i = 1 - i;
stream1.requestFrame();
} catch (e) {
// ignore; stream might have shut down, and we don't bother clearing
// the setInterval.
}
}, 500);
},
function DRAW_LOCAL2_RED() {
// After requesting a frame it will be captured at the time of next render.
// Next render will happen at next stable state, at the earliest,
// i.e., this order of `requestFrame(); draw();` should work.
stream2.requestFrame();
h.drawColor(canvas2, h.red);
stream2.requestFrame();
return setInterval(function() {
try {
info("draw");
h.drawColor(canvas2, i ? h.green : h.red);
i = 1 - i;
stream2.requestFrame();
} catch (e) {
// ignore; stream might have shut down, and we don't bother clearing
// the setInterval.
}
}, 500);
},
function WAIT_FOR_REMOTE1_RED() {
return h.waitForPixelColor(vremote1, h.red, 128,

View file

@ -63,7 +63,8 @@
test.originalOffer.sdp, test._remote_answer.sdp);
info("Answer with RIDs: " + JSON.stringify(test._remote_answer));
ok(test._remote_answer.sdp.match(/a=simulcast:/), "Modified answer has simulcast");
ok(test._remote_answer.sdp.match(/a=rid:/), "Modified answer has rid");
ok(test._remote_answer.sdp.match(/a=rid:foo/), "Modified answer has rid foo");
ok(test._remote_answer.sdp.match(/a=rid:bar/), "Modified answer has rid bar");
}
]);
@ -118,18 +119,8 @@
ok(vremote, "Should have remote video element for pcRemote");
ok(vlocal.videoWidth > 0, "source width is positive");
ok(vlocal.videoHeight > 0, "source height is positive");
is(vremote.videoWidth, vlocal.videoWidth / 2, "sink is 1/2 width of source");
is(vremote.videoHeight, vlocal.videoHeight / 2, "sink is 1/2 height of source");
},
function PC_REMOTE_SET_RTP_NONEXISTENT_RID(test) {
// Now, cause pcRemote to filter out everything, just to make sure
// selectRecvSsrc is working.
selectRecvSsrc(test.pcRemote, 2);
},
function PC_REMOTE_ENSURE_NO_FRAMES() {
var vremote = test.pcRemote.remoteMediaElements[0];
ok(vremote, "Should have remote video element for pcRemote");
return helper.verifyNoFrames(vremote);
is(vremote.videoWidth, vlocal.videoWidth, "sink is same width as source");
is(vremote.videoHeight, vlocal.videoHeight, "sink is same height as source");
},
]);

View file

@ -51,6 +51,18 @@ runNetworkTest(() => {
// i.e., this order of `requestFrame(); draw();` should work.
stream1.requestFrame();
h1.drawColor(canvas1, h1.red);
var i = 0;
return setInterval(function() {
try {
info("draw " + i ? "green" : "red");
h1.drawColor(canvas1, i ? h1.green : h1.red);
i = 1 - i;
stream1.requestFrame();
} catch (e) {
// ignore; stream might have shut down, and we don't bother clearing
// the setInterval.
}
}, 500);
},
function WAIT_FOR_REMOTE_RED() {
return h1.waitForPixelColor(vremote1, h1.red, 128,