b=967992 collect unreferenced AudioBufferSourceNodes with no buffer r=padenot

The playing ref now only exists while there is a buffer.
We don't currently dispatch ended events when there is no buffer.

--HG--
extra : transplant_source : Ba%0BRD%89%96%99%F14%B6%40%3D%B2%C1%D5%28%D6%15%12
This commit is contained in:
Karl Tomlinson 2014-02-06 08:33:16 +13:00
parent f1c8b044ec
commit 38594bd8de

View File

@ -537,8 +537,6 @@ AudioBufferSourceNode::Start(double aWhen, double aOffset,
if (aWhen > 0.0) {
ns->SetStreamTimeParameter(START, Context(), aWhen);
}
MarkActive();
}
void
@ -559,6 +557,8 @@ AudioBufferSourceNode::SendBufferParameterToStream(JSContext* aCx)
}
} else {
ns->SetBuffer(nullptr);
MarkInactive();
}
}
@ -582,6 +582,8 @@ AudioBufferSourceNode::SendOffsetAndDurationParametersToStream(AudioNodeStream*
offsetSamples + NS_lround(mDuration * rate));
}
aStream->SetInt32Parameter(BUFFEREND, bufferEnd);
MarkActive();
}
void
@ -597,12 +599,6 @@ AudioBufferSourceNode::Stop(double aWhen, ErrorResult& aRv)
return;
}
if (!mBuffer) {
// We don't have a buffer, so the stream is never marked as finished.
// Therefore we need to drop our playing ref right now.
MarkInactive();
}
AudioNodeStream* ns = static_cast<AudioNodeStream*>(mStream.get());
if (!ns || !Context()) {
// We've already stopped and had our stream shut down