mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1199809 - Don't schedule decoder I/O task when there will be more input. r=bwu
This commit is contained in:
parent
51e0b0667f
commit
b3c658447d
@ -137,8 +137,8 @@ GonkDecoderManager::Shutdown()
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
bool
|
||||
GonkDecoderManager::HasQueuedSample()
|
||||
size_t
|
||||
GonkDecoderManager::NumQueuedSamples()
|
||||
{
|
||||
MutexAutoLock lock(mMutex);
|
||||
return mQueuedSamples.Length();
|
||||
@ -159,6 +159,8 @@ GonkDecoderManager::ProcessInput(bool aEndOfStream)
|
||||
mToDo->setInt32("input-eos", 1);
|
||||
}
|
||||
mDecoder->requestActivityNotification(mToDo);
|
||||
} else if (aEndOfStream) {
|
||||
mToDo->setInt32("input-eos", 1);
|
||||
}
|
||||
} else {
|
||||
GMDD_LOG("input processed: error#%d", rv);
|
||||
@ -186,15 +188,9 @@ GonkDecoderManager::ProcessToDo(bool aEndOfStream)
|
||||
MOZ_ASSERT(mToDo.get() != nullptr);
|
||||
mToDo.clear();
|
||||
|
||||
if (HasQueuedSample()) {
|
||||
status_t pendingInput = ProcessQueuedSamples();
|
||||
if (pendingInput < 0) {
|
||||
mDecodeCallback->Error();
|
||||
return;
|
||||
}
|
||||
if (!aEndOfStream && pendingInput <= MIN_QUEUED_SAMPLES) {
|
||||
mDecodeCallback->InputExhausted();
|
||||
}
|
||||
if (NumQueuedSamples() > 0 && ProcessQueuedSamples() < 0) {
|
||||
mDecodeCallback->Error();
|
||||
return;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
@ -226,8 +222,18 @@ GonkDecoderManager::ProcessToDo(bool aEndOfStream)
|
||||
}
|
||||
}
|
||||
|
||||
if (HasQueuedSample() || mWaitOutput.Length() > 0) {
|
||||
if (!aEndOfStream && NumQueuedSamples() <= MIN_QUEUED_SAMPLES) {
|
||||
mDecodeCallback->InputExhausted();
|
||||
// No need to shedule todo task this time because InputExhausted() will
|
||||
// cause Input() to be invoked and do it for us.
|
||||
return;
|
||||
}
|
||||
|
||||
if (NumQueuedSamples() || mWaitOutput.Length() > 0) {
|
||||
mToDo = new AMessage(kNotifyDecoderActivity, id());
|
||||
if (aEndOfStream) {
|
||||
mToDo->setInt32("input-eos", 1);
|
||||
}
|
||||
mDecoder->requestActivityNotification(mToDo);
|
||||
}
|
||||
}
|
||||
|
@ -38,8 +38,8 @@ public:
|
||||
// Shutdown decoder and rejects the init promise.
|
||||
virtual nsresult Shutdown();
|
||||
|
||||
// True if sample is queued.
|
||||
bool HasQueuedSample();
|
||||
// How many samples are waiting for processing.
|
||||
size_t NumQueuedSamples();
|
||||
|
||||
// Set callback for decoder events, such as requesting more input,
|
||||
// returning output, or reporting error.
|
||||
|
Loading…
Reference in New Issue
Block a user