Bug 881959 - Handle self-connection. r=ehsan

--HG--
extra : rebase_source : 02ef02b921df39dcb647096a10a1fa4e85161c70
This commit is contained in:
Paul Adenot 2013-09-16 17:37:27 +02:00
parent eeb99d293f
commit d4d8b9bcb9

View File

@ -525,15 +525,22 @@ MediaStreamGraphImpl::UpdateStreamOrderForStream(mozilla::LinkedList<MediaStream
}
if (cycleFound && !delayNodePresent) {
// If we have detected a cycle, the previous loop should exit with stream
// == iter. Go back in the cycle and mute all nodes we find.
MOZ_ASSERT(iter);
do {
// There can't be non-AudioNodeStream here, MediaStreamAudio{Source,
// Destination}Node are connected to regular MediaStreams, but they can't be
// in a cycle (there is no content API to do so).
MOZ_ASSERT(iter->AsAudioNodeStream());
// == iter, or the node is connected to itself. Go back in the cycle and
// mute all nodes we find, or just mute the node itself.
if (!iter) {
// The node is connected to itself.
iter = aStack->getLast();
iter->AsAudioNodeStream()->Mute();
} while((iter = iter->getNext()));
} else {
MOZ_ASSERT(iter);
do {
// There can't be non-AudioNodeStream here, MediaStreamAudio{Source,
// Destination}Node are connected to regular MediaStreams, but they can't be
// in a cycle (there is no content API to do so).
MOZ_ASSERT(iter->AsAudioNodeStream());
iter->AsAudioNodeStream()->Mute();
} while((iter = iter->getNext()));
}
// Warn the user that some of the nodes in the graph are muted, but only
// once. This flag is reset when the graph changes.