зеркало из https://github.com/mozilla/gecko-dev.git
Bug 607838 - Allow audio drains to be interrupted - r=cpearce a=blocking2.0:final
--HG-- extra : rebase_source : 664d1b27f71daf1db7fc4ae165174f6668273ad7
This commit is contained in:
Родитель
8963c723d5
Коммит
678b392bed
|
@ -510,9 +510,34 @@ void nsBuiltinDecoderStateMachine::AudioLoop()
|
|||
// before the audio thread terminates.
|
||||
MonitorAutoEnter audioMon(mAudioMonitor);
|
||||
if (mAudioStream) {
|
||||
mAudioStream->Drain();
|
||||
// Fire one last event for any extra samples that didn't fill a framebuffer.
|
||||
mEventManager.Drain(mAudioEndTime);
|
||||
PRBool seeking = PR_FALSE;
|
||||
PRInt64 oldPosition = -1;
|
||||
|
||||
{
|
||||
MonitorAutoExit audioExit(mAudioMonitor);
|
||||
MonitorAutoEnter mon(mDecoder->GetMonitor());
|
||||
PRInt64 position = GetMediaTime();
|
||||
while (oldPosition != position &&
|
||||
mAudioEndTime - position > 0 &&
|
||||
mState != DECODER_STATE_SEEKING &&
|
||||
mState != DECODER_STATE_SHUTDOWN)
|
||||
{
|
||||
const PRInt64 DRAIN_BLOCK_MS = 100;
|
||||
Wait(NS_MIN(mAudioEndTime - position, DRAIN_BLOCK_MS));
|
||||
oldPosition = position;
|
||||
position = GetMediaTime();
|
||||
}
|
||||
if (mState == DECODER_STATE_SEEKING) {
|
||||
seeking = PR_TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
if (!seeking && mAudioStream) {
|
||||
mAudioStream->Drain();
|
||||
|
||||
// Fire one last event for any extra samples that didn't fill a framebuffer.
|
||||
mEventManager.Drain(mAudioEndTime);
|
||||
}
|
||||
}
|
||||
LOG(PR_LOG_DEBUG, ("%p Reached audio stream end.", mDecoder));
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче