Closed Bug 916384 Opened 11 years ago Closed 11 years ago

ScriptProcessorNode should not call onaudioprocess when no other nodes are connected

Categories

(Core :: Web Audio, defect, P1)

x86_64
Linux
defect

Tracking

()

RESOLVED FIXED
mozilla29

People

(Reporter: karlt, Assigned: padenot)

References

Details

(Keywords: perf)

Attachments

(2 files, 1 obsolete file)

Attached file 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."
Blocks: 923533
Whiteboard: [webaudio-perf]
Keywords: perf
Whiteboard: [webaudio-perf]
Priority: -- → P1
Assignee: nobody → paul
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-
This should address the comments.
Attachment #8345397 - Flags: review?(roc)
Attachment #8344726 - Attachment is obsolete: true
https://hg.mozilla.org/mozilla-central/rev/55e604639526
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla29
Depends on: 1484046
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: