Bug 1207546 - Integrate WebRTC with audio channels, r=roc

This commit is contained in:
Andrea Marchesini 2015-11-21 01:03:20 +00:00
parent 94ba1d4d1d
commit 56bdf487dc
4 changed files with 79 additions and 1 deletions

View File

@ -272,6 +272,8 @@ skip-if = buildapp == 'b2g' # Requires webgl support
[test_audioWindowUtils.html]
[test_audioNotification.html]
skip-if = buildapp == 'mulet'
[test_audioNotificationStream.html]
skip-if = buildapp == 'mulet'
[test_audioNotificationStopOnNavigation.html]
skip-if = buildapp == 'mulet'
[test_audioNotificationWithEarlyPlay.html]

View File

@ -0,0 +1,71 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Test for audio controller in windows</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<pre id="test">
</pre>
<script type="application/javascript">
SimpleTest.waitForExplicitFinish();
var expectedNotification = null;
var observer = {
observe: function(subject, topic, data) {
is(topic, "audio-playback", "audio-playback received");
is(data, expectedNotification, "This is the right notification");
runTest();
}
};
var observerService = SpecialPowers.Cc["@mozilla.org/observer-service;1"]
.getService(SpecialPowers.Ci.nsIObserverService);
var audio = new Audio();
audio.srcObject = (new AudioContext()).createMediaStreamDestination().stream;
var tests = [
function() {
observerService.addObserver(observer, "audio-playback", false);
ok(true, "Observer set");
runTest();
},
function() {
expectedNotification = 'active';
audio.play();
},
function() {
expectedNotification = 'inactive';
audio.pause();
},
function() {
observerService.removeObserver(observer, "audio-playback");
ok(true, "Observer removed");
runTest();
}
];
function runTest() {
if (!tests.length) {
SimpleTest.finish();
return;
}
var test = tests.shift();
test();
}
runTest();
</script>
</body>
</html>

View File

@ -1,5 +1,5 @@
# WebGL Reftests!
default-preferences pref(webgl.force-enabled,true)
default-preferences pref(webgl.force-enabled,true) pref(media.useAudioChannelAPI,true) pref(dom.audiochannel.mutedByDefault,false)
# Check that disabling works:
== webgl-disable-test.html?nogl wrapper.html?green.png

View File

@ -4777,6 +4777,11 @@ HTMLMediaElement::IsPlayingThroughTheAudioChannel() const
return true;
}
// If we are playing an external stream.
if (mSrcAttrStream) {
return true;
}
return false;
}