Closed Bug 1496496 Opened 6 years ago Closed 6 years ago

Sound indicator incorrectly shows when playing a silent web audio

Categories

(Core :: Web Audio, defect, P3)

defect

Tracking

()

RESOLVED FIXED
mozilla64
Tracking Status
firefox62 --- wontfix
firefox63 --- wontfix
firefox64 --- fixed

People

(Reporter: alwu, Assigned: alwu)

Details

Attachments

(5 files)

STR.
1. open https://musiclab.chromeexperiments.com/Rhythm/

Expect.
2. No sound indicator

Actual.
2. Sound indicator shows
Add method to help us know whether audio block is audible or not, so that we won't
show the sound indicator for silent web audio.
The naming `isAudible` is more clear than `isInputMuted`, so also change related functionis and variables.
We don't want to notify state changed frequently if the input stream is consist of
interleaving audible and inaudible blocks.

This situation is really common, especially when user is using OscillatorNode to produce
sound. Sending unnessary runnable frequently would cause performance debasing.

If the stream contains 10 interleaving samples and 5 of them are audible, others are
inaudible, user would tend to feel the stream is audible. Therefore, we have the loose
checking when stream is changing from inaudible to audible, but have strict checking when
streaming is changing from audible to inaudible. If the inaudible blocks continue over a
speicific time thersold, then we will think the steam as inaudible.
Component: Audio/Video: Playback → Web Audio
Priority: -- → P3
QA Contact: drno
A looping AudioBufferSourceNode with a constant unit magnitude sample value
buffer is connected to the input of a GainNode which has an AudioParam
event from
> mozilla::dom::AudioParam::SetValueAtTime(float, double, mozilla::ErrorResult&) (this=..., aValue=9.99999975e-06, aStartTime=0.20317460317460317, aRv=...)

The output from the GainNode is connected to gain AudioParam on another
GainNode controlling the volume/envelope of a sine wave.  If this volume
were zero, then the audio output would be silence.

I wonder whether 0.00001 is intentionally not silence for some reason.

If a web page is deliberately keeping an audio output stream active, then
maybe it is even useful to flag that tab as the culprit?

JS backtrace with some function name hints:

0 t.TimelineSignal.prototype.setValueAtTime(e = 0.00001, i = 0) ["https://gweb-musiclab-site.appspot.com/static/js/Tone.min.js":7]
    this = TimelineSignal
1 t.Envelope([object Object]) ["https://gweb-musiclab-site.appspot.com/static/js/Tone.min.js":7]
    this = AmplitudeEnvelope
2 t.AmplitudeEnvelope([object Object]) ["https://gweb-musiclab-site.appspot.com/static/js/Tone.min.js":7]
    this = AmplitudeEnvelope
3 t.SimpleSynth(e = [object Object]) ["https://gweb-musiclab-site.appspot.com/static/js/Tone.min.js":12]
    this = SimpleSynth
4 l(e = [object Object], t = [function], n = [function]) ["https://musiclab.chromeexperiments.com/js/app.js":1]
    this = [object Object]
5 e(b = [function], c = [object Object], f = [object Object], g = "PianoCntrl") ["https://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js":36]
    this = [object Object]
6 Fe/this.$get</</<() ["https://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js":75]
7 A/<(a = [function], "ngController", [object Object]) ["https://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js":58]
8 s(b = [object Object], a = [function]) ["https://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js":7]
9 A(a = [function], c = [object Object], f = [object HTMLDivElement], g = undefined, h = null) ["https://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js":58]
10 g(a = [object Object], c = [function], d = undefined, e = null) ["https://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js":51]
11 g(a = [object Object], c = null, d = undefined, e = null) ["https://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js":51]
12 A(a = [function], c = [object Object], f = [object HTMLDivElement], g = 0, h = null) ["https://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js":59]
13 g(a = [object Object], c = [function], d = undefined, e = null) ["https://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js":51]
(In reply to Karl Tomlinson (:karlt) from comment #6)
> If a web page is deliberately keeping an audio output stream active, then
> maybe it is even useful to flag that tab as the culprit?

As the sound indicator is used to inform user the tab is producing audible sound, not a icon for diagnosing whether the tab might have potential problem or intension. I would prefer not to show the icon for silent websites.

In addition, for web compat, Chrome doesn't show sound indicator for this site, so I think we should also not show it.
QA Contact: drno
Pushed by alwu@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/0e9d8fcb66fe
part1 : add IsAudible() to detect audible data. r=padenot
Pushed by alwu@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/28db447715bf
part2 : rename variables and functions. r=padenot
Pushed by alwu@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/967412e016ec
part4 : avoid to notify audible state changed frequently. r=padenot
Flags: in-testsuite+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: