зеркало из https://github.com/mozilla/gecko-dev.git
Backed out 5 changesets (bug 1205540) for Assertion Failurs in m2-e10s tests on a CLOSED TREE
Backed out changeset e89d8182d588 (bug 1205540) Backed out changeset abace4cdec06 (bug 1205540) Backed out changeset b3f6e1db7233 (bug 1205540) Backed out changeset 0d122cb34921 (bug 1205540) Backed out changeset 4de5f87180fb (bug 1205540)
This commit is contained in:
Родитель
3528a43c26
Коммит
1ae732f5ba
|
@ -2365,8 +2365,8 @@ MediaInputPort::Disconnect()
|
|||
return;
|
||||
|
||||
mSource->RemoveConsumer(this);
|
||||
mDest->RemoveInput(this);
|
||||
mSource = nullptr;
|
||||
mDest->RemoveInput(this);
|
||||
mDest = nullptr;
|
||||
|
||||
GraphImpl()->SetStreamOrderDirty();
|
||||
|
|
|
@ -65,39 +65,15 @@ public:
|
|||
{
|
||||
*aOutput = aInput;
|
||||
|
||||
if (aInput.IsNull()) {
|
||||
// If AnalyserNode::mChunks has only null chunks, then there is no need
|
||||
// to send further null chunks.
|
||||
if (mChunksToProcess <= 0) {
|
||||
if (mChunksToProcess != INT32_MIN) {
|
||||
mChunksToProcess = INT32_MIN;
|
||||
aStream->CheckForInactive();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
--mChunksToProcess;
|
||||
} else {
|
||||
// This many null chunks will be required to empty AnalyserNode::mChunks.
|
||||
mChunksToProcess = CHUNK_COUNT;
|
||||
}
|
||||
|
||||
nsRefPtr<TransferBuffer> transfer =
|
||||
new TransferBuffer(aStream, aInput.AsAudioChunk());
|
||||
NS_DispatchToMainThread(transfer);
|
||||
}
|
||||
|
||||
virtual bool IsActive() const override
|
||||
{
|
||||
return mChunksToProcess != INT32_MIN;
|
||||
}
|
||||
|
||||
virtual size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const override
|
||||
{
|
||||
return aMallocSizeOf(this) + SizeOfExcludingThis(aMallocSizeOf);
|
||||
}
|
||||
|
||||
int32_t mChunksToProcess = INT32_MIN;
|
||||
};
|
||||
|
||||
AnalyserNode::AnalyserNode(AudioContext* aContext)
|
||||
|
|
|
@ -111,11 +111,7 @@ public:
|
|||
virtual void SetInt32Parameter(uint32_t aIndex, int32_t aParam) override
|
||||
{
|
||||
switch (aIndex) {
|
||||
case AudioBufferSourceNode::SAMPLE_RATE:
|
||||
MOZ_ASSERT(aParam > 0);
|
||||
mBufferSampleRate = aParam;
|
||||
mSource->SetActive();
|
||||
break;
|
||||
case AudioBufferSourceNode::SAMPLE_RATE: mBufferSampleRate = aParam; break;
|
||||
case AudioBufferSourceNode::BUFFERSTART:
|
||||
MOZ_ASSERT(aParam >= 0);
|
||||
if (mBufferPosition == 0) {
|
||||
|
@ -470,21 +466,12 @@ public:
|
|||
return;
|
||||
}
|
||||
|
||||
StreamTime streamPosition = aStream->GetCurrentPosition();
|
||||
// We've finished if we've gone past mStop, or if we're past mDuration when
|
||||
// looping is disabled.
|
||||
if (streamPosition >= mStop ||
|
||||
(!mLoop && mBufferPosition >= mBufferEnd && !mRemainingResamplerTail)) {
|
||||
*aFinished = true;
|
||||
aOutput->SetNull(WEBAUDIO_BLOCK_SIZE);
|
||||
return;
|
||||
}
|
||||
|
||||
uint32_t channels = mBuffer ? mBuffer->GetChannels() : 0;
|
||||
|
||||
UpdateSampleRateIfNeeded(channels);
|
||||
|
||||
uint32_t written = 0;
|
||||
StreamTime streamPosition = aStream->GetCurrentPosition();
|
||||
while (written < WEBAUDIO_BLOCK_SIZE) {
|
||||
if (mStop != STREAM_TIME_MAX &&
|
||||
streamPosition >= mStop) {
|
||||
|
@ -512,12 +499,13 @@ public:
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
virtual bool IsActive() const override
|
||||
{
|
||||
// Whether buffer has been set and start() has been called.
|
||||
return mBufferSampleRate != 0;
|
||||
// We've finished if we've gone past mStop, or if we're past mDuration when
|
||||
// looping is disabled.
|
||||
if (streamPosition >= mStop ||
|
||||
(!mLoop && mBufferPosition >= mBufferEnd && !mRemainingResamplerTail)) {
|
||||
*aFinished = true;
|
||||
}
|
||||
}
|
||||
|
||||
virtual size_t SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const override
|
||||
|
|
|
@ -112,14 +112,6 @@ 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
|
||||
{
|
||||
public:
|
||||
|
@ -263,16 +255,6 @@ 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
|
||||
{
|
||||
if (aIndex == VOLUME) {
|
||||
|
|
|
@ -309,10 +309,8 @@ public:
|
|||
* aInput is guaranteed to have float sample format (if it has samples at all)
|
||||
* and to have been resampled to the sampling rate for the stream, and to have
|
||||
* exactly WEBAUDIO_BLOCK_SIZE samples.
|
||||
* *aFinished is set to false by the caller. The callee must not set this to
|
||||
* true unless silent output is produced. If set to true, we'll finish the
|
||||
* stream, consider this input inactive on any downstream nodes, and not
|
||||
* call this again.
|
||||
* *aFinished is set to false by the caller. If the callee sets it to true,
|
||||
* we'll finish the stream and not call this again.
|
||||
*/
|
||||
virtual void ProcessBlock(AudioNodeStream* aStream,
|
||||
const AudioBlock& aInput,
|
||||
|
@ -348,12 +346,6 @@ public:
|
|||
OutputChunks& aOutput,
|
||||
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
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
|
|
@ -34,7 +34,6 @@ AudioNodeStream::AudioNodeStream(AudioNodeEngine* aEngine,
|
|||
mSampleRate(aSampleRate),
|
||||
mFlags(aFlags),
|
||||
mNumberOfInputChannels(2),
|
||||
mIsActive(aEngine->IsActive()),
|
||||
mMarkAsFinishedAfterThisBlock(false),
|
||||
mAudioParamStream(false),
|
||||
mPassThrough(false)
|
||||
|
@ -50,7 +49,6 @@ AudioNodeStream::AudioNodeStream(AudioNodeEngine* aEngine,
|
|||
|
||||
AudioNodeStream::~AudioNodeStream()
|
||||
{
|
||||
MOZ_ASSERT(mActiveInputCount == 0);
|
||||
MOZ_COUNT_DTOR(AudioNodeStream);
|
||||
}
|
||||
|
||||
|
@ -522,14 +520,7 @@ AudioNodeStream::ProcessInput(GraphTime aFrom, GraphTime aTo, uint32_t aFlags)
|
|||
uint16_t outputCount = mLastChunks.Length();
|
||||
MOZ_ASSERT(outputCount == std::max(uint16_t(1), mEngine->OutputCount()));
|
||||
|
||||
if (!mIsActive) {
|
||||
// mLastChunks are already null.
|
||||
#ifdef DEBUG
|
||||
for (const auto& chunk : mLastChunks) {
|
||||
MOZ_ASSERT(chunk.IsNull());
|
||||
}
|
||||
#endif
|
||||
} else if (InMutedCycle()) {
|
||||
if (mFinished || InMutedCycle()) {
|
||||
mInputChunks.Clear();
|
||||
for (uint16_t i = 0; i < outputCount; ++i) {
|
||||
mLastChunks[i].SetNull(WEBAUDIO_BLOCK_SIZE);
|
||||
|
@ -558,7 +549,6 @@ AudioNodeStream::ProcessInput(GraphTime aFrom, GraphTime aTo, uint32_t aFlags)
|
|||
}
|
||||
if (finished) {
|
||||
mMarkAsFinishedAfterThisBlock = true;
|
||||
CheckForInactive();
|
||||
}
|
||||
|
||||
if (mDisabledTrackIDs.Contains(static_cast<TrackID>(AUDIO_TRACK))) {
|
||||
|
@ -589,7 +579,7 @@ AudioNodeStream::ProduceOutputBeforeInput(GraphTime aFrom)
|
|||
MOZ_ASSERT(!InMutedCycle(), "DelayNodes should break cycles");
|
||||
MOZ_ASSERT(mLastChunks.Length() == 1);
|
||||
|
||||
if (!mIsActive) {
|
||||
if (mFinished) {
|
||||
mLastChunks[0].SetNull(WEBAUDIO_BLOCK_SIZE);
|
||||
} else {
|
||||
mEngine->ProduceBlockBeforeInput(&mLastChunks[0]);
|
||||
|
@ -694,88 +684,4 @@ AudioNodeStream::DestinationTimeFromTicks(AudioNodeStream* aDestination,
|
|||
return StreamTimeToSeconds(destinationTime);
|
||||
}
|
||||
|
||||
void
|
||||
AudioNodeStream::AddInput(MediaInputPort* aPort)
|
||||
{
|
||||
ProcessedMediaStream::AddInput(aPort);
|
||||
AudioNodeStream* ns = aPort->GetSource()->AsAudioNodeStream();
|
||||
// Streams that are not AudioNodeStreams are considered active.
|
||||
if (!ns || (ns->mIsActive && !ns->IsAudioParamStream())) {
|
||||
IncrementActiveInputCount();
|
||||
}
|
||||
}
|
||||
void
|
||||
AudioNodeStream::RemoveInput(MediaInputPort* aPort)
|
||||
{
|
||||
ProcessedMediaStream::RemoveInput(aPort);
|
||||
AudioNodeStream* ns = aPort->GetSource()->AsAudioNodeStream();
|
||||
// Streams that are not AudioNodeStreams are considered active.
|
||||
if (!ns || (ns->mIsActive && !ns->IsAudioParamStream())) {
|
||||
DecrementActiveInputCount();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
AudioNodeStream::SetActive()
|
||||
{
|
||||
if (mIsActive || mMarkAsFinishedAfterThisBlock) {
|
||||
return;
|
||||
}
|
||||
|
||||
mIsActive = true;
|
||||
if (IsAudioParamStream()) {
|
||||
// Consumers merely influence stream order.
|
||||
// They do not read from the stream.
|
||||
return;
|
||||
}
|
||||
|
||||
for (const auto& consumer : mConsumers) {
|
||||
AudioNodeStream* ns = consumer->GetDestination()->AsAudioNodeStream();
|
||||
if (ns) {
|
||||
ns->IncrementActiveInputCount();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
AudioNodeStream::CheckForInactive()
|
||||
{
|
||||
if (((mActiveInputCount > 0 || mEngine->IsActive()) &&
|
||||
!mMarkAsFinishedAfterThisBlock) ||
|
||||
!mIsActive) {
|
||||
return;
|
||||
}
|
||||
|
||||
mIsActive = false;
|
||||
mInputChunks.Clear(); // not required for foreseeable future
|
||||
for (auto& chunk : mLastChunks) {
|
||||
chunk.SetNull(WEBAUDIO_BLOCK_SIZE);
|
||||
}
|
||||
if (IsAudioParamStream()) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (const auto& consumer : mConsumers) {
|
||||
AudioNodeStream* ns = consumer->GetDestination()->AsAudioNodeStream();
|
||||
if (ns) {
|
||||
ns->DecrementActiveInputCount();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
AudioNodeStream::IncrementActiveInputCount()
|
||||
{
|
||||
++mActiveInputCount;
|
||||
SetActive();
|
||||
}
|
||||
|
||||
void
|
||||
AudioNodeStream::DecrementActiveInputCount()
|
||||
{
|
||||
MOZ_ASSERT(mActiveInputCount > 0);
|
||||
--mActiveInputCount;
|
||||
CheckForInactive();
|
||||
}
|
||||
|
||||
} // namespace mozilla
|
||||
|
|
|
@ -106,8 +106,6 @@ public:
|
|||
}
|
||||
|
||||
virtual AudioNodeStream* AsAudioNodeStream() override { return this; }
|
||||
virtual void AddInput(MediaInputPort* aPort) override;
|
||||
virtual void RemoveInput(MediaInputPort* aPort) override;
|
||||
|
||||
// Graph thread only
|
||||
void SetStreamTimeParameterImpl(uint32_t aIndex, MediaStream* aRelativeToStream,
|
||||
|
@ -167,22 +165,6 @@ public:
|
|||
void SizeOfAudioNodesIncludingThis(MallocSizeOf aMallocSizeOf,
|
||||
AudioNodeSizes& aUsage) const;
|
||||
|
||||
/*
|
||||
* SetActive() is called when either an active input is added or the engine
|
||||
* for a source node transitions from inactive to active. This is not
|
||||
* called from engines for processing nodes because they only become active
|
||||
* when there are active input streams, in which case this stream is already
|
||||
* active.
|
||||
*/
|
||||
void SetActive();
|
||||
/*
|
||||
* CheckForInactive() is called when the engine transitions from active to
|
||||
* inactive, or an active input is removed, or the stream finishes. If the
|
||||
* stream is now inactive, then mInputChunks will be cleared and mLastChunks
|
||||
* will be set to null. ProcessBlock() will not be called on the engine
|
||||
* again until SetActive() is called.
|
||||
*/
|
||||
void CheckForInactive();
|
||||
|
||||
protected:
|
||||
virtual void DestroyImpl() override;
|
||||
|
@ -198,8 +180,6 @@ protected:
|
|||
|
||||
uint32_t ComputedNumberOfChannels(uint32_t aInputChannelCount);
|
||||
void ObtainInputBlock(AudioBlock& aTmpChunk, uint32_t aPortIndex);
|
||||
void IncrementActiveInputCount();
|
||||
void DecrementActiveInputCount();
|
||||
|
||||
// The engine that will generate output for this node.
|
||||
nsAutoPtr<AudioNodeEngine> mEngine;
|
||||
|
@ -212,16 +192,11 @@ protected:
|
|||
const TrackRate mSampleRate;
|
||||
// Whether this is an internal or external stream
|
||||
const Flags mFlags;
|
||||
// The number of input streams that may provide non-silent input.
|
||||
uint32_t mActiveInputCount = 0;
|
||||
// The number of input channels that this stream requires. 0 means don't care.
|
||||
uint32_t mNumberOfInputChannels;
|
||||
// The mixing modes
|
||||
ChannelCountMode mChannelCountMode;
|
||||
ChannelInterpretation mChannelInterpretation;
|
||||
// Streams are considered active if the stream has not finished and either
|
||||
// the engine is active or there are active input streams.
|
||||
bool mIsActive;
|
||||
// Whether the stream should be marked as finished as soon
|
||||
// as the current time range has been computed block by block.
|
||||
bool mMarkAsFinishedAfterThisBlock;
|
||||
|
|
|
@ -155,7 +155,6 @@ public:
|
|||
if (!hasTail) {
|
||||
if (!mBiquads.IsEmpty()) {
|
||||
mBiquads.Clear();
|
||||
aStream->CheckForInactive();
|
||||
|
||||
nsRefPtr<PlayingRefChangeHandler> refchanged =
|
||||
new PlayingRefChangeHandler(aStream, PlayingRefChangeHandler::RELEASE);
|
||||
|
@ -212,11 +211,6 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
virtual bool IsActive() const override
|
||||
{
|
||||
return !mBiquads.IsEmpty();
|
||||
}
|
||||
|
||||
virtual size_t SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const override
|
||||
{
|
||||
// Not owned:
|
||||
|
|
|
@ -120,7 +120,6 @@ public:
|
|||
} else {
|
||||
if (mLeftOverData != INT32_MIN) {
|
||||
mLeftOverData = INT32_MIN;
|
||||
aStream->CheckForInactive();
|
||||
nsRefPtr<PlayingRefChanged> refchanged =
|
||||
new PlayingRefChanged(aStream, PlayingRefChanged::RELEASE);
|
||||
aStream->Graph()->
|
||||
|
@ -155,11 +154,6 @@ public:
|
|||
mReverb->process(&input, aOutput, WEBAUDIO_BLOCK_SIZE);
|
||||
}
|
||||
|
||||
virtual bool IsActive() const override
|
||||
{
|
||||
return mLeftOverData != INT32_MIN;
|
||||
}
|
||||
|
||||
virtual size_t SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const override
|
||||
{
|
||||
size_t amount = AudioNodeEngine::SizeOfExcludingThis(aMallocSizeOf);
|
||||
|
|
|
@ -96,8 +96,6 @@ public:
|
|||
} else {
|
||||
if (mLeftOverData != INT32_MIN) {
|
||||
mLeftOverData = INT32_MIN;
|
||||
aStream->CheckForInactive();
|
||||
|
||||
// Delete our buffered data now we no longer need it
|
||||
mBuffer.Reset();
|
||||
|
||||
|
@ -106,7 +104,7 @@ public:
|
|||
aStream->Graph()->
|
||||
DispatchToMainThreadAfterStreamStateUpdate(refchanged.forget());
|
||||
}
|
||||
aOutput->SetNull(WEBAUDIO_BLOCK_SIZE);
|
||||
*aOutput = aInput;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -163,11 +161,6 @@ public:
|
|||
mHaveProducedBeforeInput = true;
|
||||
}
|
||||
|
||||
virtual bool IsActive() const override
|
||||
{
|
||||
return mLeftOverData != INT32_MIN;
|
||||
}
|
||||
|
||||
virtual size_t SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const override
|
||||
{
|
||||
size_t amount = AudioNodeEngine::SizeOfExcludingThis(aMallocSizeOf);
|
||||
|
|
|
@ -81,10 +81,7 @@ public:
|
|||
virtual void SetStreamTimeParameter(uint32_t aIndex, StreamTime aParam) override
|
||||
{
|
||||
switch (aIndex) {
|
||||
case START:
|
||||
mStart = aParam;
|
||||
mSource->SetActive();
|
||||
break;
|
||||
case START: mStart = aParam; break;
|
||||
case STOP: mStop = aParam; break;
|
||||
default:
|
||||
NS_ERROR("Bad OscillatorNodeEngine StreamTimeParameter");
|
||||
|
@ -333,12 +330,6 @@ public:
|
|||
|
||||
}
|
||||
|
||||
virtual bool IsActive() const override
|
||||
{
|
||||
// start() has been called.
|
||||
return mStart != -1;
|
||||
}
|
||||
|
||||
virtual size_t SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const override
|
||||
{
|
||||
size_t amount = AudioNodeEngine::SizeOfExcludingThis(aMallocSizeOf);
|
||||
|
|
|
@ -149,7 +149,6 @@ public:
|
|||
} else {
|
||||
if (mLeftOverData != INT_MIN) {
|
||||
mLeftOverData = INT_MIN;
|
||||
aStream->CheckForInactive();
|
||||
mHRTFPanner->reset();
|
||||
|
||||
nsRefPtr<PlayingRefChangeHandler> refchanged =
|
||||
|
@ -157,7 +156,7 @@ public:
|
|||
aStream->Graph()->
|
||||
DispatchToMainThreadAfterStreamStateUpdate(refchanged.forget());
|
||||
}
|
||||
aOutput->SetNull(WEBAUDIO_BLOCK_SIZE);
|
||||
*aOutput = aInput;
|
||||
return;
|
||||
}
|
||||
} else if (mPanningModelFunction == &PannerNodeEngine::HRTFPanningFunction) {
|
||||
|
@ -173,11 +172,6 @@ public:
|
|||
(this->*mPanningModelFunction)(aInput, aOutput);
|
||||
}
|
||||
|
||||
virtual bool IsActive() const override
|
||||
{
|
||||
return mLeftOverData != INT_MIN;
|
||||
}
|
||||
|
||||
void ComputeAzimuthAndElevation(float& aAzimuth, float& aElevation);
|
||||
float ComputeConeGain();
|
||||
// Compute how much the distance contributes to the gain reduction.
|
||||
|
|
|
@ -333,14 +333,6 @@ 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
|
||||
{
|
||||
// Not owned:
|
||||
|
|
Загрузка…
Ссылка в новой задаче