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

--HG--
extra : rebase_source : dc3a202cbb94c266f6df4b0c1b5247522fc76658
This commit is contained in:
Ehsan Akhgari 2013-01-25 16:39:51 -05:00
parent 6d8b72a707
commit 438db37746
3 changed files with 19 additions and 6 deletions

View File

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

View File

@ -165,6 +165,7 @@ AudioNode::Connect(AudioNode& aDestination, uint32_t aOutput,
input->mInputNode = this;
input->mInputPort = aInput;
input->mOutputPort = aOutput;
if (SupportsMediaStreams() && aDestination.mStream) {
// Connect streams in the MediaStreamGraph
MOZ_ASSERT(aDestination.mStream->AsProcessedStream());
ProcessedMediaStream* ps =
@ -172,6 +173,7 @@ AudioNode::Connect(AudioNode& aDestination, uint32_t aOutput,
input->mStreamPort =
ps->AllocateInputPort(mStream, MediaInputPort::FLAG_BLOCK_OUTPUT);
}
}
void
AudioNode::Disconnect(uint32_t aOutput, ErrorResult& aRv)

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_COLLECTION_CLASS(AudioNode)