[Bug]: Reduced audio quality on SoundCloud when tab does not have focus
Categories
(Core :: Audio/Video: Playback, defect)
Tracking
()
Tracking | Status | |
---|---|---|
firefox93 | --- | fixed |
People
(Reporter: kbrosnan, Assigned: padenot)
References
Details
(Whiteboard: [media-audio])
Attachments
(1 file, 1 obsolete file)
From github: https://github.com/mozilla-mobile/fenix/issues/20653.
Steps to reproduce
- Open https://m.soundcloud.com/discover/sets/charts-top:piano:us (or another chart with music that has minimal distortion, so you can hear the issue more clearly)
- Play a track and it should be very clear with very rare crackling sounds
- Change focus away from the tab, for example, to the Android home screen or another app, and a very brief crackling sound may occur immediately and then intermittently as the track plays
Expected behaviour
Background audio plays smoothly on other sites, such as YouTube (with the "Video Background Play Fix" add-on installed) and my local public radio station (KQED FM, click the Listen Live button), so the expectation is that SoundCloud also would work seamlessly.
Actual behaviour
Intermittent crackling sounds. Here's the SoundCloud user's latest thread: https://support.mozilla.org/questions/1345089
Device name
Sony Xperia 10 II dual
Android version
Android 11
Firefox release type
Firefox
Firefox version
89+
Device logs
No response
Additional information
Confirmed in Firefox Nightly 92.0a1 on Samsung Galaxy S20 FE 5G with Android 11.
Change performed by the Move to Bugzilla add-on.
Reporter | ||
Comment 1•4 years ago
|
||
Video of the problem from the user, https://drive.google.com/file/d/1MrT9y43yrHwF5wgrUALd7m_UaumwQYKv/view
Comment 2•4 years ago
|
||
I can hear some cracking sound but not so serious as what the reporter experienced, and that issue won't happen on normal playback, eg. this page. I know SoundCloud uses WebAudio API, and I wonder if web audio API would get restricted on performace when the page is in background? Paul, do you have any thought about that?
Thank you.
Assignee | ||
Comment 3•4 years ago
|
||
I'm pretty sure I've seen that on my devices. Wouldn't it be related/fixed by your recent work on Web Audio API/document suspend on Android ?
Comment 4•4 years ago
|
||
No, I have tested the latest Nightly which already contains the suspend improvement for web audio, but that doesn't help. So that makes me wonder if there is other factor which decrease the web audio performance.
Assignee | ||
Comment 5•4 years ago
|
||
Taking for initial investigation, I'll try to reproduce on my devices, I think I can on one of my Sony devices for some reason, but I'm not sure.
Updated•4 years ago
|
Updated•4 years ago
|
Assignee | ||
Comment 6•4 years ago
|
||
This appears to be because of the GraphRunner
, because it isn't promoted on Android.
Assignee | ||
Comment 7•4 years ago
|
||
What's needed is to add Android support to https://github.com/padenot/audio_thread_priority. This means doing JNI stuff from Rust.
Assignee | ||
Comment 8•4 years ago
|
||
Diagnosing note:
- Doing real-time profiling + using https://github.com/padenot/fx-profiler-audio-cb shows that all underruns are happening at a context switch
- Disabling AudioWorklet via the pref and the GraphRunner thread also via the pref results in playing soundcloud for a good 20min without underruns, while it was underruning quite quickly before
Assignee | ||
Comment 9•4 years ago
|
||
Assignee | ||
Comment 10•4 years ago
|
||
Updated•4 years ago
|
Comment 11•4 years ago
|
||
bugherder |
Comment 12•4 years ago
|
||
Not a big deal to patch in our fork, but that would make b2g life easier if this patch used MOZ_WIDGET_ANDROID instead of ANDROID for things that depends on the Android sdk and not just the ndk. Thanks!
Assignee | ||
Comment 13•4 years ago
|
||
Sorry about that Fabrice, patch to switch to MOZ_WIDGET_ANDROID
is in bug 1728279.
Comment 14•4 years ago
|
||
thanks Paul!
Description
•