Bug 856771 - Protect the source buffer nodes from leaking when their binding goes away without being played back; r=roc

This commit is contained in:
Ehsan Akhgari 2013-04-01 16:06:55 -04:00
parent 05355e60c2
commit 9c134ee172
5 changed files with 40 additions and 2 deletions

View File

@ -146,8 +146,14 @@ AudioBlockPanStereoToStereo(const float aInputL[WEBAUDIO_BLOCK_SIZE],
*/
class AudioNodeEngine {
public:
AudioNodeEngine() {}
virtual ~AudioNodeEngine() {}
AudioNodeEngine()
{
MOZ_COUNT_CTOR(AudioNodeEngine);
}
virtual ~AudioNodeEngine()
{
MOZ_COUNT_DTOR(AudioNodeEngine);
}
virtual void SetStreamTimeParameter(uint32_t aIndex, TrackTicks aParam)
{

View File

@ -22,6 +22,7 @@ static const int AUDIO_NODE_STREAM_TRACK_ID = 1;
AudioNodeStream::~AudioNodeStream()
{
MOZ_COUNT_DTOR(AudioNodeStream);
}
void

View File

@ -50,6 +50,7 @@ public:
{
// AudioNodes are always producing data
mHasCurrentData = true;
MOZ_COUNT_CTOR(AudioNodeStream);
}
~AudioNodeStream();

View File

@ -16,6 +16,7 @@ MOCHITEST_FILES := \
test_bug827541.html \
test_bug839753.html \
test_bug845960.html \
test_bug856771.html \
test_analyserNode.html \
test_AudioBuffer.html \
test_AudioContext.html \

View File

@ -0,0 +1,29 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Test for bug 856771</title>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<pre id="test">
<script class="testbody" type="text/javascript">
SimpleTest.waitForExplicitFinish();
addLoadEvent(function() {
SpecialPowers.setBoolPref("media.webaudio.enabled", true);
var context = new AudioContext();
var source = context.createBufferSource();
source.connect(context.destination);
ok(true, "Nothing should leak");
SpecialPowers.clearUserPref("media.webaudio.enabled");
SimpleTest.finish();
});
</script>
</pre>
</body>
</html>