MediaStream reference counting in ProduceDataForStreamsBlockByBlock() is showing up as at least 2%, maybe as much as 3%, of MSG thread CPU usage in JProf profiles while in Jam mode on http://www.cappel-nord.de/webaudio/acid-defender/ (In reply to :Ehsan Akhgari (needinfo? me!) from bug 864709 comment #20) > So one threading race condition that I can see here is that when we call > MediaStreamGraphImpl::ProduceDataForStreamsBlockByBlock, we do not hold a > strong reference to the media stream, so we have no guarantee for the stream > (and therefore the engine) to not die when we're in a call to > ProduceAudioBlock, if the cycle collector frees the node object on the main > thread. mStreams holds a strong reference. Elements are only added or removed from mStreams in response to control messages from the main thread or during UpdateStreamOrder(). Neither of these events will happen during ProduceDataForStreamsBlockByBlock().
Created attachment 8355938 [details] [diff] [review] less.block.ref.counting