bug 1205540 provide querying whether engines need to continue processing even without input r=padenot

--HG--
extra : rebase_source : 76545deae4cdc929f1b3ce4d10065f99f21a2ec3
This commit is contained in:
Karl Tomlinson 2015-09-09 08:54:03 +12:00
Родитель e182c00028
Коммит ee25bfb081
10 изменённых файлов: 69 добавлений и 0 удалений

Просмотреть файл

@ -83,6 +83,11 @@ public:
NS_DispatchToMainThread(transfer); NS_DispatchToMainThread(transfer);
} }
virtual bool IsActive() const override
{
return mChunksToProcess != 0;
}
virtual size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const override virtual size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const override
{ {
return aMallocSizeOf(this) + SizeOfExcludingThis(aMallocSizeOf); return aMallocSizeOf(this) + SizeOfExcludingThis(aMallocSizeOf);

Просмотреть файл

@ -508,6 +508,12 @@ public:
} }
} }
virtual bool IsActive() const override
{
// Whether buffer has been set and start() has been called.
return mBufferSampleRate != 0;
}
virtual size_t SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const override virtual size_t SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const override
{ {
// Not owned: // Not owned:

Просмотреть файл

@ -112,6 +112,14 @@ public:
} }
} }
virtual bool IsActive() const override
{
// Keep processing to track stream time, which is used for all timelines
// associated with the same AudioContext.
return true;
}
class OnCompleteTask final : public nsRunnable class OnCompleteTask final : public nsRunnable
{ {
public: public:
@ -255,6 +263,16 @@ public:
} }
} }
virtual bool IsActive() const override
{
// Keep processing to track stream time, which is used for all timelines
// associated with the same AudioContext. If there are no other engines
// for the AudioContext, then this could return false to suspend the
// stream, but the stream is blocked anyway through
// AudioDestinationNode::SetIsOnlyNodeForContext().
return true;
}
virtual void SetDoubleParameter(uint32_t aIndex, double aParam) override virtual void SetDoubleParameter(uint32_t aIndex, double aParam) override
{ {
if (aIndex == VOLUME) { if (aIndex == VOLUME) {

Просмотреть файл

@ -346,6 +346,12 @@ public:
OutputChunks& aOutput, OutputChunks& aOutput,
bool* aFinished); bool* aFinished);
// IsActive() returns true if the engine needs to continue processing an
// unfinished stream even when it has silent or no input connections. This
// includes tail-times and when sources have been scheduled to start. If
// returning false, then the stream can be suspended.
virtual bool IsActive() const { return false; }
bool HasNode() const bool HasNode() const
{ {
MOZ_ASSERT(NS_IsMainThread()); MOZ_ASSERT(NS_IsMainThread());

Просмотреть файл

@ -211,6 +211,11 @@ public:
} }
} }
virtual bool IsActive() const override
{
return !mBiquads.IsEmpty();
}
virtual size_t SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const override virtual size_t SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const override
{ {
// Not owned: // Not owned:

Просмотреть файл

@ -154,6 +154,11 @@ public:
mReverb->process(&input, aOutput, WEBAUDIO_BLOCK_SIZE); mReverb->process(&input, aOutput, WEBAUDIO_BLOCK_SIZE);
} }
virtual bool IsActive() const override
{
return mLeftOverData != INT32_MIN;
}
virtual size_t SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const override virtual size_t SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const override
{ {
size_t amount = AudioNodeEngine::SizeOfExcludingThis(aMallocSizeOf); size_t amount = AudioNodeEngine::SizeOfExcludingThis(aMallocSizeOf);

Просмотреть файл

@ -161,6 +161,11 @@ public:
mHaveProducedBeforeInput = true; mHaveProducedBeforeInput = true;
} }
virtual bool IsActive() const override
{
return mLeftOverData != INT32_MIN;
}
virtual size_t SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const override virtual size_t SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const override
{ {
size_t amount = AudioNodeEngine::SizeOfExcludingThis(aMallocSizeOf); size_t amount = AudioNodeEngine::SizeOfExcludingThis(aMallocSizeOf);

Просмотреть файл

@ -330,6 +330,12 @@ public:
} }
virtual bool IsActive() const override
{
// start() has been called.
return mStart != -1;
}
virtual size_t SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const override virtual size_t SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const override
{ {
size_t amount = AudioNodeEngine::SizeOfExcludingThis(aMallocSizeOf); size_t amount = AudioNodeEngine::SizeOfExcludingThis(aMallocSizeOf);

Просмотреть файл

@ -172,6 +172,11 @@ public:
(this->*mPanningModelFunction)(aInput, aOutput); (this->*mPanningModelFunction)(aInput, aOutput);
} }
virtual bool IsActive() const override
{
return mLeftOverData != INT_MIN;
}
void ComputeAzimuthAndElevation(float& aAzimuth, float& aElevation); void ComputeAzimuthAndElevation(float& aAzimuth, float& aElevation);
float ComputeConeGain(); float ComputeConeGain();
// Compute how much the distance contributes to the gain reduction. // Compute how much the distance contributes to the gain reduction.

Просмотреть файл

@ -333,6 +333,14 @@ public:
} }
} }
virtual bool IsActive() const override
{
// Could return false when !mIsConnected after all output chunks produced
// by main thread events calling
// SharedBuffers::FinishProducingOutputBuffer() have been processed.
return true;
}
virtual size_t SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const override virtual size_t SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const override
{ {
// Not owned: // Not owned: