зеркало из https://github.com/mozilla/gecko-dev.git
Bug 894150 - Unregister the PannerNode in the AudioListener when destroying the stream. r=ehsan
This commit is contained in:
Родитель
57612af8ed
Коммит
e2823f5290
|
@ -401,6 +401,9 @@ void
|
|||
AudioContext::UnregisterPannerNode(PannerNode* aNode)
|
||||
{
|
||||
mPannerNodes.RemoveEntry(aNode);
|
||||
if (mListener) {
|
||||
mListener->UnregisterPannerNode(aNode);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -52,6 +52,11 @@ AudioListener::RegisterPannerNode(PannerNode* aPannerNode)
|
|||
UpdatePannersVelocity();
|
||||
}
|
||||
|
||||
void AudioListener::UnregisterPannerNode(PannerNode* aPannerNode)
|
||||
{
|
||||
mPanners.RemoveElement(aPannerNode);
|
||||
}
|
||||
|
||||
void
|
||||
AudioListener::SendDoubleParameterToStream(uint32_t aIndex, double aValue)
|
||||
{
|
||||
|
|
|
@ -127,6 +127,7 @@ public:
|
|||
}
|
||||
|
||||
void RegisterPannerNode(PannerNode* aPannerNode);
|
||||
void UnregisterPannerNode(PannerNode* aPannerNode);
|
||||
|
||||
private:
|
||||
void SendDoubleParameterToStream(uint32_t aIndex, double aValue);
|
||||
|
|
|
@ -212,6 +212,14 @@ PannerNode::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aScope)
|
|||
return PannerNodeBinding::Wrap(aCx, aScope, this);
|
||||
}
|
||||
|
||||
void PannerNode::DestroyMediaStream()
|
||||
{
|
||||
if (Context()) {
|
||||
Context()->UnregisterPannerNode(this);
|
||||
}
|
||||
AudioNode::DestroyMediaStream();
|
||||
}
|
||||
|
||||
// Those three functions are described in the spec.
|
||||
float
|
||||
PannerNodeEngine::LinearGainFunction(float aDistance)
|
||||
|
|
|
@ -31,9 +31,12 @@ public:
|
|||
explicit PannerNode(AudioContext* aContext);
|
||||
virtual ~PannerNode();
|
||||
|
||||
|
||||
virtual JSObject* WrapObject(JSContext* aCx,
|
||||
JS::Handle<JSObject*> aScope) MOZ_OVERRIDE;
|
||||
|
||||
virtual void DestroyMediaStream() MOZ_OVERRIDE;
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(PannerNode, AudioNode)
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@ MOCHITEST_FILES := \
|
|||
test_bug867203.html \
|
||||
test_bug875221.html \
|
||||
test_bug875402.html \
|
||||
test_bug894150.html \
|
||||
test_analyserNode.html \
|
||||
test_AudioBuffer.html \
|
||||
test_AudioContext.html \
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Test whether we can create an AudioContext interface</title>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
|
||||
var ac = AudioContext();
|
||||
ac.createPanner();
|
||||
var listener = ac.listener;
|
||||
SpecialPowers.forceGC();
|
||||
SpecialPowers.forceCC();
|
||||
listener.setOrientation(0, 0, -1, 0, 0, 0);
|
||||
|
||||
ok(true, "No crashes should happen!");
|
||||
|
||||
</script>
|
||||
</body>
|
Загрузка…
Ссылка в новой задаче