bug 1179662 handle null AudioNodeStream stream r=padenot

This commit is contained in:
Karl Tomlinson 2015-07-02 17:45:11 +12:00
parent 08a8f05f71
commit 09a0031122
3 changed files with 23 additions and 19 deletions

View File

@ -779,10 +779,13 @@ MediaRecorder::MediaRecorder(AudioNode& aSrcAudioNode,
mPipeStream = ctx->Graph()->CreateAudioNodeStream(engine,
MediaStreamGraph::EXTERNAL_STREAM,
ctx->SampleRate());
mInputPort = mPipeStream->AllocateInputPort(aSrcAudioNode.GetStream(),
MediaInputPort::FLAG_BLOCK_INPUT,
0,
aSrcOutput);
AudioNodeStream* ns = aSrcAudioNode.GetStream();
if (ns) {
mInputPort = mPipeStream->AllocateInputPort(aSrcAudioNode.GetStream(),
MediaInputPort::FLAG_BLOCK_INPUT,
0,
aSrcOutput);
}
}
mAudioNode = &aSrcAudioNode;
if (!gMediaRecorderLog) {

View File

@ -217,15 +217,13 @@ AudioNode::Connect(AudioNode& aDestination, uint32_t aOutput,
input->mInputNode = this;
input->mInputPort = aInput;
input->mOutputPort = aOutput;
if (aDestination.mStream) {
AudioNodeStream* destinationStream = aDestination.mStream;
if (mStream && destinationStream) {
// Connect streams in the MediaStreamGraph
MOZ_ASSERT(aDestination.mStream->AsProcessedStream());
ProcessedMediaStream* ps =
static_cast<ProcessedMediaStream*>(aDestination.mStream.get());
MOZ_ASSERT(aInput <= UINT16_MAX, "Unexpected large input port number");
MOZ_ASSERT(aOutput <= UINT16_MAX, "Unexpected large output port number");
input->mStreamPort =
ps->AllocateInputPort(mStream, MediaInputPort::FLAG_BLOCK_INPUT,
input->mStreamPort = destinationStream->
AllocateInputPort(mStream, MediaInputPort::FLAG_BLOCK_INPUT,
static_cast<uint16_t>(aInput),
static_cast<uint16_t>(aOutput));
}
@ -263,11 +261,13 @@ AudioNode::Connect(AudioParam& aDestination, uint32_t aOutput,
MediaStream* stream = aDestination.Stream();
MOZ_ASSERT(stream->AsProcessedStream());
ProcessedMediaStream* ps = static_cast<ProcessedMediaStream*>(stream);
// Setup our stream as an input to the AudioParam's stream
MOZ_ASSERT(aOutput <= UINT16_MAX, "Unexpected large output port number");
input->mStreamPort = ps->AllocateInputPort(mStream, MediaInputPort::FLAG_BLOCK_INPUT,
0, static_cast<uint16_t>(aOutput));
if (mStream) {
// Setup our stream as an input to the AudioParam's stream
MOZ_ASSERT(aOutput <= UINT16_MAX, "Unexpected large output port number");
input->mStreamPort =
ps->AllocateInputPort(mStream, MediaInputPort::FLAG_BLOCK_INPUT,
0, static_cast<uint16_t>(aOutput));
}
}
void

View File

@ -113,10 +113,11 @@ AudioParam::Stream()
mStream = stream.forget();
// Setup the AudioParam's stream as an input to the owner AudioNode's stream
MediaStream* nodeStream = mNode->GetStream();
MOZ_ASSERT(nodeStream->AsProcessedStream());
ProcessedMediaStream* ps = static_cast<ProcessedMediaStream*>(nodeStream);
mNodeStreamPort = ps->AllocateInputPort(mStream, MediaInputPort::FLAG_BLOCK_INPUT);
AudioNodeStream* nodeStream = mNode->GetStream();
if (nodeStream) {
mNodeStreamPort =
nodeStream->AllocateInputPort(mStream, MediaInputPort::FLAG_BLOCK_INPUT);
}
// Let the MSG's copy of AudioParamTimeline know about the change in the stream
mCallback(mNode);