Backed out 3 changesets (bug 974089) for causing OSX/Windows test_bug867104.html permafail.

Backed out changeset 1dcfd15bb387 (bug 974089)
Backed out changeset 8c6a7d5efe3a (bug 974089)
Backed out changeset e511c79f2211 (bug 974089)

CLOSED TREE
This commit is contained in:
Ryan VanderMeulen 2015-06-11 15:10:06 -04:00
parent cceebdc03b
commit 28dc7495fc
6 changed files with 11 additions and 56 deletions

View File

@ -127,24 +127,18 @@ MediaStreamGraphImpl::AddStream(MediaStream* aStream)
}
void
MediaStreamGraphImpl::RemoveStream(MediaStream* aStream, bool aLocked)
MediaStreamGraphImpl::RemoveStream(MediaStream* aStream)
{
// Remove references in mStreamUpdates before we allow aStream to die.
// Pending updates are not needed (since the main thread has already given
// up the stream) so we will just drop them.
if (aLocked) {
{
MonitorAutoLock lock(mMonitor);
for (uint32_t i = 0; i < mStreamUpdates.Length(); ++i) {
if (mStreamUpdates[i].mStream == aStream) {
mStreamUpdates[i].mStream = nullptr;
}
}
} else {
for (uint32_t i = 0; i < mStreamUpdates.Length(); ++i) {
if (mStreamUpdates[i].mStream == aStream) {
mStreamUpdates[i].mStream = nullptr;
}
}
}
// Ensure that mFirstCycleBreaker and mMixer are updated when necessary.
@ -1278,8 +1272,7 @@ MediaStreamGraphImpl::PrepareUpdatesToMainThreadState(bool aFinalUpdate)
mStreamUpdates.SetCapacity(mStreamUpdates.Length() + mStreams.Length());
for (uint32_t i = 0; i < mStreams.Length(); ++i) {
MediaStream* stream = mStreams[i];
if (!stream->MainThreadNeedsUpdates() ||
!stream->mGraph) { // destroyed on mainthread
if (!stream->MainThreadNeedsUpdates()) {
continue;
}
StreamUpdate* update = mStreamUpdates.AppendElement();
@ -1549,9 +1542,8 @@ MediaStreamGraphImpl::ApplyStreamUpdate(StreamUpdate* aUpdate)
mMonitor.AssertCurrentThreadOwns();
MediaStream* stream = aUpdate->mStream;
if (!stream || stream->IsDestroyed()) {
if (!stream)
return;
}
stream->mMainThreadCurrentTime = aUpdate->mNextMainThreadCurrentTime;
stream->mMainThreadFinished = aUpdate->mNextMainThreadFinished;
@ -2095,14 +2087,7 @@ MediaStream::Destroy()
graph->RemoveStream(mStream);
}
virtual void RunDuringShutdown()
{
MOZ_ASSERT(NS_IsMainThread());
mStream->RemoveAllListenersImpl();
auto graph = mStream->GraphImpl();
mStream->DestroyImpl();
// Don't acquire the lock, this is during shutdown
graph->RemoveStream(mStream, false);
}
{ Run(); }
};
mWrapper = nullptr;
GraphImpl()->AppendMessage(new Message(this));

View File

@ -441,7 +441,7 @@ public:
* Remove aStream from the graph. Ensures that pending messages about the
* stream back to the main thread are flushed.
*/
void RemoveStream(MediaStream* aStream, bool aLocked = true);
void RemoveStream(MediaStream* aStream);
/**
* Remove aPort from the graph and release it.
*/

View File

@ -643,9 +643,7 @@ void
AudioBufferSourceNode::SendBufferParameterToStream(JSContext* aCx)
{
AudioNodeStream* ns = static_cast<AudioNodeStream*>(mStream.get());
if (!mStream) {
return;
}
MOZ_ASSERT(ns, "Why don't we have a stream here?");
if (mBuffer) {
float rate = mBuffer->SampleRate();
@ -729,11 +727,6 @@ AudioBufferSourceNode::NotifyMainThreadStreamFinished()
}
mNode->DispatchTrustedEvent(NS_LITERAL_STRING("ended"));
// Release stream resources.
//
// DestroyMediaStream() will remove this stream listener.
mNode->DestroyMediaStream();
return NS_OK;
}
private:
@ -751,9 +744,6 @@ void
AudioBufferSourceNode::SendPlaybackRateToStream(AudioNode* aNode)
{
AudioBufferSourceNode* This = static_cast<AudioBufferSourceNode*>(aNode);
if (!This->mStream) {
return;
}
SendTimelineParameterToStream(This, PLAYBACKRATE, *This->mPlaybackRate);
}
@ -767,16 +757,12 @@ AudioBufferSourceNode::SendDetuneToStream(AudioNode* aNode)
void
AudioBufferSourceNode::SendDopplerShiftToStream(double aDopplerShift)
{
MOZ_ASSERT(mStream, "Should have disconnected panner if no stream");
SendDoubleParameterToStream(DOPPLERSHIFT, aDopplerShift);
}
void
AudioBufferSourceNode::SendLoopParametersToStream()
{
if (!mStream) {
return;
}
// Don't compute and set the loop parameters unnecessarily
if (mLoop && mBuffer) {
float rate = mBuffer->SampleRate();

View File

@ -352,12 +352,10 @@ AudioNode::Disconnect(uint32_t aOutput, ErrorResult& aRv)
// Remove one instance of 'dest' from mOutputNodes. There could be
// others, and it's not correct to remove them all since some of them
// could be for different output ports.
nsRefPtr<AudioNode> output = mOutputNodes[i].forget();
nsCOMPtr<nsIRunnable> runnable =
new RunnableRelease(mOutputNodes[i].forget());
mOutputNodes.RemoveElementAt(i);
if (mStream) {
nsRefPtr<nsIRunnable> runnable = new RunnableRelease(output.forget());
mStream->RunAfterPendingUpdates(runnable.forget());
}
mStream->RunAfterPendingUpdates(runnable.forget());
break;
}
}

View File

@ -220,7 +220,7 @@ private:
nsRefPtr<AudioContext> mContext;
protected:
// Must be set in the constructor. Must not be null unless finished.
// Must be set in the constructor. Must not be null.
// If MaxNumberOfInputs() is > 0, then mStream must be a ProcessedMediaStream.
nsRefPtr<MediaStream> mStream;

View File

@ -425,9 +425,6 @@ void
OscillatorNode::SendFrequencyToStream(AudioNode* aNode)
{
OscillatorNode* This = static_cast<OscillatorNode*>(aNode);
if (!This->mStream) {
return;
}
SendTimelineParameterToStream(This, OscillatorNodeEngine::FREQUENCY, *This->mFrequency);
}
@ -435,18 +432,12 @@ void
OscillatorNode::SendDetuneToStream(AudioNode* aNode)
{
OscillatorNode* This = static_cast<OscillatorNode*>(aNode);
if (!This->mStream) {
return;
}
SendTimelineParameterToStream(This, OscillatorNodeEngine::DETUNE, *This->mDetune);
}
void
OscillatorNode::SendTypeToStream()
{
if (!mStream) {
return;
}
if (mType == OscillatorType::Custom) {
// The engine assumes we'll send the custom data before updating the type.
SendPeriodicWaveToStream();
@ -538,11 +529,6 @@ OscillatorNode::NotifyMainThreadStreamFinished()
}
mNode->DispatchTrustedEvent(NS_LITERAL_STRING("ended"));
// Release stream resources.
// DestroyMediaStream() will remove this stream listener.
mNode->DestroyMediaStream();
return NS_OK;
}
private: