Bug 894150 - Unregister the PannerNode in the AudioListener when destroying the stream. r=ehsan

This commit is contained in:
Paul Adenot 2013-07-16 14:45:41 +02:00
parent f01bee06e9
commit 127e99dd3c
5 changed files with 18 additions and 0 deletions

View File

@ -401,6 +401,7 @@ void
AudioContext::UnregisterPannerNode(PannerNode* aNode)
{
mPannerNodes.RemoveEntry(aNode);
mListener->UnregisterPannerNode(aNode);
}
void

View File

@ -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)
{

View File

@ -127,6 +127,7 @@ public:
}
void RegisterPannerNode(PannerNode* aPannerNode);
void UnregisterPannerNode(PannerNode* aPannerNode);
private:
void SendDoubleParameterToStream(uint32_t aIndex, double aValue);

View File

@ -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)

View File

@ -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)