Bug 651023 - Round up wait times to 1ms to ensure we drop the decoder monitor when presenting video frames. r=kinetik

This commit is contained in:
Chris Pearce 2011-05-12 14:02:34 +12:00
Родитель 19de6e6d86
Коммит 43bdab0f75
2 изменённых файлов: 5 добавлений и 4 удалений

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

@ -1548,7 +1548,7 @@ void nsBuiltinDecoderStateMachine::AdvanceFrame()
void nsBuiltinDecoderStateMachine::Wait(PRInt64 aUsecs) {
mDecoder->GetReentrantMonitor().AssertCurrentThreadIn();
TimeStamp end = TimeStamp::Now() + UsecsToDuration(aUsecs);
TimeStamp end = TimeStamp::Now() + UsecsToDuration(PR_MAX(USECS_PER_MS, aUsecs));
TimeStamp now;
while ((now = TimeStamp::Now()) < end &&
mState != DECODER_STATE_SHUTDOWN &&

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

@ -287,9 +287,10 @@ protected:
// Waits on the decoder ReentrantMonitor for aUsecs microseconds. If the decoder
// monitor is awoken by a Notify() call, we'll continue waiting, unless
// we've moved into shutdown state. This enables us to ensure that we
// wait for a specified time, and that the myriad of Notify()s we do an
// the decoder monitor don't cause the audio thread to be starved. The
// decoder monitor must be locked.
// wait for a specified time, and that the myriad of Notify()s we do on
// the decoder monitor don't cause the audio thread to be starved. aUsecs
// values of less than 1 millisecond are rounded up to 1 millisecond
// (see bug 651023). The decoder monitor must be held.
void Wait(PRInt64 aUsecs);
// Dispatches an asynchronous event to update the media element's ready state.