зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1159974 - Dispatch SetMinimizePrerollUntilPlabackStarts. r=jww
This commit is contained in:
Родитель
598c3289ab
Коммит
7e4411d3ff
|
@ -751,14 +751,19 @@ void MediaDecoder::SetStateMachineParameters()
|
||||||
mDecoderStateMachine->DispatchAudioCaptured();
|
mDecoderStateMachine->DispatchAudioCaptured();
|
||||||
}
|
}
|
||||||
if (mMinimizePreroll) {
|
if (mMinimizePreroll) {
|
||||||
mDecoderStateMachine->SetMinimizePrerollUntilPlaybackStarts();
|
mDecoderStateMachine->DispatchMinimizePrerollUntilPlaybackStarts();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MediaDecoder::SetMinimizePrerollUntilPlaybackStarts()
|
void MediaDecoder::SetMinimizePrerollUntilPlaybackStarts()
|
||||||
{
|
{
|
||||||
|
DECODER_LOG("SetMinimizePrerollUntilPlaybackStarts()");
|
||||||
MOZ_ASSERT(NS_IsMainThread());
|
MOZ_ASSERT(NS_IsMainThread());
|
||||||
mMinimizePreroll = true;
|
mMinimizePreroll = true;
|
||||||
|
|
||||||
|
// This needs to be called before we init the state machine, otherwise it will
|
||||||
|
// have no effect.
|
||||||
|
MOZ_DIAGNOSTIC_ASSERT(!mDecoderStateMachine);
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult MediaDecoder::ScheduleStateMachineThread()
|
nsresult MediaDecoder::ScheduleStateMachineThread()
|
||||||
|
|
|
@ -3416,14 +3416,6 @@ void MediaDecoderStateMachine::PreservesPitchChanged()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
MediaDecoderStateMachine::SetMinimizePrerollUntilPlaybackStarts()
|
|
||||||
{
|
|
||||||
AssertCurrentThreadInMonitor();
|
|
||||||
DECODER_LOG("SetMinimizePrerollUntilPlaybackStarts()");
|
|
||||||
mMinimizePreroll = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool MediaDecoderStateMachine::IsShutdown()
|
bool MediaDecoderStateMachine::IsShutdown()
|
||||||
{
|
{
|
||||||
AssertCurrentThreadInMonitor();
|
AssertCurrentThreadInMonitor();
|
||||||
|
|
|
@ -399,7 +399,21 @@ public:
|
||||||
// the state machine is free to return to prerolling normally. Note
|
// the state machine is free to return to prerolling normally. Note
|
||||||
// "prerolling" in this context refers to when we decode and buffer decoded
|
// "prerolling" in this context refers to when we decode and buffer decoded
|
||||||
// samples in advance of when they're needed for playback.
|
// samples in advance of when they're needed for playback.
|
||||||
void SetMinimizePrerollUntilPlaybackStarts();
|
void DispatchMinimizePrerollUntilPlaybackStarts()
|
||||||
|
{
|
||||||
|
nsRefPtr<MediaDecoderStateMachine> self = this;
|
||||||
|
nsCOMPtr<nsIRunnable> r = NS_NewRunnableFunction([self] () -> void
|
||||||
|
{
|
||||||
|
MOZ_ASSERT(self->OnTaskQueue());
|
||||||
|
ReentrantMonitorAutoEnter mon(self->mDecoder->GetReentrantMonitor());
|
||||||
|
self->mMinimizePreroll = true;
|
||||||
|
|
||||||
|
// Make sure that this arrives before playback starts, otherwise this won't
|
||||||
|
// have the intended effect.
|
||||||
|
MOZ_DIAGNOSTIC_ASSERT(self->mPlayState == MediaDecoder::PLAY_STATE_LOADING);
|
||||||
|
});
|
||||||
|
TaskQueue()->Dispatch(r.forget());
|
||||||
|
}
|
||||||
|
|
||||||
void OnAudioDecoded(AudioData* aSample);
|
void OnAudioDecoded(AudioData* aSample);
|
||||||
void OnVideoDecoded(VideoData* aSample);
|
void OnVideoDecoded(VideoData* aSample);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче