From 4d907bb120ca828968d1b3fb5eeb0c1bb0fdea11 Mon Sep 17 00:00:00 2001 From: Karl Tomlinson Date: Wed, 15 Jan 2020 14:44:39 +0000 Subject: [PATCH] Bug 1606148 align ProcessBlocksOnPorts() Span parameter lengths with number of inputs and outputs r=padenot Differential Revision: https://phabricator.services.mozilla.com/D59190 --HG-- extra : moz-landing-system : lando --- dom/media/webaudio/AudioNodeEngine.h | 16 ++++++---------- dom/media/webaudio/AudioNodeTrack.cpp | 6 ++++-- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/dom/media/webaudio/AudioNodeEngine.h b/dom/media/webaudio/AudioNodeEngine.h index 63c5e9cc315f..f205b5d479ad 100644 --- a/dom/media/webaudio/AudioNodeEngine.h +++ b/dom/media/webaudio/AudioNodeEngine.h @@ -315,18 +315,14 @@ class AudioNodeEngine { /** * Produce the next block of audio samples, given input samples in the aInput - * array. There is one input sample per active port in aInput, in order. + * array. There is one input sample per port in aInput, in order. * This is the multi-input/output version of ProcessBlock. Only one kind - * of ProcessBlock is called on each node, depending on whether the - * number of inputs and outputs are both 1 or not. + * of ProcessBlock is called on each node. ProcessBlocksOnPorts() is called + * instead of ProcessBlock() if either the number of inputs or the number of + * outputs is greater than 1. * - * aInput is always guaranteed to not contain more input AudioChunks than the - * maximum number of inputs for the node. It is the responsibility of the - * overrides of this function to make sure they will only add a maximum number - * of AudioChunks to aOutput as advertized by the AudioNode implementation. - * An engine may choose to produce fewer inputs than advertizes by the - * corresponding AudioNode, in which case it will be interpreted as a channel - * of silence. + * The numbers of AudioBlocks in aInput and aOutput are always guaranteed to + * match the numbers of inputs and outputs for the node. */ virtual void ProcessBlocksOnPorts(AudioNodeTrack* aTrack, Span aInput, diff --git a/dom/media/webaudio/AudioNodeTrack.cpp b/dom/media/webaudio/AudioNodeTrack.cpp index 9cfd9eb22df8..efe389f291e7 100644 --- a/dom/media/webaudio/AudioNodeTrack.cpp +++ b/dom/media/webaudio/AudioNodeTrack.cpp @@ -522,8 +522,10 @@ void AudioNodeTrack::ProcessInput(GraphTime aFrom, GraphTime aTo, mEngine->ProcessBlock(this, aFrom, mInputChunks[0], &mLastChunks[0], &finished); } else { - mEngine->ProcessBlocksOnPorts(this, mInputChunks, mLastChunks, - &finished); + mEngine->ProcessBlocksOnPorts( + this, MakeSpan(mInputChunks.Elements(), mEngine->InputCount()), + MakeSpan(mLastChunks.Elements(), mEngine->OutputCount()), + &finished); } } for (uint16_t i = 0; i < outputCount; ++i) {