bug 1205558 remove DelayNodeEngine::mSource r=padenot

--HG--
extra : rebase_source : 2bc303e258a0d00ff3cf03ac3cb649046c05c0fb
This commit is contained in:
Karl Tomlinson 2015-09-29 14:39:28 +13:00
Родитель cc26ca0fff
Коммит 23b10a8cba
3 изменённых файлов: 11 добавлений и 18 удалений

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

@ -324,7 +324,8 @@ public:
* ProcessBlock() will be called later, and it then should not change
* aOutput. This is used only for DelayNodeEngine in a feedback loop.
*/
virtual void ProduceBlockBeforeInput(GraphTime aFrom,
virtual void ProduceBlockBeforeInput(AudioNodeStream* aStream,
GraphTime aFrom,
AudioBlock* aOutput)
{
NS_NOTREACHED("ProduceBlockBeforeInput called on wrong engine\n");

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

@ -617,7 +617,7 @@ AudioNodeStream::ProduceOutputBeforeInput(GraphTime aFrom)
if (!mIsActive) {
mLastChunks[0].SetNull(WEBAUDIO_BLOCK_SIZE);
} else {
mEngine->ProduceBlockBeforeInput(aFrom, &mLastChunks[0]);
mEngine->ProduceBlockBeforeInput(this, aFrom, &mLastChunks[0]);
NS_ASSERTION(mLastChunks[0].GetDuration() == WEBAUDIO_BLOCK_SIZE,
"Invalid WebAudio chunk size");
if (mDisabledTrackIDs.Contains(static_cast<TrackID>(AUDIO_TRACK))) {

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

@ -32,7 +32,6 @@ public:
DelayNodeEngine(AudioNode* aNode, AudioDestinationNode* aDestination,
double aMaxDelayTicks)
: AudioNodeEngine(aNode)
, mSource(nullptr)
, mDestination(aDestination->Stream())
// Keep the default value in sync with the default value in DelayNode::DelayNode.
, mDelay(0.f)
@ -52,11 +51,6 @@ public:
return this;
}
void SetSourceStream(AudioNodeStream* aSource)
{
mSource = aSource;
}
enum Parameters {
DELAY,
};
@ -82,7 +76,6 @@ public:
AudioBlock* aOutput,
bool* aFinished) override
{
MOZ_ASSERT(mSource == aStream, "Invalid source stream");
MOZ_ASSERT(aStream->SampleRate() == mDestination->SampleRate());
if (!aInput.IsSilentOrSubnormal()) {
@ -117,18 +110,19 @@ public:
// Skip output update if mLastChunks has already been set by
// ProduceBlockBeforeInput() when in a cycle.
if (!mHaveProducedBeforeInput) {
UpdateOutputBlock(aFrom, aOutput, 0.0);
UpdateOutputBlock(aStream, aFrom, aOutput, 0.0);
}
mHaveProducedBeforeInput = false;
mBuffer.NextBlock();
}
void UpdateOutputBlock(GraphTime aFrom, AudioBlock* aOutput, double minDelay)
void UpdateOutputBlock(AudioNodeStream* aStream, GraphTime aFrom,
AudioBlock* aOutput, double minDelay)
{
double maxDelay = mMaxDelay;
double sampleRate = mSource->SampleRate();
double sampleRate = aStream->SampleRate();
ChannelInterpretation channelInterpretation =
mSource->GetChannelInterpretation();
aStream->GetChannelInterpretation();
if (mDelay.HasSimpleValue()) {
// If this DelayNode is in a cycle, make sure the delay value is at least
// one block, even if that is greater than maxDelay.
@ -155,13 +149,14 @@ public:
}
}
virtual void ProduceBlockBeforeInput(GraphTime aFrom,
virtual void ProduceBlockBeforeInput(AudioNodeStream* aStream,
GraphTime aFrom,
AudioBlock* aOutput) override
{
if (mLeftOverData <= 0) {
aOutput->SetNull(WEBAUDIO_BLOCK_SIZE);
} else {
UpdateOutputBlock(aFrom, aOutput, WEBAUDIO_BLOCK_SIZE);
UpdateOutputBlock(aStream, aFrom, aOutput, WEBAUDIO_BLOCK_SIZE);
}
mHaveProducedBeforeInput = true;
}
@ -175,7 +170,6 @@ public:
{
size_t amount = AudioNodeEngine::SizeOfExcludingThis(aMallocSizeOf);
// Not owned:
// - mSource - probably not owned
// - mDestination - probably not owned
// - mDelay - shares ref with AudioNode, don't count
amount += mBuffer.SizeOfExcludingThis(aMallocSizeOf);
@ -187,7 +181,6 @@ public:
return aMallocSizeOf(this) + SizeOfExcludingThis(aMallocSizeOf);
}
AudioNodeStream* mSource;
AudioNodeStream* mDestination;
AudioParamTimeline mDelay;
DelayBuffer mBuffer;
@ -210,7 +203,6 @@ DelayNode::DelayNode(AudioContext* aContext, double aMaxDelay)
aContext->SampleRate() * aMaxDelay);
mStream = AudioNodeStream::Create(aContext, engine,
AudioNodeStream::NO_STREAM_FLAGS);
engine->SetSourceStream(mStream);
}
DelayNode::~DelayNode()