Android system-wide equalizer not applied
Categories
(Core :: Audio/Video: cubeb, defect, P3)
Tracking
()
People
(Reporter: tempqd, Unassigned)
References
Details
Attachments
(1 file)
|
23.42 KB,
text/plain
|
Details |
Steps to reproduce
Samsung S25, OneUI 9.0
Set an Android system-wide equalizer (in OneUI it's in Settings > Sounds and vibration > Sound quality and effects > Equalizer)
Actual results
Firefox does not obey the equalizer, and its audio is unaffected
Expected results
Firefox should go through the system equalizer (like all other apps). Or maybe have an option to apply or bypass the system equalizer.
Updated•29 days ago
|
Comment 1•29 days ago
|
||
| gecko-triage | ||
Thanks for the report.
Next steps
Could you please do the capture below on the phone? Turn on the equalizer and play audio in Firefox before you start.
Please capture a profile:
- Open
about:logging. - On the Logging presets tab, choose the "Media playback" preset.
- Under Logging output, select "Logging to the Firefox Profiler".
- Click Start Logging.
- Reload the page. Then do the steps that show the problem.
- Click Stop Logging. The profile opens in the Firefox Profiler.
- Click Upload Local Profile. This is the share button.
- Copy the share URL. Add it to this bug.
The instruction video shows these steps.
Please also add these items to this bug:
- The text of
about:support. Openabout:supportin Firefox and paste its text here. - The site and the page that you used to test.
Does this happen on all videos and songs, or only on certain ones?
If you'd like to provide feedback on this comment, please use the 👍 or 👎 reaction.
| Reporter | ||
Comment 2•27 days ago
|
||
https://profiler.firefox.com/public/f1t16rj0y8qwm0kzpn8kzxvrjkkz86eey0474jr
Turns out SoundCloud doesn't go through the equalizer but YouTube does... Could that be somehow intentional?
| Reporter | ||
Comment 3•27 days ago
|
||
Comment 4•26 days ago
|
||
| gecko-triage | ||
Thanks for the profile and the about:support text. This difference between the sites is not intentional.
Analysis
The profile shows that the two sites use two different audio paths. On m.soundcloud.com, the page sends the media element into an AudioContext with createMediaElementSource. The Web Audio graph then opens the output stream. On m.youtube.com, the media element plays through AudioStream, with no Web Audio.
Firefox asks AAudio for a different performance mode on each path. cubeb selects the low latency mode when the requested latency is 4000 frames or less (cubeb_aaudio.cpp). The Web Audio graph asks for the minimum latency of the device, here 96 frames, raised to 128 (GraphDriver.cpp). AudioStream asks for 100 ms, which is 4800 frames at 48 kHz. The profile agrees: the SoundCloud stream uses performance mode 12 (low latency), and the YouTube stream uses mode 11 (power saving).
Both streams use the shared mode and the same usage, AAUDIO_USAGE_MEDIA, so these are not the difference. The decoder is also not the difference: both paths send decoded audio to cubeb. No errors show in the profile.
The probable cause is that Android or the Samsung equalizer does not process low latency AAudio streams. Android often plays these streams on a fast path with no effects. No test proves this yet. If it is correct, all Web Audio output on Android skips the system equalizer. Firefox does not implement latencyHint yet (bug 2020377), so a page cannot ask for a higher latency.
Next steps
A test with a higher Web Audio latency can confirm the cause. Could you please do this test in Firefox Nightly or Firefox Beta on the same phone? The release version does not open about:config.
Caution: this pref makes the Web Audio latency higher. Delete it after the test.
- Open
about:config. - Search for
media.cubeb_latency_mtg_frames. - Add it as a Number with the value
4096. - Close Firefox completely and open it again.
- Turn on the equalizer and play a track on SoundCloud.
- Tell us if the equalizer changes the sound now.
If you'd like to provide feedback on this comment, please use the 👍 or 👎 reaction.
| Reporter | ||
Comment 5•26 days ago
|
||
Oh, I would very much suggest asking for consent before assigning an LLM bot to a bug report. I understand why it's here, but all the usual AI weirdness is seen here, and I would've preferred to not contribute to potentially paying some company for tokens, environmental impact, etc. and I'm fine with patiently waiting for a human response. I also don't see any public info about this, could you write about this bot somewhere for transparency?
Anyway, yes setting that latency to 4096 makes it go through the equalizer. But it's still not clear from that response whether this is an intentional difference between audio modes requested by the two sites themselves or not.
Comment 6•25 days ago
|
||
| gecko-triage | ||
Thanks for the test. It confirms the cause. This comment comes from an automated triage account. The next step goes to a developer.
Analysis
The sites do not choose the audio mode. Firefox chooses it from the audio path that the page uses. SoundCloud sends its media element through Web Audio, so it gets the low latency mode.
Firefox opens every Web Audio graph at the minimum latency of the device (GraphDriver.cpp, CubebUtils.cpp). On this phone, that is 128 frames. cubeb selects AAUDIO_PERFORMANCE_MODE_LOW_LATENCY for 4000 frames or less, and AAUDIO_PERFORMANCE_MODE_POWER_SAVING above that (cubeb_aaudio.cpp). The low latency stream does not go through the system equalizer. Your value of 4096 is above 4000, so the stream used the power saving mode and the equalizer applied.
The graph does not know if the page needs low latency. A graph that only createMediaElementSource feeds gets the same latency as a game or a synthesizer. Firefox does not implement latencyHint yet (bug 2020377). cubeb has no option to select the AAudio mode separately from the latency.
This is probably not a regression. The mapping from latency to mode is in cubeb since 2020.
Fix direction
The fix needs a decision between low Web Audio latency and working system effects on Android. These directions can be combined:
- Implement
latencyHint(bug 2020377). The "playback" value selects the power saving mode. This alone does not fix SoundCloud, because SoundCloud uses the default value. - On Android, give a higher latency to graphs with no audio input, or to graphs that only media elements feed.
- Add a stream option to cubeb that selects the AAudio mode separately from the latency.
media/libcubebcomes from github.com/mozilla/cubeb, so this change lands upstream first.
Open point: a test with media.cubeb_latency_mtg_frames set to 2048 keeps the low latency mode with a larger buffer. Its result can show if the mode alone causes the equalizer skip.
Paul, could you please look at this bug and choose a direction for the Web Audio latency on Android?
If you'd like to provide feedback on this comment, please use the 👍 or 👎 reaction.
Comment 7•12 days ago
|
||
(In reply to Tem PQD [:tempqd] from comment #5)
Anyway, yes setting that latency to 4096 makes it go through the equalizer. But it's still not clear from that response whether this is an intentional difference between audio modes requested by the two sites themselves or not.
SoundCloud uses the Web Audio API for audio output on the Web. Without latencyHint (for which as I have patch for), they go through the "normal" path for the Web Audio API, which is low latency, which can bypass processing on some Android devices. Youtube uses regular media playback, and so it works.
This will start working as you expect when we land the patches in bug 2020377.
Description
•