Skip to content

Honor YAS_AUDIO=0 and YAS_AUDIO_BITRATE when PipeWire runs for media - #20

Open
mgasner wants to merge 1 commit into
fix/surface-capture-record-flagsfrom
fix/audio-disable-bitrate
Open

mgasner wants to merge 1 commit into
fix/surface-capture-record-flagsfrom
fix/audio-disable-bitrate

Conversation

@mgasner

@mgasner mgasner commented Sep 28, 2026 •

Copy link
Copy Markdown

Stacked on #19; the diff shows only this change.

What was wrong

  • YAS_AUDIO=0: it only stopped PipeWire when media input and portals were also off. If either was on, desktop audio was still offered and streamed to viewers.
  • YAS_AUDIO_BITRATE: a viewer left at "Desktop default" sends 0 kbps, which the spec defines as "server default". The server treated that as a built-in 64 kbps and reset the encoder to it, overriding the configured value.
  • Silent failure: when audio couldn't start, the server gave the reason only with -v.

Fix

  • YAS_AUDIO=0: the output device is reported unavailable and OPEN_OUTPUT is refused, whatever PipeWire is running for.
  • YAS_AUDIO_BITRATE: server-default viewers, the last unsubscribe, and pipeline restarts all use the configured bitrate. An explicit viewer bitrate still wins, taking the highest across viewers.
  • Silent failure: when audio can't start and wasn't disabled, the server prints one line at normal verbosity with the reason, for example:
    [audio] desktop audio unavailable: missing on $PATH: pipewire, …; -v for details, YAS_AUDIO=0 to silence

Testing

  • New unit tests viewers_at_the_server_default_get_the_configured_bitrate and unavailable_reason_names_the_first_missing_dependency.
  • 58 audio::tests and media tests pass.
  • There is no PipeWire in the sandbox, so live testing covered only the unavailable message, including that YAS_AUDIO=0 silences it.

View in Indent
Tag @indent to continue the conversation here.

- YAS_AUDIO=0 only kept PipeWire from starting when media input and portals
  were also off. With either on, the runtime started and desktop audio was
  still offered and streamed. The output device is now unavailable and
  OPEN_OUTPUT is refused under YAS_AUDIO=0 regardless of why PipeWire runs.
- A viewer at "Desktop default" (0 kbps) reset the encoder to a built-in
  64 kbps, overriding YAS_AUDIO_BITRATE. The configured bitrate is now what
  a server-default viewer, the last unsubscribe, and a pipeline restart use.
- When audio cannot start and was not disabled, print one line naming the
  reason at normal verbosity; -v keeps the detailed lines.
@github-actions

Copy link
Copy Markdown

Coverage

Crate Lines Functions Regions
alacritty-driver 85.6% (1081/1263) 89.4% (84/94) 89.3% (1746/1955)
browser 25.5% (309/1212) 30.4% (34/112) 27.7% (605/2183)
cli 34.9% (8332/23890) 35.8% (772/2155) 35.6% (12060/33910)
composite-transport 96.3% (526/546) 98.4% (60/61) 96.2% (884/919)
compositor 54.9% (11394/20760) 66.0% (831/1260) 54.7% (15778/28840)
desktop 78.4% (4460/5691) 71.6% (393/549) 75.1% (6211/8267)
edge 62.9% (798/1268) 50.9% (82/161) 57.7% (1038/1799)
fonts 77.3% (1257/1626) 82.7% (129/156) 78.9% (2424/3071)
fssync 85.3% (1597/1872) 84.4% (179/212) 86.4% (2813/3255)
git 70.4% (4462/6334) 68.5% (337/492) 67.3% (6313/9386)
guest 67.3% (6829/10148) 67.0% (488/728) 66.6% (8935/13416)
lsp 78.7% (3573/4542) 80.8% (336/416) 76.7% (5409/7054)
proxy 57.8% (1120/1937) 50.5% (104/206) 59.0% (1749/2965)
runtime-dir 93.6% (117/125) 100.0% (14/14) 94.8% (218/230)
sd-notify 73.9% (68/92) 100.0% (6/6) 83.2% (109/131)
server 68.7% (79722/116080) 70.4% (5712/8110) 66.3% (105520/159153)
ssh 42.6% (270/634) 51.5% (34/66) 42.9% (428/998)
terminal-model 49.9% (314/629) 62.3% (38/61) 50.3% (505/1004)
uplink 94.0% (581/618) 92.6% (50/54) 93.0% (1061/1141)
webrtc-forwarder 33.8% (1337/3961) 42.0% (136/324) 36.2% (2318/6409)
webserver 77.0% (1421/1846) 75.2% (179/238) 80.0% (2453/3067)
website 35.1% (355/1012) 34.4% (53/154) 35.8% (607/1694)
xtask 0.0% (0/5131) 0.0% (0/131) 0.0% (0/9124)
yas 87.8% (26446/30135) 93.2% (2030/2179) 82.7% (41655/50374)
Total 64.8% (156369/241352) 67.3% (12081/17939) 63.0% (220839/350345)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant