зеркало из https://github.com/mozilla/gecko-dev.git
bug 1179662 specify AudioNode::mStream as AudioNodeStream r=padenot
--HG-- extra : rebase_source : 30cbe8f0b513063acf0e1c62078474f8f147a0ae
This commit is contained in:
Родитель
2c46294a5d
Коммит
7f8f4121f7
|
@ -1140,7 +1140,7 @@ MediaRecorder::GetSourceMediaStream()
|
|||
return mDOMStream->GetStream();
|
||||
}
|
||||
MOZ_ASSERT(mAudioNode != nullptr);
|
||||
return mPipeStream != nullptr ? mPipeStream : mAudioNode->Stream();
|
||||
return mPipeStream != nullptr ? mPipeStream.get() : mAudioNode->Stream();
|
||||
}
|
||||
|
||||
nsIPrincipal*
|
||||
|
|
|
@ -61,7 +61,7 @@ public:
|
|||
mLoopStart(0), mLoopEnd(0),
|
||||
mBufferSampleRate(0), mBufferPosition(0), mChannels(0),
|
||||
mDopplerShift(1.0f),
|
||||
mDestination(static_cast<AudioNodeStream*>(aDestination->Stream())),
|
||||
mDestination(aDestination->Stream()),
|
||||
mPlaybackRateTimeline(1.0f),
|
||||
mDetuneTimeline(0.0f),
|
||||
mLoop(false)
|
||||
|
@ -560,7 +560,7 @@ AudioBufferSourceNode::AudioBufferSourceNode(AudioContext* aContext)
|
|||
{
|
||||
AudioBufferSourceNodeEngine* engine = new AudioBufferSourceNodeEngine(this, aContext->Destination());
|
||||
mStream = aContext->Graph()->CreateAudioNodeStream(engine, MediaStreamGraph::SOURCE_STREAM);
|
||||
engine->SetSourceStream(static_cast<AudioNodeStream*>(mStream.get()));
|
||||
engine->SetSourceStream(mStream);
|
||||
mStream->AddMainThreadListener(this);
|
||||
}
|
||||
|
||||
|
@ -621,7 +621,7 @@ AudioBufferSourceNode::Start(double aWhen, double aOffset,
|
|||
}
|
||||
mStartCalled = true;
|
||||
|
||||
AudioNodeStream* ns = static_cast<AudioNodeStream*>(mStream.get());
|
||||
AudioNodeStream* ns = mStream;
|
||||
if (!ns) {
|
||||
// Nothing to play, or we're already dead for some reason
|
||||
return;
|
||||
|
@ -646,8 +646,8 @@ AudioBufferSourceNode::Start(double aWhen, double aOffset,
|
|||
void
|
||||
AudioBufferSourceNode::SendBufferParameterToStream(JSContext* aCx)
|
||||
{
|
||||
AudioNodeStream* ns = static_cast<AudioNodeStream*>(mStream.get());
|
||||
if (!mStream) {
|
||||
AudioNodeStream* ns = mStream;
|
||||
if (!ns) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -705,7 +705,7 @@ AudioBufferSourceNode::Stop(double aWhen, ErrorResult& aRv)
|
|||
return;
|
||||
}
|
||||
|
||||
AudioNodeStream* ns = static_cast<AudioNodeStream*>(mStream.get());
|
||||
AudioNodeStream* ns = mStream;
|
||||
if (!ns || !Context()) {
|
||||
// We've already stopped and had our stream shut down
|
||||
return;
|
||||
|
|
|
@ -369,7 +369,7 @@ AudioDestinationNode::AudioDestinationNode(AudioContext* aContext,
|
|||
mStream->AddAudioOutput(&gWebAudioOutputKey);
|
||||
|
||||
if (!aIsOffline) {
|
||||
graph->NotifyWhenGraphStarted(mStream->AsAudioNodeStream());
|
||||
graph->NotifyWhenGraphStarted(mStream);
|
||||
}
|
||||
|
||||
if (aChannel != AudioChannel::Normal) {
|
||||
|
@ -438,9 +438,8 @@ AudioDestinationNode::NotifyMainThreadStreamFinished()
|
|||
void
|
||||
AudioDestinationNode::FireOfflineCompletionEvent()
|
||||
{
|
||||
AudioNodeStream* stream = static_cast<AudioNodeStream*>(Stream());
|
||||
OfflineDestinationNodeEngine* engine =
|
||||
static_cast<OfflineDestinationNodeEngine*>(stream->Engine());
|
||||
static_cast<OfflineDestinationNodeEngine*>(Stream()->Engine());
|
||||
engine->FireOfflineCompletionEvent(this);
|
||||
}
|
||||
|
||||
|
|
|
@ -273,33 +273,29 @@ AudioNode::Connect(AudioParam& aDestination, uint32_t aOutput,
|
|||
void
|
||||
AudioNode::SendDoubleParameterToStream(uint32_t aIndex, double aValue)
|
||||
{
|
||||
AudioNodeStream* ns = static_cast<AudioNodeStream*>(mStream.get());
|
||||
MOZ_ASSERT(ns, "How come we don't have a stream here?");
|
||||
ns->SetDoubleParameter(aIndex, aValue);
|
||||
MOZ_ASSERT(mStream, "How come we don't have a stream here?");
|
||||
mStream->SetDoubleParameter(aIndex, aValue);
|
||||
}
|
||||
|
||||
void
|
||||
AudioNode::SendInt32ParameterToStream(uint32_t aIndex, int32_t aValue)
|
||||
{
|
||||
AudioNodeStream* ns = static_cast<AudioNodeStream*>(mStream.get());
|
||||
MOZ_ASSERT(ns, "How come we don't have a stream here?");
|
||||
ns->SetInt32Parameter(aIndex, aValue);
|
||||
MOZ_ASSERT(mStream, "How come we don't have a stream here?");
|
||||
mStream->SetInt32Parameter(aIndex, aValue);
|
||||
}
|
||||
|
||||
void
|
||||
AudioNode::SendThreeDPointParameterToStream(uint32_t aIndex, const ThreeDPoint& aValue)
|
||||
{
|
||||
AudioNodeStream* ns = static_cast<AudioNodeStream*>(mStream.get());
|
||||
MOZ_ASSERT(ns, "How come we don't have a stream here?");
|
||||
ns->SetThreeDPointParameter(aIndex, aValue);
|
||||
MOZ_ASSERT(mStream, "How come we don't have a stream here?");
|
||||
mStream->SetThreeDPointParameter(aIndex, aValue);
|
||||
}
|
||||
|
||||
void
|
||||
AudioNode::SendChannelMixingParametersToStream()
|
||||
{
|
||||
AudioNodeStream* ns = static_cast<AudioNodeStream*>(mStream.get());
|
||||
MOZ_ASSERT(ns, "How come we don't have a stream here?");
|
||||
ns->SetChannelMixingParameters(mChannelCount, mChannelCountMode,
|
||||
MOZ_ASSERT(mStream, "How come we don't have a stream here?");
|
||||
mStream->SetChannelMixingParameters(mChannelCount, mChannelCountMode,
|
||||
mChannelInterpretation);
|
||||
}
|
||||
|
||||
|
@ -307,7 +303,7 @@ void
|
|||
AudioNode::SendTimelineParameterToStream(AudioNode* aNode, uint32_t aIndex,
|
||||
const AudioParamTimeline& aValue)
|
||||
{
|
||||
AudioNodeStream* ns = static_cast<AudioNodeStream*>(aNode->mStream.get());
|
||||
AudioNodeStream* ns = aNode->mStream;
|
||||
MOZ_ASSERT(ns, "How come we don't have a stream here?");
|
||||
ns->SetTimelineParameter(aIndex, aValue);
|
||||
}
|
||||
|
@ -391,7 +387,7 @@ AudioNode::DestroyMediaStream()
|
|||
// hold the lock when the stream gets destroyed, because that will
|
||||
// cause the engine to be destroyed as well, and we don't want to
|
||||
// be holding the lock as we're trying to destroy it!
|
||||
AudioNodeStream* ns = static_cast<AudioNodeStream*>(mStream.get());
|
||||
AudioNodeStream* ns = mStream;
|
||||
MutexAutoLock lock(ns->Engine()->NodeMutex());
|
||||
MOZ_ASSERT(ns, "How come we don't have a stream here?");
|
||||
MOZ_ASSERT(ns->Engine()->Node() == this, "Invalid node reference");
|
||||
|
@ -431,9 +427,8 @@ AudioNode::SetPassThrough(bool aPassThrough)
|
|||
{
|
||||
MOZ_ASSERT(NumberOfInputs() <= 1 && NumberOfOutputs() == 1);
|
||||
mPassThrough = aPassThrough;
|
||||
AudioNodeStream* ns = static_cast<AudioNodeStream*>(mStream.get());
|
||||
MOZ_ASSERT(ns, "How come we don't have a stream here?");
|
||||
ns->SetPassThrough(mPassThrough);
|
||||
MOZ_ASSERT(mStream, "How come we don't have a stream here?");
|
||||
mStream->SetPassThrough(mPassThrough);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -167,7 +167,7 @@ public:
|
|||
uint32_t mOutputPort;
|
||||
};
|
||||
|
||||
MediaStream* Stream() { return mStream; }
|
||||
AudioNodeStream* Stream() { return mStream; }
|
||||
|
||||
const nsTArray<InputNode>& InputNodes() const
|
||||
{
|
||||
|
@ -221,8 +221,7 @@ private:
|
|||
|
||||
protected:
|
||||
// Must be set in the constructor. Must not be null unless finished.
|
||||
// If MaxNumberOfInputs() is > 0, then mStream must be a ProcessedMediaStream.
|
||||
nsRefPtr<MediaStream> mStream;
|
||||
nsRefPtr<AudioNodeStream> mStream;
|
||||
|
||||
private:
|
||||
// For every InputNode, there is a corresponding entry in mOutputNodes of the
|
||||
|
|
|
@ -79,7 +79,7 @@ public:
|
|||
BiquadFilterNodeEngine(AudioNode* aNode, AudioDestinationNode* aDestination)
|
||||
: AudioNodeEngine(aNode)
|
||||
, mSource(nullptr)
|
||||
, mDestination(static_cast<AudioNodeStream*> (aDestination->Stream()))
|
||||
, mDestination(aDestination->Stream())
|
||||
// Keep the default values in sync with the default values in
|
||||
// BiquadFilterNode::BiquadFilterNode
|
||||
, mType(BiquadFilterType::Lowpass)
|
||||
|
@ -251,7 +251,7 @@ BiquadFilterNode::BiquadFilterNode(AudioContext* aContext)
|
|||
{
|
||||
BiquadFilterNodeEngine* engine = new BiquadFilterNodeEngine(this, aContext->Destination());
|
||||
mStream = aContext->Graph()->CreateAudioNodeStream(engine, MediaStreamGraph::INTERNAL_STREAM);
|
||||
engine->SetSourceStream(static_cast<AudioNodeStream*> (mStream.get()));
|
||||
engine->SetSourceStream(mStream);
|
||||
}
|
||||
|
||||
BiquadFilterNode::~BiquadFilterNode()
|
||||
|
|
|
@ -241,7 +241,7 @@ ConvolverNode::SetBuffer(JSContext* aCx, AudioBuffer* aBuffer, ErrorResult& aRv)
|
|||
mBuffer = aBuffer;
|
||||
|
||||
// Send the buffer to the stream
|
||||
AudioNodeStream* ns = static_cast<AudioNodeStream*>(mStream.get());
|
||||
AudioNodeStream* ns = mStream;
|
||||
MOZ_ASSERT(ns, "Why don't we have a stream here?");
|
||||
if (mBuffer) {
|
||||
uint32_t length = mBuffer->Length();
|
||||
|
|
|
@ -33,7 +33,7 @@ public:
|
|||
double aMaxDelayTicks)
|
||||
: AudioNodeEngine(aNode)
|
||||
, mSource(nullptr)
|
||||
, mDestination(static_cast<AudioNodeStream*> (aDestination->Stream()))
|
||||
, mDestination(aDestination->Stream())
|
||||
// Keep the default value in sync with the default value in DelayNode::DelayNode.
|
||||
, mDelay(0.f)
|
||||
// Use a smoothing range of 20ms
|
||||
|
@ -199,7 +199,7 @@ DelayNode::DelayNode(AudioContext* aContext, double aMaxDelay)
|
|||
new DelayNodeEngine(this, aContext->Destination(),
|
||||
aContext->SampleRate() * aMaxDelay);
|
||||
mStream = aContext->Graph()->CreateAudioNodeStream(engine, MediaStreamGraph::INTERNAL_STREAM);
|
||||
engine->SetSourceStream(static_cast<AudioNodeStream*> (mStream.get()));
|
||||
engine->SetSourceStream(mStream);
|
||||
}
|
||||
|
||||
DelayNode::~DelayNode()
|
||||
|
|
|
@ -37,7 +37,7 @@ public:
|
|||
AudioDestinationNode* aDestination)
|
||||
: AudioNodeEngine(aNode)
|
||||
, mSource(nullptr)
|
||||
, mDestination(static_cast<AudioNodeStream*> (aDestination->Stream()))
|
||||
, mDestination(aDestination->Stream())
|
||||
// Keep the default value in sync with the default value in
|
||||
// DynamicsCompressorNode::DynamicsCompressorNode.
|
||||
, mThreshold(-24.f)
|
||||
|
@ -210,7 +210,7 @@ DynamicsCompressorNode::DynamicsCompressorNode(AudioContext* aContext)
|
|||
{
|
||||
DynamicsCompressorNodeEngine* engine = new DynamicsCompressorNodeEngine(this, aContext->Destination());
|
||||
mStream = aContext->Graph()->CreateAudioNodeStream(engine, MediaStreamGraph::INTERNAL_STREAM);
|
||||
engine->SetSourceStream(static_cast<AudioNodeStream*> (mStream.get()));
|
||||
engine->SetSourceStream(mStream);
|
||||
}
|
||||
|
||||
DynamicsCompressorNode::~DynamicsCompressorNode()
|
||||
|
|
|
@ -29,7 +29,7 @@ public:
|
|||
GainNodeEngine(AudioNode* aNode, AudioDestinationNode* aDestination)
|
||||
: AudioNodeEngine(aNode)
|
||||
, mSource(nullptr)
|
||||
, mDestination(static_cast<AudioNodeStream*> (aDestination->Stream()))
|
||||
, mDestination(aDestination->Stream())
|
||||
// Keep the default value in sync with the default value in GainNode::GainNode.
|
||||
, mGain(1.f)
|
||||
{
|
||||
|
@ -130,7 +130,7 @@ GainNode::GainNode(AudioContext* aContext)
|
|||
{
|
||||
GainNodeEngine* engine = new GainNodeEngine(this, aContext->Destination());
|
||||
mStream = aContext->Graph()->CreateAudioNodeStream(engine, MediaStreamGraph::INTERNAL_STREAM);
|
||||
engine->SetSourceStream(static_cast<AudioNodeStream*> (mStream.get()));
|
||||
engine->SetSourceStream(mStream);
|
||||
}
|
||||
|
||||
GainNode::~GainNode()
|
||||
|
|
|
@ -29,7 +29,7 @@ public:
|
|||
OscillatorNodeEngine(AudioNode* aNode, AudioDestinationNode* aDestination)
|
||||
: AudioNodeEngine(aNode)
|
||||
, mSource(nullptr)
|
||||
, mDestination(static_cast<AudioNodeStream*> (aDestination->Stream()))
|
||||
, mDestination(aDestination->Stream())
|
||||
, mStart(-1)
|
||||
, mStop(STREAM_TIME_MAX)
|
||||
// Keep the default values in sync with OscillatorNode::OscillatorNode.
|
||||
|
@ -387,7 +387,7 @@ OscillatorNode::OscillatorNode(AudioContext* aContext)
|
|||
{
|
||||
OscillatorNodeEngine* engine = new OscillatorNodeEngine(this, aContext->Destination());
|
||||
mStream = aContext->Graph()->CreateAudioNodeStream(engine, MediaStreamGraph::SOURCE_STREAM);
|
||||
engine->SetSourceStream(static_cast<AudioNodeStream*> (mStream.get()));
|
||||
engine->SetSourceStream(mStream);
|
||||
mStream->AddMainThreadListener(this);
|
||||
}
|
||||
|
||||
|
@ -467,14 +467,13 @@ void OscillatorNode::SendPeriodicWaveToStream()
|
|||
{
|
||||
NS_ASSERTION(mType == OscillatorType::Custom,
|
||||
"Sending custom waveform to engine thread with non-custom type");
|
||||
AudioNodeStream* ns = static_cast<AudioNodeStream*>(mStream.get());
|
||||
MOZ_ASSERT(ns, "Missing node stream.");
|
||||
MOZ_ASSERT(mStream, "Missing node stream.");
|
||||
MOZ_ASSERT(mPeriodicWave, "Send called without PeriodicWave object.");
|
||||
SendInt32ParameterToStream(OscillatorNodeEngine::PERIODICWAVE,
|
||||
mPeriodicWave->DataLength());
|
||||
nsRefPtr<ThreadSharedFloatArrayBufferList> data =
|
||||
mPeriodicWave->GetThreadSharedBuffer();
|
||||
ns->SetBuffer(data.forget());
|
||||
mStream->SetBuffer(data.forget());
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -491,15 +490,14 @@ OscillatorNode::Start(double aWhen, ErrorResult& aRv)
|
|||
}
|
||||
mStartCalled = true;
|
||||
|
||||
AudioNodeStream* ns = static_cast<AudioNodeStream*>(mStream.get());
|
||||
if (!ns) {
|
||||
if (!mStream) {
|
||||
// Nothing to play, or we're already dead for some reason
|
||||
return;
|
||||
}
|
||||
|
||||
// TODO: Perhaps we need to do more here.
|
||||
ns->SetStreamTimeParameter(OscillatorNodeEngine::START,
|
||||
Context(), aWhen);
|
||||
mStream->SetStreamTimeParameter(OscillatorNodeEngine::START,
|
||||
Context(), aWhen);
|
||||
|
||||
MarkActive();
|
||||
}
|
||||
|
@ -517,15 +515,14 @@ OscillatorNode::Stop(double aWhen, ErrorResult& aRv)
|
|||
return;
|
||||
}
|
||||
|
||||
AudioNodeStream* ns = static_cast<AudioNodeStream*>(mStream.get());
|
||||
if (!ns || !Context()) {
|
||||
if (!mStream || !Context()) {
|
||||
// We've already stopped and had our stream shut down
|
||||
return;
|
||||
}
|
||||
|
||||
// TODO: Perhaps we need to do more here.
|
||||
ns->SetStreamTimeParameter(OscillatorNodeEngine::STOP,
|
||||
Context(), std::max(0.0, aWhen));
|
||||
mStream->SetStreamTimeParameter(OscillatorNodeEngine::STOP,
|
||||
Context(), std::max(0.0, aWhen));
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -249,7 +249,7 @@ public:
|
|||
: AudioNodeEngine(aNode)
|
||||
, mSharedBuffers(aNode->GetSharedBuffers())
|
||||
, mSource(nullptr)
|
||||
, mDestination(static_cast<AudioNodeStream*> (aDestination->Stream()))
|
||||
, mDestination(aDestination->Stream())
|
||||
, mBufferSize(aBufferSize)
|
||||
, mInputWriteIndex(0)
|
||||
, mSeenNonSilenceInput(false)
|
||||
|
@ -490,7 +490,7 @@ ScriptProcessorNode::ScriptProcessorNode(AudioContext* aContext,
|
|||
BufferSize(),
|
||||
aNumberOfInputChannels);
|
||||
mStream = aContext->Graph()->CreateAudioNodeStream(engine, MediaStreamGraph::INTERNAL_STREAM);
|
||||
engine->SetSourceStream(static_cast<AudioNodeStream*> (mStream.get()));
|
||||
engine->SetSourceStream(mStream);
|
||||
}
|
||||
|
||||
ScriptProcessorNode::~ScriptProcessorNode()
|
||||
|
|
|
@ -34,7 +34,7 @@ public:
|
|||
AudioDestinationNode* aDestination)
|
||||
: AudioNodeEngine(aNode)
|
||||
, mSource(nullptr)
|
||||
, mDestination(static_cast<AudioNodeStream*>(aDestination->Stream()))
|
||||
, mDestination(aDestination->Stream())
|
||||
// Keep the default value in sync with the default value in
|
||||
// StereoPannerNode::StereoPannerNode.
|
||||
, mPan(0.f)
|
||||
|
@ -183,7 +183,7 @@ StereoPannerNode::StereoPannerNode(AudioContext* aContext)
|
|||
StereoPannerNodeEngine* engine = new StereoPannerNodeEngine(this, aContext->Destination());
|
||||
mStream = aContext->Graph()->CreateAudioNodeStream(engine,
|
||||
MediaStreamGraph::INTERNAL_STREAM);
|
||||
engine->SetSourceStream(static_cast<AudioNodeStream*>(mStream.get()));
|
||||
engine->SetSourceStream(mStream);
|
||||
}
|
||||
|
||||
StereoPannerNode::~StereoPannerNode()
|
||||
|
|
|
@ -326,7 +326,7 @@ WaveShaperNode::SetCurve(const Nullable<Float32Array>& aCurve)
|
|||
mCurve = nullptr;
|
||||
}
|
||||
|
||||
AudioNodeStream* ns = static_cast<AudioNodeStream*>(mStream.get());
|
||||
AudioNodeStream* ns = mStream;
|
||||
MOZ_ASSERT(ns, "Why don't we have a stream here?");
|
||||
ns->SetRawArrayData(curve);
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче