mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1172387 - Clean up code of MediaDecoderStateMachine::StopAudioThread. r=kinetik.
This commit is contained in:
parent
df24b42455
commit
adac001996
@ -227,7 +227,6 @@ MediaDecoderStateMachine::MediaDecoderStateMachine(MediaDecoder* aDecoder,
|
||||
mAudioCompleted(false, "MediaDecoderStateMachine::mAudioCompleted"),
|
||||
mGotDurationFromMetaData(false),
|
||||
mDispatchedEventToDecode(false),
|
||||
mStopAudioThread(true),
|
||||
mQuickBuffering(false),
|
||||
mMinimizePreroll(false),
|
||||
mDecodeThreadWaiting(false),
|
||||
@ -1799,17 +1798,6 @@ void MediaDecoderStateMachine::StopAudioThread()
|
||||
MOZ_ASSERT(OnTaskQueue());
|
||||
AssertCurrentThreadInMonitor();
|
||||
|
||||
if (mStopAudioThread) {
|
||||
// Audio sink is being stopped in another thread. Wait until finished.
|
||||
while (mAudioSink) {
|
||||
mDecoder->GetReentrantMonitor().Wait();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
mStopAudioThread = true;
|
||||
// Wake up audio sink so that it can reach the finish line.
|
||||
mDecoder->GetReentrantMonitor().NotifyAll();
|
||||
if (mAudioSink) {
|
||||
DECODER_LOG("Shutdown audio thread");
|
||||
mAudioSink->PrepareToShutdown();
|
||||
@ -1819,8 +1807,6 @@ void MediaDecoderStateMachine::StopAudioThread()
|
||||
}
|
||||
mAudioSink = nullptr;
|
||||
}
|
||||
// Wake up those waiting for audio sink to finish.
|
||||
mDecoder->GetReentrantMonitor().NotifyAll();
|
||||
}
|
||||
|
||||
nsresult
|
||||
@ -2092,11 +2078,10 @@ MediaDecoderStateMachine::StartAudioThread()
|
||||
MOZ_ASSERT(OnTaskQueue());
|
||||
AssertCurrentThreadInMonitor();
|
||||
if (mAudioCaptured) {
|
||||
NS_ASSERTION(mStopAudioThread, "mStopAudioThread must always be true if audio is captured");
|
||||
MOZ_ASSERT(!mAudioSink);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
mStopAudioThread = false;
|
||||
if (HasAudio() && !mAudioSink) {
|
||||
// The audio end time should always be at least the audio start time.
|
||||
mAudioEndTime = mAudioStartTime;
|
||||
|
@ -1186,8 +1186,8 @@ protected:
|
||||
}
|
||||
|
||||
// True if we shouldn't play our audio (but still write it to any capturing
|
||||
// streams). When this is true, mStopAudioThread is always true and
|
||||
// the audio thread will never start again after it has stopped.
|
||||
// streams). When this is true, the audio thread will never start again after
|
||||
// it has stopped.
|
||||
bool mAudioCaptured;
|
||||
|
||||
// True if an event to notify about a change in the playback
|
||||
@ -1215,10 +1215,6 @@ protected:
|
||||
// unneccessary runnables, since the decode thread runs in a loop.
|
||||
bool mDispatchedEventToDecode;
|
||||
|
||||
// False while audio thread should be running. Accessed state machine
|
||||
// and audio threads. Syncrhonised by decoder monitor.
|
||||
bool mStopAudioThread;
|
||||
|
||||
// If this is true while we're in buffering mode, we can exit early,
|
||||
// as it's likely we may be able to playback. This happens when we enter
|
||||
// buffering mode soon after the decode starts, because the decode-ahead
|
||||
|
Loading…
Reference in New Issue
Block a user