mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-12 14:37:50 +00:00
Bug 1163597 - MediaStreamGraphImpl::RecomputeBlockingAt: optimization in the number of loops for the mStreams array, r=padenot
This commit is contained in:
parent
49a0ee6938
commit
53fabee1a5
@ -914,13 +914,29 @@ MediaStreamGraphImpl::RecomputeBlockingAt(const nsTArray<MediaStream*>& aStreams
|
||||
GraphTime aEndBlockingDecisions,
|
||||
GraphTime* aEnd)
|
||||
{
|
||||
for (uint32_t i = 0; i < aStreams.Length(); ++i) {
|
||||
MediaStream* stream = aStreams[i];
|
||||
stream->mBlockInThisPhase = false;
|
||||
}
|
||||
class MOZ_STACK_CLASS AfterLoop
|
||||
{
|
||||
public:
|
||||
AfterLoop(MediaStream* aStream, GraphTime& aTime)
|
||||
: mStream(aStream)
|
||||
, mTime(aTime)
|
||||
{}
|
||||
|
||||
~AfterLoop()
|
||||
{
|
||||
mStream->mBlocked.SetAtAndAfter(mTime, mStream->mBlockInThisPhase);
|
||||
}
|
||||
|
||||
private:
|
||||
MediaStream* mStream;
|
||||
GraphTime& mTime;
|
||||
};
|
||||
|
||||
for (uint32_t i = 0; i < aStreams.Length(); ++i) {
|
||||
MediaStream* stream = aStreams[i];
|
||||
stream->mBlockInThisPhase = false;
|
||||
|
||||
AfterLoop al(stream, aTime);
|
||||
|
||||
if (stream->mFinished) {
|
||||
GraphTime endTime = StreamTimeToGraphTime(stream,
|
||||
@ -956,12 +972,8 @@ MediaStreamGraphImpl::RecomputeBlockingAt(const nsTArray<MediaStream*>& aStreams
|
||||
continue;
|
||||
}
|
||||
}
|
||||
NS_ASSERTION(*aEnd > aTime, "Failed to advance!");
|
||||
|
||||
for (uint32_t i = 0; i < aStreams.Length(); ++i) {
|
||||
MediaStream* stream = aStreams[i];
|
||||
stream->mBlocked.SetAtAndAfter(aTime, stream->mBlockInThisPhase);
|
||||
}
|
||||
NS_ASSERTION(*aEnd > aTime, "Failed to advance!");
|
||||
}
|
||||
|
||||
void
|
||||
|
Loading…
Reference in New Issue
Block a user