Backed out changeset 4cc3fae66ffb (bug 1250990) for frequent failure of modified test test_peerConnection_scaleResolution.html. r=frequentorange

This commit is contained in:
Sebastian Hengst 2016-02-28 09:59:16 +01:00
parent d4b0049e46
commit 06d19d0d14
2 changed files with 149 additions and 155 deletions

View File

@ -12,13 +12,6 @@
visible: true visible: true
}); });
var mustRejectWith = (msg, reason, f) =>
f().then(() => ok(false, msg),
e => is(e.name, reason, msg));
var removeVP8 = d => (d.sdp = d.sdp.replace("a=rtpmap:120 VP8/90000\r\n", ""), d);
function testScale(codec) {
var pc1 = new RTCPeerConnection(); var pc1 = new RTCPeerConnection();
var pc2 = new RTCPeerConnection(); var pc2 = new RTCPeerConnection();
@ -26,23 +19,26 @@
pc1.onicecandidate = e => add(pc2, e.candidate, generateErrorCallback()); pc1.onicecandidate = e => add(pc2, e.candidate, generateErrorCallback());
pc2.onicecandidate = e => add(pc1, e.candidate, generateErrorCallback()); pc2.onicecandidate = e => add(pc1, e.candidate, generateErrorCallback());
info("testing scaling with " + codec);
pc1.onnegotiationneeded = e => pc1.onnegotiationneeded = e =>
pc1.createOffer() pc1.createOffer().then(d => pc1.setLocalDescription(d))
.then(d => pc1.setLocalDescription(codec == "VP8" ? d : removeVP8(d)))
.then(() => pc2.setRemoteDescription(pc1.localDescription)) .then(() => pc2.setRemoteDescription(pc1.localDescription))
.then(() => pc2.createAnswer()).then(d => pc2.setLocalDescription(d)) .then(() => pc2.createAnswer()).then(d => pc2.setLocalDescription(d))
.then(() => pc1.setRemoteDescription(pc2.localDescription)) .then(() => pc1.setRemoteDescription(pc2.localDescription))
.catch(generateErrorCallback()); .catch(generateErrorCallback());
return navigator.mediaDevices.getUserMedia({ video: true }) var mustRejectWith = (msg, reason, f) =>
.then(stream => { f().then(() => ok(false, msg),
var v1 = createMediaElement('video', 'v1'); e => is(e.name, reason, msg));
var v2 = createMediaElement('video', 'v2'); var v1, v2;
runNetworkTest(function() {
v1 = createMediaElement('video', 'v1');
v2 = createMediaElement('video', 'v2');
is(v2.currentTime, 0, "v2.currentTime is zero at outset"); is(v2.currentTime, 0, "v2.currentTime is zero at outset");
navigator.mediaDevices.getUserMedia({ video: true })
.then(stream => {
v1.srcObject = stream; v1.srcObject = stream;
var sender = pc1.addTrack(stream.getVideoTracks()[0], stream); var sender = pc1.addTrack(stream.getVideoTracks()[0], stream);
@ -51,6 +47,7 @@
[{ scaleResolutionDownBy: 0.5 } ] })) [{ scaleResolutionDownBy: 0.5 } ] }))
.then(() => sender.setParameters({ encodings: [{ maxBitrate: 60000, .then(() => sender.setParameters({ encodings: [{ maxBitrate: 60000,
scaleResolutionDownBy: 2 }] })) scaleResolutionDownBy: 2 }] }))
})
.then(() => new Promise(resolve => pc2.ontrack = e => resolve(e))) .then(() => new Promise(resolve => pc2.ontrack = e => resolve(e)))
.then(e => v2.srcObject = e.streams[0]) .then(e => v2.srcObject = e.streams[0])
.then(() => new Promise(resolve => v2.onloadedmetadata = resolve)) .then(() => new Promise(resolve => v2.onloadedmetadata = resolve))
@ -63,16 +60,9 @@
is(v2.videoWidth, v1.videoWidth / 2, "sink is half the width of source"); is(v2.videoWidth, v1.videoWidth / 2, "sink is half the width of source");
is(v2.videoHeight, v1.videoHeight / 2, "sink is half the height of source"); is(v2.videoHeight, v1.videoHeight / 2, "sink is half the height of source");
}) })
.then(() => { .catch(generateErrorCallback())
stream.getTracks().forEach(track => track.stop()); .then(networkTestFinished);
v1.srcObject = v2.srcObject = null; });
})
})
.catch(generateErrorCallback());
}
runNetworkTest(() => testScale("VP8").then(() => testScale("H264"))
.then(networkTestFinished));
</script> </script>
</pre> </pre>
</body> </body>

View File

@ -1277,7 +1277,10 @@ WebrtcVideoConduit::ReconfigureSendCodec(unsigned short width,
CSFLogDebug(logTag, CSFLogDebug(logTag,
"%s: Requesting resolution change to %ux%u (from %ux%u)", "%s: Requesting resolution change to %ux%u (from %ux%u)",
__FUNCTION__, width, height, vie_codec.width, vie_codec.height); __FUNCTION__, width, height, vie_codec.width, vie_codec.height);
// Likely spurious unless there was some error, but rarely checked
if (vie_codec.width != width || vie_codec.height != height ||
vie_codec.maxFramerate != mSendingFramerate)
{
vie_codec.width = width; vie_codec.width = width;
vie_codec.height = height; vie_codec.height = height;
vie_codec.maxFramerate = mSendingFramerate; vie_codec.maxFramerate = mSendingFramerate;
@ -1347,6 +1350,7 @@ WebrtcVideoConduit::ReconfigureSendCodec(unsigned short width,
CSFLogDebug(logTag, "%s: Encoder resolution changed to %ux%u @ %ufps, bitrate %u:%u", CSFLogDebug(logTag, "%s: Encoder resolution changed to %ux%u @ %ufps, bitrate %u:%u",
__FUNCTION__, width, height, mSendingFramerate, __FUNCTION__, width, height, mSendingFramerate,
vie_codec.minBitrate, vie_codec.maxBitrate); vie_codec.minBitrate, vie_codec.maxBitrate);
} // else no change; mSendingWidth likely was 0
if (frame) { if (frame) {
// XXX I really don't like doing this from MainThread... // XXX I really don't like doing this from MainThread...
mPtrExtCapture->IncomingFrame(*frame); mPtrExtCapture->IncomingFrame(*frame);
@ -1860,8 +1864,7 @@ WebrtcVideoConduit::CodecConfigToWebRTCCodec(const VideoCodecConfig* codecInfo,
cinst.codecSpecific.H264.spsLen = 0; cinst.codecSpecific.H264.spsLen = 0;
cinst.codecSpecific.H264.ppsData = nullptr; cinst.codecSpecific.H264.ppsData = nullptr;
cinst.codecSpecific.H264.ppsLen = 0; cinst.codecSpecific.H264.ppsLen = 0;
} } else {
// Init mSimulcastEncodings always since they hold info from setParameters.
// TODO(bug 1210175): H264 doesn't support simulcast yet. // TODO(bug 1210175): H264 doesn't support simulcast yet.
for (size_t i = 0; i < codecInfo->mSimulcastEncodings.size(); ++i) { for (size_t i = 0; i < codecInfo->mSimulcastEncodings.size(); ++i) {
const VideoCodecConfig::SimulcastEncoding& encoding = const VideoCodecConfig::SimulcastEncoding& encoding =
@ -1911,6 +1914,7 @@ WebrtcVideoConduit::CodecConfigToWebRTCCodec(const VideoCodecConfig* codecInfo,
} }
cinst.numberOfSimulcastStreams = codecInfo->mSimulcastEncodings.size(); cinst.numberOfSimulcastStreams = codecInfo->mSimulcastEncodings.size();
}
} }
//Copy the codec passed into Conduit's database //Copy the codec passed into Conduit's database