Bug 883010 - Optimize MediaStreamGraphImpl::UpdateStreamOrder in order to optimize away how much time we spend on it in every iteration of the MSG. r=roc

--HG--
extra : rebase_source : f1b09842f12b66ac0398b4780865cde461445a8a
This commit is contained in:
Paul Adenot 2014-01-29 14:34:35 +01:00
Родитель aeff978984
Коммит 854a7d5d90
1 изменённых файлов: 14 добавлений и 1 удалений

Просмотреть файл

@ -72,6 +72,8 @@ MediaStreamGraphImpl::FinishStream(MediaStream* aStream)
// on UpdateCurrentTime to notify our listeners once the stream end
// has been reached.
EnsureNextIteration();
SetStreamOrderDirty();
}
void
@ -80,6 +82,8 @@ MediaStreamGraphImpl::AddStream(MediaStream* aStream)
aStream->mBufferStartTime = mCurrentTime;
*mStreams.AppendElement() = already_AddRefed<MediaStream>(aStream);
STREAM_LOG(PR_LOG_DEBUG, ("Adding media stream %p to the graph", aStream));
SetStreamOrderDirty();
}
void
@ -97,6 +101,8 @@ MediaStreamGraphImpl::RemoveStream(MediaStream* aStream)
}
}
SetStreamOrderDirty();
// This unrefs the stream, probably destroying it
mStreams.RemoveElement(aStream);
@ -430,6 +436,7 @@ MediaStreamGraphImpl::UpdateCurrentTime()
stream->StreamTimeToGraphTime(stream->GetStreamBuffer().GetAllTracksEnd())) {
stream->mNotifiedFinished = true;
stream->mLastPlayedVideoFrame.SetNull();
SetStreamOrderDirty();
for (uint32_t j = 0; j < stream->mListeners.Length(); ++j) {
MediaStreamListener* l = stream->mListeners[j];
l->NotifyFinished(this);
@ -1168,7 +1175,9 @@ MediaStreamGraphImpl::RunThread()
}
messageQueue.Clear();
UpdateStreamOrder();
if (mStreamOrderDirty) {
UpdateStreamOrder();
}
// Find the sampling rate that we need to use for non-realtime graphs.
TrackRate sampleRate = IdealAudioRate();
@ -2279,6 +2288,8 @@ MediaInputPort::Disconnect()
mSource = nullptr;
mDest->RemoveInput(this);
mDest = nullptr;
GraphImpl()->SetStreamOrderDirty();
}
MediaInputPort::InputInterval
@ -2357,6 +2368,7 @@ ProcessedMediaStream::AllocateInputPort(MediaStream* aStream, uint32_t aFlags,
{
mPort->Init();
// The graph holds its reference implicitly
mPort->GraphImpl()->SetStreamOrderDirty();
mPort.forget();
}
virtual void RunDuringShutdown()
@ -2410,6 +2422,7 @@ ProcessedMediaStream::DestroyImpl()
mInputs[i]->Disconnect();
}
MediaStream::DestroyImpl();
GraphImpl()->SetStreamOrderDirty();
}
/**