Open Bug 1427937 Opened 7 years ago Updated 2 days ago

audio context should release its wakelock when it's non-audible

Categories

(Core :: Web Audio, enhancement, P2)

Unspecified
Android
enhancement

Tracking

()

Tracking Status
firefox68 --- affected

People

(Reporter: alwu, Unassigned)

References

(Blocks 1 open bug, )

Details

(Whiteboard: [geckoview:fenix:p3])

The report from google app team shows that sometime the audio wakelock doesn't be unlocked correctly, and it would cause a power waste. > org.mozilla.firefox : AudioMix, with partial_wakelock_time 2h47m5.954s The partial_wakelock is created from here https://searchfox.org/mozilla-central/rev/b24e6342d744c5a83fab5c15972e11eeb69d68e6/mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoAppShell.java#560
Summary: Sometime audio wakelock doesn't be unlocked correctly → Sometime audio wakelock is not unlocked correctly
After some investigation, I found that 'AudioMix' wakelock is not called by firefox directly, the topics we use for audio/video are 'audio-playing' or 'video-playing'. Not sure where is the 'AudioMix' from. Ex. (using firefox to play music) $dumpsys power Wake Locks: size=2 PARTIAL_WAKE_LOCK 'AudioMix' ACQ=-1m30s662ms LONG (uid=1041 ws=WorkSource{10128}) PARTIAL_WAKE_LOCK 'audio-playing' ACQ=-1m30s649ms LONG (uid=10128 pid=20982)
Priority: -- → P1
This issue is caused by web audio. When you create an AudioContext, the AudioMix wakelock would exist until it's destroyed. What I guess is that AudioStream continuely input silent data to audio hardware so that audio server would always keep its wakelock. --- STR. 1. goto https://alastor0325.github.io/htmltests/non_mse_tests/webaudio_silent.html 2. put the tab on background 3. $ adb shell dumpsys power 4. then you would see the 'AudioMix' wakelock exists until the tab is destoryed
Summary: Sometime audio wakelock is not unlocked correctly → audio context should release its wakelock when it's non-audible
Component: Audio/Video → Web Audio
Product: Firefox for Android → Core
Hi, Paul, Since we use an audio driver for AudioContext, the cubeb stream would cause audio backends to request wake lock even web audio's non-audible. (both OSX and Android would do so) The rough solution might be changing back to system clock driver once we detect the web audio is continuely outputing silent data over a specific time. Do you have any idea for this issue? Thanks!
Flags: needinfo?(padenot)
This is a feature, not a bug. Application authors that wish to save battery power can call `suspend` or even `close` on the `AudioContext`. What is this google app report?
Flags: needinfo?(padenot)
(In reply to Paul Adenot (:padenot) from comment #4) > This is a feature, not a bug. > > Application authors that wish to save battery power can call `suspend` or > even `close` on the `AudioContext`. > > What is this google app report? I would ask them for more details. BTW, Is this feature defined by spec? or just our feature? Thanks.
(In reply to Alastor Wu [:alwu][please needinfo me][GMT+8] from comment #5) > I would ask them for more details. > BTW, Is this feature defined by spec? or just our feature? This is in the Web Audio API specification [0]. [0]: https://webaudio.github.io/web-audio-api/
Assignee: alastor0325 → nobody
Assignee: nobody → padenot
Rank: 15
Priority: P1 → P2
Assignee: padenot → nobody
Whiteboard: [geckoview]
OS: Unspecified → Android
Whiteboard: [geckoview] → [geckoview:fenix:p2]
Type: defect → enhancement
Whiteboard: [geckoview:fenix:p2] → [geckoview:fenix:p3]
Blocks: wakelock
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.