mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 799344 - Remove nsBuiltinDecoder::GetDecodeState(), so that nsBuiltinDecoder doesn't need to know about nsDecoderStateMachine::State. r=roc
This commit is contained in:
parent
21e2fae3bd
commit
9ee26e5a65
@ -346,14 +346,6 @@ nsDASHRepDecoder::GetReentrantMonitor()
|
||||
return mMainDecoder->GetReentrantMonitor();
|
||||
}
|
||||
|
||||
nsDecoderStateMachine::State
|
||||
nsDASHRepDecoder::GetDecodeState()
|
||||
{
|
||||
// XXX SHUTDOWN might not be an appropriate error.
|
||||
return (mMainDecoder ? mMainDecoder->GetDecodeState()
|
||||
: nsDecoderStateMachine::DECODER_STATE_SHUTDOWN);
|
||||
}
|
||||
|
||||
mozilla::layers::ImageContainer*
|
||||
nsDASHRepDecoder::GetImageContainer()
|
||||
{
|
||||
|
@ -135,10 +135,6 @@ public:
|
||||
// Returns main decoder's monitor for synchronised access.
|
||||
ReentrantMonitor& GetReentrantMonitor();
|
||||
|
||||
// Return the current decode state, according to the main decoder. The
|
||||
// decoder monitor must be obtained before calling this.
|
||||
nsDecoderStateMachine::State GetDecodeState();
|
||||
|
||||
// Called on the decode thread from nsWebMReader.
|
||||
ImageContainer* GetImageContainer();
|
||||
|
||||
|
@ -240,6 +240,10 @@ public:
|
||||
|
||||
virtual void Shutdown() = 0;
|
||||
|
||||
// True if the state machine has shutdown, or is in the process of
|
||||
// shutting down. The decoder monitor must be obtained before calling this.
|
||||
virtual bool IsShutdown() = 0;
|
||||
|
||||
// Called from the main thread to get the duration. The decoder monitor
|
||||
// must be obtained before calling this. It is in units of microseconds.
|
||||
virtual int64_t GetDuration() = 0;
|
||||
@ -699,10 +703,6 @@ public:
|
||||
// Provide access to the state machine object
|
||||
nsDecoderStateMachine* GetStateMachine() { return mDecoderStateMachine; }
|
||||
|
||||
// Return the current decode state. The decoder monitor must be
|
||||
// obtained before calling this.
|
||||
nsDecoderStateMachine::State GetDecodeState() { return mDecoderStateMachine->GetState(); }
|
||||
|
||||
// Drop reference to state machine. Only called during shutdown dance.
|
||||
virtual void ReleaseStateMachine() { mDecoderStateMachine = nullptr; }
|
||||
|
||||
|
@ -389,7 +389,7 @@ nsresult nsBuiltinDecoderReader::DecodeToTarget(int64_t aTarget)
|
||||
eof = !DecodeVideoFrame(skip, 0);
|
||||
{
|
||||
ReentrantMonitorAutoEnter decoderMon(mDecoder->GetReentrantMonitor());
|
||||
if (mDecoder->GetDecodeState() == nsBuiltinDecoderStateMachine::DECODER_STATE_SHUTDOWN) {
|
||||
if (mDecoder->GetStateMachine()->IsShutdown()) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
}
|
||||
@ -416,7 +416,7 @@ nsresult nsBuiltinDecoderReader::DecodeToTarget(int64_t aTarget)
|
||||
}
|
||||
{
|
||||
ReentrantMonitorAutoEnter decoderMon(mDecoder->GetReentrantMonitor());
|
||||
if (mDecoder->GetDecodeState() == nsBuiltinDecoderStateMachine::DECODER_STATE_SHUTDOWN) {
|
||||
if (mDecoder->GetStateMachine()->IsShutdown()) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
}
|
||||
@ -431,7 +431,7 @@ nsresult nsBuiltinDecoderReader::DecodeToTarget(int64_t aTarget)
|
||||
eof = !DecodeAudioData();
|
||||
{
|
||||
ReentrantMonitorAutoEnter decoderMon(mDecoder->GetReentrantMonitor());
|
||||
if (mDecoder->GetDecodeState() == nsBuiltinDecoderStateMachine::DECODER_STATE_SHUTDOWN) {
|
||||
if (mDecoder->GetStateMachine()->IsShutdown()) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
}
|
||||
|
@ -486,8 +486,7 @@ public:
|
||||
while (!eof && aQueue.GetSize() == 0) {
|
||||
{
|
||||
ReentrantMonitorAutoEnter decoderMon(mDecoder->GetReentrantMonitor());
|
||||
if (mDecoder->GetDecodeState()
|
||||
== nsDecoderStateMachine::DECODER_STATE_SHUTDOWN) {
|
||||
if (mDecoder->GetStateMachine()->IsShutdown()) {
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
@ -2613,3 +2613,10 @@ void nsBuiltinDecoderStateMachine::NotifyAudioAvailableListener()
|
||||
mDecoder->GetReentrantMonitor().AssertCurrentThreadIn();
|
||||
mEventManager.NotifyAudioAvailableListener();
|
||||
}
|
||||
|
||||
bool nsBuiltinDecoderStateMachine::IsShutdown()
|
||||
{
|
||||
mDecoder->GetReentrantMonitor().AssertCurrentThreadIn();
|
||||
return GetState() == DECODER_STATE_SHUTDOWN;
|
||||
}
|
||||
|
||||
|
@ -116,9 +116,9 @@ public:
|
||||
// nsDecoderStateMachine interface
|
||||
virtual nsresult Init(nsDecoderStateMachine* aCloneDonor);
|
||||
State GetState()
|
||||
{
|
||||
{
|
||||
mDecoder->GetReentrantMonitor().AssertCurrentThreadIn();
|
||||
return mState;
|
||||
return mState;
|
||||
}
|
||||
virtual void SetVolume(double aVolume);
|
||||
virtual void SetAudioCaptured(bool aCapture);
|
||||
@ -264,6 +264,10 @@ public:
|
||||
bool HaveEnoughDecodedAudio(int64_t aAmpleAudioUSecs);
|
||||
bool HaveEnoughDecodedVideo();
|
||||
|
||||
// Returns true if the state machine has shutdown or is in the process of
|
||||
// shutting down. The decoder monitor must be held while calling this.
|
||||
bool IsShutdown() MOZ_OVERRIDE;
|
||||
|
||||
protected:
|
||||
class WakeDecoderRunnable : public nsRunnable {
|
||||
public:
|
||||
|
@ -1106,7 +1106,7 @@ nsOggReader::IndexedSeekResult nsOggReader::SeekToKeyframeUsingIndex(int64_t aTa
|
||||
// Couldn't insert page into the ogg resource, or somehow the resource
|
||||
// is no longer active.
|
||||
return RollbackIndexedSeek(tell);
|
||||
}
|
||||
}
|
||||
mPageOffset = keyframe.mKeyPoint.mOffset + page.header_len + page.body_len;
|
||||
return SEEK_OK;
|
||||
}
|
||||
@ -1136,7 +1136,7 @@ nsresult nsOggReader::SeekInBufferedRange(int64_t aTarget,
|
||||
eof = !DecodeVideoFrame(skip, 0);
|
||||
{
|
||||
ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
|
||||
if (mDecoder->GetDecodeState() == nsBuiltinDecoderStateMachine::DECODER_STATE_SHUTDOWN) {
|
||||
if (mDecoder->GetStateMachine()->IsShutdown()) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
}
|
||||
|
@ -258,8 +258,7 @@ nsresult nsRawReader::Seek(int64_t aTime, int64_t aStartTime, int64_t aEndTime,
|
||||
|
||||
{
|
||||
mozilla::ReentrantMonitorAutoEnter autoMonitor(mDecoder->GetReentrantMonitor());
|
||||
if (mDecoder->GetDecodeState() ==
|
||||
nsBuiltinDecoderStateMachine::DECODER_STATE_SHUTDOWN) {
|
||||
if (mDecoder->GetStateMachine()->IsShutdown()) {
|
||||
mCurrentFrame = frame;
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user