ScriptProcessorNode should not call onaudioprocess when no other nodes are connected

RESOLVED FIXED in mozilla29

Status

()

P1
normal
RESOLVED FIXED
5 years ago
a month ago

People

(Reporter: karlt, Assigned: padenot)

Tracking

({perf})

Trunk
mozilla29
x86_64
Linux
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(2 attachments, 1 obsolete attachment)

(Reporter)

Description

5 years ago
Created attachment 804806 [details]
testcase

https://dvcs.w3.org/hg/audio/raw-file/tip/webaudio/specification.html#ScriptProcessorNode
"audioprocess events are only dispatched if the ScriptProcessorNode has at least one input or one output connected."
(Reporter)

Updated

5 years ago
Blocks: 923533
(Reporter)

Updated

5 years ago
Duplicate of this bug: 931393
(Assignee)

Updated

5 years ago
Whiteboard: [webaudio-perf]
(Assignee)

Updated

5 years ago
Keywords: perf
Whiteboard: [webaudio-perf]
(Reporter)

Updated

5 years ago
Priority: -- → P1
Assignee: nobody → paul
(Assignee)

Comment 2

5 years ago
Created attachment 8344726 [details] [diff] [review]
Stop calling onaudioprocess on the ScriptProcessorNode it has no inputs or outputs. r=

I had to adjust the test that checks that event fires without input XOR output.
Attachment #8344726 - Flags: review?(roc)
Comment on attachment 8344726 [details] [diff] [review]
Stop calling onaudioprocess on the ScriptProcessorNode it has no inputs or outputs. r=

Review of attachment 8344726 [details] [diff] [review]:
-----------------------------------------------------------------

::: content/media/webaudio/ScriptProcessorNode.cpp
@@ +228,5 @@
> +    // onaudioprocess event.
> +    if (!(aStream->ConsumerCount() ||
> +          aStream->AsProcessedStream()->InputPortCount())) {
> +      return;
> +    }

We need to produce something in aOutput. I think we actually should consume any output buffers that script has already produced. Otherwise if we reconnect after some time, we'll play very old data.

So I think here we should clear our input and output buffers and set aOutput to null data before we return.
Attachment #8344726 - Flags: review?(roc) → review-
(Assignee)

Comment 4

5 years ago
Created attachment 8345397 [details] [diff] [review]
Stop calling onaudioprocess on the ScriptProcessorNode it has no inputs or outputs. r=

This should address the comments.
Attachment #8345397 - Flags: review?(roc)
(Assignee)

Updated

5 years ago
Attachment #8344726 - Attachment is obsolete: true
https://hg.mozilla.org/mozilla-central/rev/55e604639526
Status: NEW → RESOLVED
Last Resolved: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla29
(Reporter)

Updated

a month ago
Depends on: 1484046
You need to log in before you can comment on or make changes to this bug.