зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1166832 - Add test to verify audio (using AudioStreamAnalyser) after renegotiation. r=bwc
--HG-- extra : transplant_source : %D1/%A9%C3%BBj%CF%28%E4AJ%86%40%F0%AB%2A%0B%DFR%40 extra : histedit_source : 92a5470e09a583ef5e0656d370edb7f0280817bf
This commit is contained in:
Родитель
13a82c11bf
Коммит
030aef859c
|
@ -209,6 +209,8 @@ 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)
|
||||
[test_peerConnection_verifyAudioAfterRenegotiation.html]
|
||||
skip-if = toolkit == 'gonk' || (android_version == '18' && debug) # B2G emulator is too slow to finish a renegotiation test in under 5 minutes, 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'
|
||||
|
|
|
@ -0,0 +1,123 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<script type="application/javascript" src="pc.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<pre id="test">
|
||||
<script type="application/javascript">
|
||||
createHTML({
|
||||
bug: "1166832",
|
||||
title: "Renegotiation: verify audio after renegotiation"
|
||||
});
|
||||
|
||||
var test;
|
||||
runNetworkTest(function (options) {
|
||||
test = new PeerConnectionTest(options);
|
||||
|
||||
var checkAudio = (analyser, fun) => {
|
||||
analyser.enableDebugCanvas();
|
||||
return analyser.waitForAnalysisSuccess(fun)
|
||||
.then(() => analyser.disableDebugCanvas());
|
||||
};
|
||||
var checkAudioEnabled = (analyser, freq) =>
|
||||
checkAudio(analyser, array => array[freq] > 200);
|
||||
var checkAudioDisabled = (analyser, freq) =>
|
||||
checkAudio(analyser, array => array[freq] < 50);
|
||||
|
||||
var ac = new AudioContext();
|
||||
var local1Analyser;
|
||||
var remote1Analyser;
|
||||
|
||||
test.chain.append([
|
||||
function CHECK_ASSUMPTIONS() {
|
||||
is(test.pcLocal.mediaElements.length, 1,
|
||||
"pcLocal should only have one media element");
|
||||
is(test.pcRemote.mediaElements.length, 1,
|
||||
"pcRemote should only have one media element");
|
||||
is(test.pcLocal.streams.length, 1,
|
||||
"pcLocal should only have one stream (the local one)");
|
||||
is(test.pcRemote.streams.length, 1,
|
||||
"pcRemote should only have one stream (the remote one)");
|
||||
},
|
||||
function CHECK_AUDIO() {
|
||||
local1Analyser = new AudioStreamAnalyser(ac, test.pcLocal.streams[0]);
|
||||
remote1Analyser = new AudioStreamAnalyser(ac, test.pcRemote.streams[0]);
|
||||
|
||||
freq1k = local1Analyser.binIndexForFrequency(1000);
|
||||
|
||||
return Promise.resolve()
|
||||
.then(() => info("Checking local audio enabled"))
|
||||
.then(() => checkAudioEnabled(local1Analyser, freq1k))
|
||||
.then(() => info("Checking remote audio enabled"))
|
||||
.then(() => checkAudioEnabled(remote1Analyser, freq1k))
|
||||
|
||||
.then(() => test.pcLocal.streams[0].getAudioTracks()[0].enabled = false)
|
||||
|
||||
.then(() => info("Checking local audio disabled"))
|
||||
.then(() => checkAudioDisabled(local1Analyser, freq1k))
|
||||
.then(() => info("Checking remote audio disabled"))
|
||||
.then(() => checkAudioDisabled(remote1Analyser, freq1k))
|
||||
}
|
||||
]);
|
||||
|
||||
addRenegotiation(test.chain,
|
||||
[
|
||||
function PC_LOCAL_ADD_SECOND_STREAM(test) {
|
||||
test.setMediaConstraints([{audio: true}],
|
||||
[]);
|
||||
return test.pcLocal.getAllUserMedia([{audio: true}]);
|
||||
},
|
||||
]
|
||||
);
|
||||
|
||||
test.chain.append([
|
||||
function CHECK_ASSUMPTIONS2() {
|
||||
is(test.pcLocal.mediaElements.length, 2,
|
||||
"pcLocal should have two media elements");
|
||||
is(test.pcRemote.mediaElements.length, 2,
|
||||
"pcRemote should have two media elements");
|
||||
is(test.pcLocal.streams.length, 2,
|
||||
"pcLocal should have two streams");
|
||||
is(test.pcRemote.streams.length, 2,
|
||||
"pcRemote should have two streams");
|
||||
},
|
||||
function RE_CHECK_AUDIO() {
|
||||
local2Analyser = new AudioStreamAnalyser(ac, test.pcLocal.streams[1]);
|
||||
remote2Analyser = new AudioStreamAnalyser(ac, test.pcRemote.streams[1]);
|
||||
|
||||
freq1k = local2Analyser.binIndexForFrequency(1000);
|
||||
|
||||
return Promise.resolve()
|
||||
.then(() => info("Checking local audio disabled"))
|
||||
.then(() => checkAudioDisabled(local1Analyser, freq1k))
|
||||
.then(() => info("Checking remote audio disabled"))
|
||||
.then(() => checkAudioDisabled(remote1Analyser, freq1k))
|
||||
|
||||
.then(() => info("Checking local2 audio enabled"))
|
||||
.then(() => checkAudioEnabled(local2Analyser, freq1k))
|
||||
.then(() => info("Checking remote2 audio enabled"))
|
||||
.then(() => checkAudioEnabled(remote2Analyser, freq1k))
|
||||
|
||||
.then(() => test.pcLocal.streams[1].getAudioTracks()[0].enabled = false)
|
||||
.then(() => test.pcLocal.streams[0].getAudioTracks()[0].enabled = true)
|
||||
|
||||
.then(() => info("Checking local2 audio disabled"))
|
||||
.then(() => checkAudioDisabled(local2Analyser, freq1k))
|
||||
.then(() => info("Checking remote2 audio disabled"))
|
||||
.then(() => checkAudioDisabled(remote2Analyser, freq1k))
|
||||
|
||||
.then(() => info("Checking local audio enabled"))
|
||||
.then(() => checkAudioEnabled(local1Analyser, freq1k))
|
||||
.then(() => info("Checking remote audio enabled"))
|
||||
.then(() => checkAudioEnabled(remote1Analyser, freq1k))
|
||||
}
|
||||
]);
|
||||
|
||||
test.setMediaConstraints([{audio: true}], []);
|
||||
test.run();
|
||||
});
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
Загрузка…
Ссылка в новой задаче