зеркало из https://github.com/mozilla/gecko-dev.git
b=914030 keep a self reference on destination while offline context is rendering r=ehsan
--HG-- extra : transplant_source : %FAk%98%E7%CB%2C%C6uf%EE%F4%CFq%3D%A7%D1%D6%E9%F1%29
This commit is contained in:
Родитель
501043ae47
Коммит
d42a4b06c8
|
@ -552,7 +552,7 @@ AudioContext::Shutdown()
|
||||||
|
|
||||||
// For offline contexts, we can destroy the MediaStreamGraph at this point.
|
// For offline contexts, we can destroy the MediaStreamGraph at this point.
|
||||||
if (mIsOffline) {
|
if (mIsOffline) {
|
||||||
mDestination->DestroyGraph();
|
mDestination->OfflineShutdown();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -125,12 +125,13 @@ public:
|
||||||
AudioNode* node = mStream->Engine()->Node();
|
AudioNode* node = mStream->Engine()->Node();
|
||||||
if (node) {
|
if (node) {
|
||||||
context = node->Context();
|
context = node->Context();
|
||||||
|
MOZ_ASSERT(context, "node hasn't kept context alive");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!context) {
|
if (!context) {
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
context->Shutdown();
|
context->Shutdown(); // drops self reference
|
||||||
|
|
||||||
AutoPushJSContext cx(context->GetJSContext());
|
AutoPushJSContext cx(context->GetJSContext());
|
||||||
if (cx) {
|
if (cx) {
|
||||||
|
@ -281,11 +282,13 @@ AudioDestinationNode::Unmute()
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
AudioDestinationNode::DestroyGraph()
|
AudioDestinationNode::OfflineShutdown()
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(Context() && Context()->IsOffline(),
|
MOZ_ASSERT(Context() && Context()->IsOffline(),
|
||||||
"Should only be called on a valid OfflineAudioContext");
|
"Should only be called on a valid OfflineAudioContext");
|
||||||
|
|
||||||
MediaStreamGraph::DestroyNonRealtimeInstance(mStream->Graph());
|
MediaStreamGraph::DestroyNonRealtimeInstance(mStream->Graph());
|
||||||
|
mOfflineRenderingRef.Drop(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
JSObject*
|
JSObject*
|
||||||
|
@ -297,6 +300,7 @@ AudioDestinationNode::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aScope)
|
||||||
void
|
void
|
||||||
AudioDestinationNode::StartRendering()
|
AudioDestinationNode::StartRendering()
|
||||||
{
|
{
|
||||||
|
mOfflineRenderingRef.Take(this);
|
||||||
mStream->Graph()->StartNonRealtimeProcessing(mFramesToProduce);
|
mStream->Graph()->StartNonRealtimeProcessing(mFramesToProduce);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -46,9 +46,10 @@ public:
|
||||||
|
|
||||||
void StartRendering();
|
void StartRendering();
|
||||||
|
|
||||||
void DestroyGraph();
|
void OfflineShutdown();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
SelfReference<AudioDestinationNode> mOfflineRenderingRef;
|
||||||
uint32_t mFramesToProduce;
|
uint32_t mFramesToProduce;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче