mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1159974 - Dispatch SetMinimizePrerollUntilPlabackStarts. r=jww
This commit is contained in:
parent
9cd6c4764b
commit
196450c61a
@ -751,14 +751,19 @@ void MediaDecoder::SetStateMachineParameters()
|
||||
mDecoderStateMachine->DispatchAudioCaptured();
|
||||
}
|
||||
if (mMinimizePreroll) {
|
||||
mDecoderStateMachine->SetMinimizePrerollUntilPlaybackStarts();
|
||||
mDecoderStateMachine->DispatchMinimizePrerollUntilPlaybackStarts();
|
||||
}
|
||||
}
|
||||
|
||||
void MediaDecoder::SetMinimizePrerollUntilPlaybackStarts()
|
||||
{
|
||||
DECODER_LOG("SetMinimizePrerollUntilPlaybackStarts()");
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
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()
|
||||
|
@ -3416,14 +3416,6 @@ void MediaDecoderStateMachine::PreservesPitchChanged()
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
MediaDecoderStateMachine::SetMinimizePrerollUntilPlaybackStarts()
|
||||
{
|
||||
AssertCurrentThreadInMonitor();
|
||||
DECODER_LOG("SetMinimizePrerollUntilPlaybackStarts()");
|
||||
mMinimizePreroll = true;
|
||||
}
|
||||
|
||||
bool MediaDecoderStateMachine::IsShutdown()
|
||||
{
|
||||
AssertCurrentThreadInMonitor();
|
||||
|
@ -399,7 +399,21 @@ public:
|
||||
// the state machine is free to return to prerolling normally. Note
|
||||
// "prerolling" in this context refers to when we decode and buffer decoded
|
||||
// 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 OnVideoDecoded(VideoData* aSample);
|
||||
|
Loading…
Reference in New Issue
Block a user