mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 05:41:12 +00:00
Bug 1166832 - Add test to verify video (using capture stream) after renegotiation. r=bwc
--HG-- extra : transplant_source : I%AB%28%AA%D6%91%8F%CA5%8A%D9%0C%F2%8A%CD%B8m%DE%D7%05 extra : histedit_source : 1d30b92a3c6d128c24cfbb1f8778c665a6bb9eca
This commit is contained in:
parent
6abe3c833c
commit
13a82c11bf
@ -209,10 +209,11 @@ skip-if = toolkit == 'gonk' || android_version == '18'
|
||||
skip-if = toolkit == 'gonk' # B2G emulator seems to be so slow that DTLS cannot establish properly
|
||||
[test_peerConnection_addDataChannelNoBundle.html]
|
||||
skip-if = toolkit == 'gonk' || (android_version == '18' && debug) # b2g(emulator seems to be so slow that DTLS cannot establish properly), android(bug 1240256, intermittent ICE failures starting w/bug 1232082, possibly from timeout)
|
||||
|
||||
# b2g(Bug 960442, video support for WebRTC is disabled on b2g), android(Bug 1189784, timeouts on 4.3 emulator)
|
||||
|
||||
[test_peerConnection_verifyVideoAfterRenegotiation.html]
|
||||
# B2G emulator is too slow to finish a renegotiation test in under 5 minutes, Bug 1180000 for Linux debug e10s, android(Bug 1189784, timeouts on 4.3 emulator)
|
||||
skip-if = toolkit == 'gonk' || android_version == '18'
|
||||
[test_peerConnection_webAudio.html]
|
||||
# b2g(Bug 960442, video support for WebRTC is disabled on b2g), android(Bug 1189784, timeouts on 4.3 emulator)
|
||||
tags = webaudio webrtc
|
||||
skip-if = toolkit == 'gonk' || buildapp == 'mulet' # b2g (Bug 1059867)
|
||||
[test_peerConnection_localRollback.html]
|
||||
|
@ -0,0 +1,100 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<script type="application/javascript" src="pc.js"></script>
|
||||
<script type="application/javascript" src="/tests/dom/canvas/test/captureStream_common.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<pre id="test">
|
||||
<script type="application/javascript">
|
||||
createHTML({
|
||||
bug: "1166832",
|
||||
title: "Renegotiation: verify video after renegotiation"
|
||||
});
|
||||
|
||||
runNetworkTest(() => {
|
||||
var test = new PeerConnectionTest();
|
||||
|
||||
var h1 = new CaptureStreamTestHelper2D(50, 50);
|
||||
var canvas1 = h1.createAndAppendElement('canvas', 'source_canvas1');
|
||||
var stream1;
|
||||
var vremote1;
|
||||
|
||||
var h2 = new CaptureStreamTestHelper2D(50, 50);
|
||||
var canvas2;
|
||||
var stream2;
|
||||
var vremote2;
|
||||
|
||||
test.setMediaConstraints([{video: true}], []);
|
||||
test.chain.replace("PC_LOCAL_GUM", [
|
||||
function DRAW_INITIAL_LOCAL_GREEN(test) {
|
||||
h1.drawColor(canvas1, h1.green);
|
||||
},
|
||||
function PC_LOCAL_CANVAS_CAPTURESTREAM(test) {
|
||||
stream1 = canvas1.captureStream(0);
|
||||
test.pcLocal.attachMedia(stream1, 'video', 'local');
|
||||
}
|
||||
]);
|
||||
|
||||
test.chain.append([
|
||||
function FIND_REMOTE_VIDEO() {
|
||||
vremote1 = document.getElementById('pcRemote_remote1_video');
|
||||
ok(!!vremote1, "Should have remote video element for pcRemote");
|
||||
},
|
||||
function WAIT_FOR_REMOTE_GREEN() {
|
||||
return h1.waitForPixelColor(vremote1, h1.green, 128,
|
||||
"pcRemote's remote should become green");
|
||||
},
|
||||
function DRAW_LOCAL_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.
|
||||
stream1.requestFrame();
|
||||
h1.drawColor(canvas1, h1.red);
|
||||
},
|
||||
function WAIT_FOR_REMOTE_RED() {
|
||||
return h1.waitForPixelColor(vremote1, h1.red, 128,
|
||||
"pcRemote's remote should become red");
|
||||
}
|
||||
]);
|
||||
|
||||
addRenegotiation(test.chain,
|
||||
[
|
||||
function PC_LOCAL_ADD_SECOND_STREAM(test) {
|
||||
canvas2 = h2.createAndAppendElement('canvas', 'source_canvas2');
|
||||
h2.drawColor(canvas2, h2.blue);
|
||||
stream2 = canvas2.captureStream(0);
|
||||
|
||||
// can't use test.pcLocal.getAllUserMedia([{video: true}]);
|
||||
// because it doesn't let us substitute the capture stream
|
||||
return test.pcLocal.attachMedia(stream2, 'video', 'local');
|
||||
}
|
||||
]
|
||||
);
|
||||
|
||||
test.chain.append([
|
||||
function FIND_REMOTE2_VIDEO() {
|
||||
vremote2 = document.getElementById('pcRemote_remote2_video');
|
||||
ok(!!vremote2, "Should have remote2 video element for pcRemote");
|
||||
},
|
||||
function WAIT_FOR_REMOTE2_BLUE() {
|
||||
return h2.waitForPixelColor(vremote2, h2.blue, 128,
|
||||
"pcRemote's remote2 should become blue");
|
||||
},
|
||||
function DRAW_NEW_LOCAL_GREEN(test) {
|
||||
stream1.requestFrame();
|
||||
h1.drawColor(canvas1, h1.green);
|
||||
},
|
||||
function WAIT_FOR_REMOTE1_GREEN() {
|
||||
return h1.waitForPixelColor(vremote1, h1.green, 128,
|
||||
"pcRemote's remote1 should become green");
|
||||
}
|
||||
]);
|
||||
|
||||
test.run();
|
||||
});
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
@ -1144,6 +1144,8 @@ WebrtcVideoConduit::SelectSendResolution(unsigned short width,
|
||||
bool changed = false;
|
||||
if (mSendingWidth != width || mSendingHeight != height)
|
||||
{
|
||||
CSFLogDebug(logTag, "%s: resolution changing to %ux%u (from %ux%u)",
|
||||
__FUNCTION__, width, height, mSendingWidth, mSendingHeight);
|
||||
// This will avoid us continually retrying this operation if it fails.
|
||||
// If the resolution changes, we'll try again. In the meantime, we'll
|
||||
// keep using the old size in the encoder.
|
||||
@ -1155,6 +1157,8 @@ WebrtcVideoConduit::SelectSendResolution(unsigned short width,
|
||||
// uses mSendingWidth/Height
|
||||
unsigned int framerate = SelectSendFrameRate(mSendingFramerate);
|
||||
if (mSendingFramerate != framerate) {
|
||||
CSFLogDebug(logTag, "%s: framerate changing to %u (from %u)",
|
||||
__FUNCTION__, framerate, mSendingFramerate);
|
||||
mSendingFramerate = framerate;
|
||||
changed = true;
|
||||
}
|
||||
@ -1221,6 +1225,10 @@ WebrtcVideoConduit::ReconfigureSendCodec(unsigned short width,
|
||||
CSFLogError(logTag, "%s: GetSendCodec failed, err %d", __FUNCTION__, err);
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
CSFLogDebug(logTag,
|
||||
"%s: Requesting resolution change to %ux%u (from %ux%u)",
|
||||
__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)
|
||||
@ -1399,6 +1407,8 @@ WebrtcVideoConduit::SendVideoFrame(webrtc::I420VideoFrame& frame)
|
||||
return kMediaConduitNoError;
|
||||
}
|
||||
if (frame.width() != mLastWidth || frame.height() != mLastHeight) {
|
||||
CSFLogDebug(logTag, "%s: call SelectSendResolution with %ux%u",
|
||||
__FUNCTION__, frame.width(), frame.height());
|
||||
if (SelectSendResolution(frame.width(), frame.height(), &frame)) {
|
||||
// SelectSendResolution took ownership of the data in i420_frame.
|
||||
// Submit the frame after reconfig is done
|
||||
|
Loading…
Reference in New Issue
Block a user