Closed Bug 961475 Opened 10 years ago Closed 9 years ago

High CPU usage on mynoise.net/NoiseMachines/whiteNoiseGenerator.php

Categories

(Core :: Audio/Video, defect)

27 Branch
x86_64
Windows 7
defect
Not set
normal

Tracking

()

RESOLVED WORKSFORME
Tracking Status
firefox26 --- unaffected
firefox27 - affected
firefox28 - affected
firefox29 - affected

People

(Reporter: alice0775, Unassigned)

References

()

Details

(Keywords: power, regression, Whiteboard: [Power])

Steps To Reproduce:
1. Open http://mynoise.net/NoiseMachines/whiteNoiseGenerator.php
2. Wait for a while

Actual Results:
High CPU usage, greater than 20% of 4core@2.5GHz

Expected Results:
Low  CPU usage, less than 5% of 4core@2.5GHz


Regression window(m-c)
Good:(Less than 5% of 4core@2.5GHz)
http://hg.mozilla.org/mozilla-central/rev/b3ff36cb6a1a
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:25.0) Gecko/20130710 Firefox/25.0 ID:20130710064457
Bad:(Greater than 20% of 4core@2.5GHz)
http://hg.mozilla.org/mozilla-central/rev/dde4dcd6fa46
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:25.0) Gecko/20130710 Firefox/25.0 ID:20130710105040
Pushlog:
http://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=b3ff36cb6a1a&tochange=dde4dcd6fa46

Regression window(m-i)
Good:(Less than 5% of 4core@2.5GHz)
http://hg.mozilla.org/integration/mozilla-inbound/rev/26f83c4cb81e
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:25.0) Gecko/20130709 Firefox/25.0 ID:20130709022917
Bad:(Greater than 20% of 4core@2.5GHz)
http://hg.mozilla.org/integration/mozilla-inbound/rev/ebdf97f9ec52
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:25.0) Gecko/20130709 Firefox/25.0 ID:20130709030058
Pushlog:
http://hg.mozilla.org/integration/mozilla-inbound/pushloghtml?fromchange=26f83c4cb81e&tochange=ebdf97f9ec52
Regressed by:
ebdf97f9ec52	Paul Adenot — Bug 866675 - Add a WASAPI backend to cubeb. r=kinetik




Progression window(beta)
Bad:
http://hg.mozilla.org/releases/mozilla-beta/rev/73ef4f13486f
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:26.0) Gecko/20100101 Firefox/26.0 ID:20131028150036
http://hg.mozilla.org/releases/mozilla-beta/rev/2328244402b1
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:26.0) Gecko/20100101 Firefox/26.0 ID:20131114085019
Good
http://hg.mozilla.org/releases/mozilla-beta/rev/e32ba2c0a020
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:26.0) Gecko/20100101 Firefox/26.0 ID:20131122094025
Fixed in 26Beta and 25, but not 27+
502fdc1bba1a	Paul Adenot — Bug 929009 - Disable WASAPI in cubeb. r=kinetik a=akeybl
Summary: High CPU usage → High CPU usage on mynoise.net/NoiseMachines/whiteNoiseGenerator.php
This website works by playing a bunch of <audio> tags, each containing filtered noise at a particular frequency, and then apply gain on those "bands" to effectively achieve the noise shaping effect.

Each band consist in a vorbis file whose sample rate is 8000Hz. A typical user sound card is clocked at 44.1kHz or 48kHz.

When we used winmm, Window's mixer was smarter than us (actually, it was just being a smart mixer, we are not even a mixer), and mixed the track before resampling to the sound card sample rate. The policy is explained in [1].

Effectively, we are resampling 8 tracks from 8kHz to 44.1kHz, hence the CPU usage.

That said, the author uses the wrong tool for the job, Web Audio is preferable, here, and the page has an implementation, but the detection is broken:

> if(typeof webkitAudioContext !== "undefined") bWEBAUDIO=1;

[1]: http://msdn.microsoft.com/en-us/library/windows/hardware/ff537756%28v=vs.85%29.aspx, specifically, in the table: "New incoming rate is equal to the rate of another input stream: Mix the new input stream with the other input stream at the same rate to take advantage of the existing SRC from input to output."
So paul, there isn't anything we need to do here based on comment #1 and its basically a Evangelism issue?
Flags: needinfo?(paul)
Yes.
Flags: needinfo?(paul)
Based on Comment #3 I do not feel we need to track this but instead should refer to Evangelism.
Whiteboard: [Power]
I've reached out to Stéphane, the creator of myNoise.net.
Stéphane and I think the analysis in this bug is stale.

I tested Firefox 41 on Windows and 44 on Mac. Stéphane pointed me to

http://mynoise.net/about.php

which is 'live'. It shows:

      This browser uses Web Audio API in combination with OGG playback.

Playing the page in question with the Web Console shows that bWEBAUDIO===1.

Stéphane also pointed out that his detection code is:

  if(typeof webkitAudioContext !== "undefined") bWEBAUDIO=1;
  if(typeof AudioContext !== "undefined") bWEBAUDIO=1;

which seems like it'll do the trick.

:padenot and/or the reporter: please reopen if you disagree with this analysis!
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → WORKSFORME
Yeah no it's good. The code has changed indeed. Thanks !
You need to log in before you can comment on or make changes to this bug.