New issue
Advanced search Search tips

Issue 700175 link

Starred by 2 users

Issue metadata

Status: Fixed
Owner:
Closed: Apr 2017
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug



Sign in to add a comment

OscillatorNode always creates PeriodicWave table for sine even if not requested

Project Member Reported by rtoy@chromium.org, Mar 9 2017

Issue description

When an oscillator is created using

new OscillatorNode(context, {type: 'square'})

a PeriodicWave is created for both a sine wave and a square wave.  This is a bit wasteful of memory if the sine wave is never requested.  

However, the impact is not huge since the periodic wave tables is shared for all oscillator nodes in the same context.
 
Project Member

Comment 1 by bugdroid1@chromium.org, Apr 20 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/aa8cf68adc5654695f83f355d601eba127f16d75

commit aa8cf68adc5654695f83f355d601eba127f16d75
Author: rtoy <rtoy@chromium.org>
Date: Thu Apr 20 21:14:17 2017

Slightly reduce memory usage in OscillatorNode

When an OscillatorNode is created, a PeriodicWave is created for a
"sine" oscillator.  This is unavoidable when the factory method is
used.  However, with the constructor, the type of oscillator can be
specified and there is no need to create both a "sine" PeriodicWave
and one for the specified type.

Thus, for the constructor, only create the wave table for the
specified type.

BUG= 700175 
TEST=not testable; manually verifed with prints/debugger that sine
table is not created unless needed.

Review-Url: https://codereview.chromium.org/2767623002
Cr-Commit-Position: refs/heads/master@{#466134}

[modify] https://crrev.com/aa8cf68adc5654695f83f355d601eba127f16d75/third_party/WebKit/Source/modules/webaudio/BaseAudioContext.cpp
[modify] https://crrev.com/aa8cf68adc5654695f83f355d601eba127f16d75/third_party/WebKit/Source/modules/webaudio/OscillatorNode.cpp
[modify] https://crrev.com/aa8cf68adc5654695f83f355d601eba127f16d75/third_party/WebKit/Source/modules/webaudio/OscillatorNode.h

Comment 2 by rtoy@chromium.org, Apr 21 2017

Owner: rtoy@chromium.org
Status: Fixed (was: Available)

Sign in to add a comment