VOOZH about

URL: https://bugzilla.mozilla.org/show_bug.cgi?id=2026773

⇱ 2026773 - [meta] Remove AudioChannelService and AudioChannelAgent — replace with MediaController-based mechanisms


Open Bug 2026773 Opened 2 months ago Updated 2 months ago

[meta] Remove AudioChannelService and AudioChannelAgent — replace with MediaController-based mechanisms

[meta] Remove AudioChannelService and AudioChannelAgent — replace with MediaController-based mechanisms
Core
Audio/Video: Playback
unspecified
Unspecified
Unspecified
task
Points:
---
NEW
---
Iteration:
---
a11y-review
Accessibility Severity
Performance Impact
Size Estimate
Webcompat Priority
Webcompat Score
Tracking Status
relnote-firefox
thunderbird_esr115
thunderbird_esr140
firefox-esr115
firefox-esr140
firefox-esr153
firefox152
firefox153
firefox154
---
QA Whiteboard:
---
Has STR:
---
Change Request:
---
Bug Flags:
Signature:
None
This bug is publicly visible.

 
Assignee

Description

2 months ago

AudioChannelService and AudioChannelAgent were designed for Firefox OS (B2G), a single-process mobile OS where one app owned the audio channel at a time. That architecture has not been valid since Fission shipped. The system is now a source of bugs, a Fission correctness gap, and a barrier to implementing modern web standards.

This meta bug tracks the complete removal of the AudioChannel system and its replacement with MediaController-based mechanisms.

What AudioChannelService currently does

  • Tab sound indicator: AudioChannelWindow aggregates AudioChannelAgent audible state per content process, fires the "audio-playback" observer, which AudioPlaybackChild/AudioPlaybackParent relay to tabbrowser.js.
  • Tab mute via volume suppression: RefreshAgentsVolume() pushes mute state down to every AudioChannelAgent via WindowVolumeChanged(), which sets MUTED_BY_AUDIO_CHANNEL on HTMLMediaElement.
  • Delayed autoplay for background tabs: ResumeDelayedPlaybackAgent registers an AudioChannelAgent and waits for a WindowSuspendChanged(NONE_SUSPENDED) callback when the tab is foregrounded or the user clicks the Play Tab icon.
  • "Play Tab" icon: MaybeNotifyMediaBlockStart() fires "activeMediaBlockStart" via the same observer and actor chain, driving browser.activeMediaBlockStarted().
  • Audio capture: SetWindowAudioCaptured() notifies HTMLMediaElement via WindowAudioCaptureChanged() to adjust its capture track.
  • B2G audio focus/competing (IsEnableAudioCompeting, RefreshAgentsAudioFocusChanged): dead code on desktop, can be deleted immediately.

Why this system must be removed

AudioChannelService is a per-content-process singleton. A Fission tab spans multiple content processes, and the service has no cross-process coordination. Each process fires its own "audio-playback" observer independently, which is the root cause of Bug 1962876: when a cross-origin iframe's process fires Stop, the indicator clears even though a sibling process is still playing. There is no incremental fix—the design assumption of one process per tab is structurally false.

MediaController already solves the cross-process aggregation problem for controllable HTMLMediaElement sources via ContentMediaAgent → IPC → MediaStatusManager. The gap is that the tab sound indicator, tab mute, and autoplay blocking still go through the old system rather than MediaController.

Two potential features are blocked on this work. Both are straightforward to build on top of a completed MediaController migration; neither has a reasonable home in the current architecture.

  • The AudioSession API (W3C spec) requires a parent-process authority over per-tab audio state to handle audio competition and interruption.
  • The Global Media Controller (show and control all audible tabs from one UI surface) requires a cross-tab registry of MediaController instances.
You need to log in before you can comment on or make changes to this bug.