зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1591254 set WorkletNodeEngine input and output span lengths appropriately for zero inputs and outputs r=padenot
AudioNodeTrack::ProcessInput() uses ProcessBlock() when input and output counts are <= 1. Differential Revision: https://phabricator.services.mozilla.com/D50552 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
84d2a46f2c
Коммит
c8963484d2
|
@ -33,8 +33,10 @@ class WorkletNodeEngine final : public AudioNodeEngine {
|
||||||
void ProcessBlock(AudioNodeTrack* aTrack, GraphTime aFrom,
|
void ProcessBlock(AudioNodeTrack* aTrack, GraphTime aFrom,
|
||||||
const AudioBlock& aInput, AudioBlock* aOutput,
|
const AudioBlock& aInput, AudioBlock* aOutput,
|
||||||
bool* aFinished) override {
|
bool* aFinished) override {
|
||||||
ProcessBlocksOnPorts(aTrack, MakeSpan(&aInput, 1), MakeSpan(aOutput, 1),
|
MOZ_ASSERT(InputCount() <= 1);
|
||||||
aFinished);
|
MOZ_ASSERT(OutputCount() <= 1);
|
||||||
|
ProcessBlocksOnPorts(aTrack, MakeSpan(&aInput, InputCount()),
|
||||||
|
MakeSpan(aOutput, OutputCount()), aFinished);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProcessBlocksOnPorts(AudioNodeTrack* aTrack,
|
void ProcessBlocksOnPorts(AudioNodeTrack* aTrack,
|
||||||
|
@ -188,6 +190,7 @@ enum class ArrayElementInit { None, Zero };
|
||||||
static bool PrepareBufferArrays(JSContext* aCx, Span<const AudioBlock> aBlocks,
|
static bool PrepareBufferArrays(JSContext* aCx, Span<const AudioBlock> aBlocks,
|
||||||
WorkletNodeEngine::Ports* aPorts,
|
WorkletNodeEngine::Ports* aPorts,
|
||||||
ArrayElementInit aInit) {
|
ArrayElementInit aInit) {
|
||||||
|
MOZ_ASSERT(aBlocks.Length() == aPorts->mPorts.length());
|
||||||
for (size_t i = 0; i < aBlocks.Length(); ++i) {
|
for (size_t i = 0; i < aBlocks.Length(); ++i) {
|
||||||
size_t channelCount = aBlocks[i].ChannelCount();
|
size_t channelCount = aBlocks[i].ChannelCount();
|
||||||
WorkletNodeEngine::Channels& portRef = aPorts->mPorts[i];
|
WorkletNodeEngine::Channels& portRef = aPorts->mPorts[i];
|
||||||
|
@ -267,6 +270,9 @@ void WorkletNodeEngine::ProcessBlocksOnPorts(AudioNodeTrack* aTrack,
|
||||||
Span<const AudioBlock> aInput,
|
Span<const AudioBlock> aInput,
|
||||||
Span<AudioBlock> aOutput,
|
Span<AudioBlock> aOutput,
|
||||||
bool* aFinished) {
|
bool* aFinished) {
|
||||||
|
MOZ_ASSERT(aInput.Length() == InputCount());
|
||||||
|
MOZ_ASSERT(aOutput.Length() == OutputCount());
|
||||||
|
|
||||||
if (!mProcessor) {
|
if (!mProcessor) {
|
||||||
ProduceSilence(aOutput);
|
ProduceSilence(aOutput);
|
||||||
return;
|
return;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче