Bug 804387. Part 10: Add a mechanism for ensuring that we don't attempt to allocate an input port if the input node is not hooked up to MSG yet. r=roc

This commit is contained in:
Ehsan Akhgari 2013-01-25 16:39:51 -05:00
parent 41a1e70799
commit 147214ed9d
3 changed files with 19 additions and 6 deletions

View File

@ -28,6 +28,10 @@ public:
} }
AudioSourceNode::DestroyMediaStream(); AudioSourceNode::DestroyMediaStream();
} }
virtual bool SupportsMediaStreams() const MOZ_OVERRIDE
{
return true;
}
NS_DECL_ISUPPORTS_INHERITED NS_DECL_ISUPPORTS_INHERITED
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(AudioBufferSourceNode, AudioSourceNode) NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(AudioBufferSourceNode, AudioSourceNode)

View File

@ -165,12 +165,14 @@ AudioNode::Connect(AudioNode& aDestination, uint32_t aOutput,
input->mInputNode = this; input->mInputNode = this;
input->mInputPort = aInput; input->mInputPort = aInput;
input->mOutputPort = aOutput; input->mOutputPort = aOutput;
// Connect streams in the MediaStreamGraph if (SupportsMediaStreams() && aDestination.mStream) {
MOZ_ASSERT(aDestination.mStream->AsProcessedStream()); // Connect streams in the MediaStreamGraph
ProcessedMediaStream* ps = MOZ_ASSERT(aDestination.mStream->AsProcessedStream());
static_cast<ProcessedMediaStream*>(aDestination.mStream.get()); ProcessedMediaStream* ps =
input->mStreamPort = static_cast<ProcessedMediaStream*>(aDestination.mStream.get());
ps->AllocateInputPort(mStream, MediaInputPort::FLAG_BLOCK_OUTPUT); input->mStreamPort =
ps->AllocateInputPort(mStream, MediaInputPort::FLAG_BLOCK_OUTPUT);
}
} }
void void

View File

@ -60,6 +60,13 @@ public:
} }
} }
// This method should be overridden to return true in nodes
// which support being hooked up to the Media Stream graph.
virtual bool SupportsMediaStreams() const
{
return false;
}
NS_DECL_CYCLE_COLLECTING_ISUPPORTS NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_CLASS(AudioNode) NS_DECL_CYCLE_COLLECTION_CLASS(AudioNode)