mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-19 00:05:36 +00:00
Bug 1191684 - Remove unnecessary calls to NotifyAll() on the decoder monitor since no one calls Wait(). r=cpearce.
This commit is contained in:
parent
c32f098f77
commit
c8f63ccc7b
@ -1013,7 +1013,6 @@ void MediaDecoder::ChangeState(PlayState aState)
|
||||
}
|
||||
|
||||
if (mPlayState == PLAY_STATE_SHUTDOWN) {
|
||||
GetReentrantMonitor().NotifyAll();
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1030,8 +1029,6 @@ void MediaDecoder::ChangeState(PlayState aState)
|
||||
CancelDormantTimer();
|
||||
// Start dormant timer if necessary
|
||||
StartDormantTimer();
|
||||
|
||||
GetReentrantMonitor().NotifyAll();
|
||||
}
|
||||
|
||||
void MediaDecoder::UpdateLogicalPosition(MediaDecoderEventVisibility aEventVisibility)
|
||||
|
@ -1098,15 +1098,11 @@ protected:
|
||||
// This can only be changed on the main thread while holding the decoder
|
||||
// monitor. Thus, it can be safely read while holding the decoder monitor
|
||||
// OR on the main thread.
|
||||
// Any change to the state on the main thread must call NotifyAll on the
|
||||
// monitor so the decode thread can wake up.
|
||||
Canonical<PlayState> mPlayState;
|
||||
|
||||
// This can only be changed on the main thread while holding the decoder
|
||||
// monitor. Thus, it can be safely read while holding the decoder monitor
|
||||
// OR on the main thread.
|
||||
// Any change to the state must call NotifyAll on the monitor.
|
||||
// This can only be PLAY_STATE_PAUSED or PLAY_STATE_PLAYING.
|
||||
Canonical<PlayState> mNextState;
|
||||
|
||||
// True if the decoder is seeking.
|
||||
|
@ -660,9 +660,6 @@ MediaDecoderStateMachine::Push(VideoData* aSample)
|
||||
VideoQueue().Push(aSample);
|
||||
UpdateNextFrameStatus();
|
||||
DispatchDecodeTasksIfNeeded();
|
||||
|
||||
// XXXbholley - Is this still necessary?
|
||||
mDecoder->GetReentrantMonitor().NotifyAll();
|
||||
}
|
||||
|
||||
void
|
||||
@ -694,9 +691,6 @@ MediaDecoderStateMachine::OnVideoPopped(const MediaData* aSample)
|
||||
mDecoder->UpdatePlaybackOffset(aSample->mOffset);
|
||||
UpdateNextFrameStatus();
|
||||
DispatchVideoDecodeTaskIfNeeded();
|
||||
// Notify the decode thread that the video queue's buffers may have
|
||||
// free'd up space for more frames.
|
||||
mDecoder->GetReentrantMonitor().NotifyAll();
|
||||
}
|
||||
|
||||
void
|
||||
@ -778,7 +772,6 @@ MediaDecoderStateMachine::OnNotDecoded(MediaData::Type aType,
|
||||
return;
|
||||
}
|
||||
CheckIfDecodeComplete();
|
||||
mDecoder->GetReentrantMonitor().NotifyAll();
|
||||
// Schedule the state machine to notify track ended as soon as possible.
|
||||
if (mAudioCaptured) {
|
||||
ScheduleStateMachine();
|
||||
@ -1093,7 +1086,6 @@ void MediaDecoderStateMachine::MaybeStartPlayback()
|
||||
mDecodedStream->StartPlayback(GetMediaTime(), mInfo);
|
||||
}
|
||||
|
||||
mDecoder->GetReentrantMonitor().NotifyAll();
|
||||
DispatchDecodeTasksIfNeeded();
|
||||
}
|
||||
|
||||
@ -1260,13 +1252,11 @@ void MediaDecoderStateMachine::SetDormant(bool aDormant)
|
||||
// it here as well.
|
||||
nsCOMPtr<nsIRunnable> r = NS_NewRunnableMethod(mReader, &MediaDecoderReader::ReleaseMediaResources);
|
||||
DecodeTaskQueue()->Dispatch(r.forget());
|
||||
mDecoder->GetReentrantMonitor().NotifyAll();
|
||||
} else if ((aDormant != true) && (mState == DECODER_STATE_DORMANT)) {
|
||||
mDecodingFrozenAtStateDecoding = true;
|
||||
ScheduleStateMachine();
|
||||
mDecodingFirstFrame = true;
|
||||
SetState(DECODER_STATE_DECODING_NONE);
|
||||
mDecoder->GetReentrantMonitor().NotifyAll();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1909,10 +1899,6 @@ MediaDecoderStateMachine::DecodeError()
|
||||
ScheduleStateMachine();
|
||||
DECODER_WARN("Decode error, changed state to ERROR");
|
||||
|
||||
// XXXbholley - Is anybody actually waiting on this monitor, or is it just
|
||||
// a leftover from when we used to do sync dispatch for the below?
|
||||
mDecoder->GetReentrantMonitor().NotifyAll();
|
||||
|
||||
// MediaDecoder::DecodeError notifies the owner, and then shuts down the state
|
||||
// machine.
|
||||
nsCOMPtr<nsIRunnable> event =
|
||||
@ -2356,8 +2342,6 @@ nsresult MediaDecoderStateMachine::RunStateMachine()
|
||||
DECODER_LOG("Buffered for %.3lfs", (now - mBufferingStart).ToSeconds());
|
||||
StartDecoding();
|
||||
|
||||
// Notify to allow blocked decoder thread to continue
|
||||
mDecoder->GetReentrantMonitor().NotifyAll();
|
||||
NS_ASSERTION(IsStateMachineScheduled(), "Must have timer scheduled");
|
||||
return NS_OK;
|
||||
}
|
||||
@ -3076,9 +3060,6 @@ void MediaDecoderStateMachine::OnAudioSinkComplete()
|
||||
mAudioSinkPromise.Complete();
|
||||
ResyncAudioClock();
|
||||
mAudioCompleted = true;
|
||||
|
||||
// Kick the decode thread; it may be sleeping waiting for this to finish.
|
||||
mDecoder->GetReentrantMonitor().NotifyAll();
|
||||
}
|
||||
|
||||
void MediaDecoderStateMachine::OnAudioSinkError()
|
||||
|
@ -112,9 +112,8 @@ extern PRLogModuleInfo* gMediaSampleLog;
|
||||
state machine thread, and controls the audio "push" thread.
|
||||
|
||||
All internal state is synchronised via the decoder monitor. State changes
|
||||
are either propagated by NotifyAll on the monitor (typically when state
|
||||
changes need to be propagated to non-state machine threads) or by scheduling
|
||||
the state machine to run another cycle on the shared state machine thread.
|
||||
are propagated by scheduling the state machine to run another cycle on the
|
||||
shared state machine thread.
|
||||
|
||||
See MediaDecoder.h for more details.
|
||||
*/
|
||||
@ -886,8 +885,6 @@ private:
|
||||
MediaQueue<MediaData> mVideoQueue;
|
||||
|
||||
// The decoder monitor must be obtained before modifying this state.
|
||||
// NotifyAll on the monitor must be called when the state is changed so
|
||||
// that interested threads can wake up and alter behaviour if appropriate
|
||||
// Accessed on state machine, audio, main, and AV thread.
|
||||
Watchable<State> mState;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user