Free, open-source screen sharing for private live streams with friends. Watch together in a browser or self-host Piik. 免费开源的私密屏幕共享,支持游戏直播、一起看电影与自部署。
fix(media): disable screen-audio speech processing [skip ci]
AAAd94bac11ca2b
diff --git a/docs/project-memory.md b/docs/project-memory.mdindex 8b8b4548..186c8b41 100644--- a/docs/project-memory.md+++ b/docs/project-memory.md@@ -31,7 +31,7 @@ Last updated: 2026-08-21- C+B quality reparenting is edge-local and cooldown-bound; no score, timer, or global parent penalty.- Flagship media is UDP; HTTPS/WSS stays TLS/TCP; the old release remains rollback-only.- Treat settings as ceilings and degradation as unclassified. Use correlated Host A+B/Viewer C and one-variable evidence; never force AV1, infer by UA, or create a composite score.-- Screen audio: peer answers use `stereo=1;maxaveragebitrate=128000`; SFU uses 128 kbps stereo/`forceStereo`, DTX off, RED retained. Other SDP/FEC stays browser-owned; one stream; production proof open; no audio UI; voice separate; Native source-only.+- Screen audio: Web capture requests speech processing off and ideal stereo; peer answers use `stereo=1;maxaveragebitrate=128000`; SFU uses 128 kbps stereo/`forceStereo`, DTX off, RED retained. Proof open; no audio UI; voice and Native stay separate.- Presence reports active upstream for topology; assignment alone never proves media. A Web SFU Viewer becomes connected only after session-bound first media; track/route/session loss clears it. Status/details stay neutral until current P2P/SFU/TURN evidence. Names stay socket/localStorage-only; Native remains outside.- Do not add scene detection, dynamic-FPS control, or forced AV1 without negotiation, encode, game, CPU/GPU, and sender evidence.- ADR-0002 grant/public access, the v3 room-password migration, and Web Host display names are deployed. Names/presence remain session-only without account or roster tables.@@ -43,10 +43,10 @@ Last updated: 2026-08-21## Current Implementation- The repository is one npm package using Node.js 24, React, TypeScript, Vite, native WebRTC, `ws`, Zod, Vitest, and separate coturn.-- Production: exact `3d75e7b886350852d08027eb2d3c460f36a791e4`, release `3d75e7b88635`, Web wire `screener-v4`; rollback `20cb1bdb2be3`.+- Production: exact `4ee2f27f3f3e0882ae6f9d970fef1cf3b6fb1f7b`, release `4ee2f27f3f3e`, Web wire `screener-v4`; rollback `3d75e7b88635`.- Web keeps one SFU stream, clears unavailable video, exposes evidence-backed routes/transports and paused preview, and drops signals to a grace-retained offline current-edge target. Routing is automatic; entry/nickname UI is live; Native remains source-only.- Web relay is cap2 with one upstream; child3 rejects and no UA/visibility split exists.-- Source candidate: validated relay Viewer evidence reaches opted-in Web Host rosters; direct proof stays local-edge-only. Not deployed.+- Deployed relay evidence reaches opted-in Host rosters; direct proof stays local-edge-only.- Four services are active/running at `NRestarts=0`; local/public health are 200. SQLite v3 has five rooms, SHA-256 `aef724ae52c4107be8ec8791e72f8dcaa11b0ec849fb432d022e2cfb9cfe0974`, owner/mode `screener:screener`/0600.- Production keeps ordinary ICE STUN-only, SFU roots <=2, selected-edge UDP TTL 120, and one pending/answered `peer-selected` attempt per room excluding Host ingress. This rollout ran no browser/media/SFU/TURN/performance canary; earlier exact-`16f6eab` evidence proves active Host ingress only.- Production requires independent `SITE_ACCESS_PASSWORD`: its stateless cookie authorizes creation/Host and code-only Viewer attempts; private grants stay direct, while public/private code entry needs site access alone/plus room password. Env/endpoint/cookie/nginx naming migrated atomically; failures remain neutral; there are no accounts/JWT/session rows. Local `gate:access-privacy` proves fragment isolation, site/grant transport-log absence, and raw room-password SQLite absence; room-password WebSocket/log ingress and live/headful evidence remain open.diff --git a/docs/research/browser-screen-audio-quality.md b/docs/research/browser-screen-audio-quality.mdindex 776ec48d..cb4b4b95 100644--- a/docs/research/browser-screen-audio-quality.md+++ b/docs/research/browser-screen-audio-quality.md@@ -2,10 +2,11 @@Accessed: 2026-08-21-Status: the current integration base has route-consistent peer/SFU stereo and a-128 kbps sender ceiling, but peer answers still omit `maxaveragebitrate`, leaving-full-band stereo at libwebrtc's 64 kbps initial codec target. This slice adds the-matching 128 kbps receiver maximum; audible production evidence remains open.+Status: peer and SFU routes already use stereo and a 128 kbps target, but users+still report speech-gated movie/game audio, including on a phone connected+directly through the SFU. Current Chromium web `getDisplayMedia()` defaults to+local speech processing unless the request disables it. This slice makes that+source request explicit; target-device audible proof remains open.## Scope And Decision@@ -17,7 +18,8 @@ requirement.The product keeps one screen-media audio mode rather than exposing codecplumbing as quality controls:-- request audio with `audio: true`;+- request audio with echo cancellation, noise suppression, automatic gain, and+ voice isolation disabled, while preferring two capture channels;- request window audio for a selected window and offer system audio for a fulldisplay;- retain `contentHint = "music"` only as source intent, with no quality claim;@@ -49,15 +51,13 @@ contract. It must not turn movie or game audio into a voice-processed source.## Deployed Reports And Echo Boundary-Users reported that production+Users first reported that production`6ccb516a47261054f91dfa2fafa408d39ced59fc` sounded poor for movie/video screen-audio. That exact release had the 128 kbps ceiling described above but no-explicit stereo contract. The current integration base has since added peer/SFU-stereo, but its peer answers still omit `maxaveragebitrate`; inspected libwebrtc-therefore starts full-band stereo at 64 kbps. This is the strongest remaining-code-level candidate, not an audible-quality measurement: capture scope, actual-fmtp/bitrate, loss, jitter and concealment still need the existing read-only-diagnostics.+audio. Later source and production revisions added peer/SFU stereo and the+matching `maxaveragebitrate=128000`, but the speech-gated sound remained. A+phone Viewer connected directly through the SFU reproduced it, so browser-relay+decode/re-encode is a route-specific amplifier rather than the common cause.+The shared Host capture path runs before direct P2P, SFU and peer-relay routes.The earlier delayed self-echo report on `769de201f7cc` has a different boundary:a viewer's voice is rendered by a separate voice application on the Host,@@ -73,30 +73,39 @@ environment observation, not a cross-browser source guarantee.## Voice-Processing Boundary-Current Chromium constraint-selection tests cover tab, system, and desktop as-content-capture sources. With no explicit processing constraint, all three-select disabled WebRTC echo cancellation and `false` for automatic gain-control, noise suppression, experimental noise suppression, high-pass filter,-and experimental automatic gain control. `disable_local_echo` is a separate-local-playback behavior and is not an audio-processing effect. Screener only-requests display audio and does not opt these content tracks into microphone-processing.--This rules out default mic-style voice processing as the source-supported-explanation for the current Chrome result. It remains Chromium implementation-evidence rather than a portable browser guarantee; a runtime regression would-need track settings or an isolated capture fixture, not speculative processing-constraints added to `getDisplayMedia()`.+The earlier conclusion that Chromium content capture defaults all speech+processing off incorrectly generalized extension `tabCapture`/`desktopCapture`+tests to the Web Screen Capture API. Chromium M142 restored separate defaults+after a regression and now classifies ordinary web `getDisplayMedia()` as+`kOther`, not `kExtensionScreenShare`. Without explicit constraints, that path+selects browser-decided echo cancellation and defaults noise suppression and+automatic gain control on. Its processed candidate also defaults to one channel.++This is real source processing, not just settings metadata:+`MakeForDisplayCapture()` creates a local WebRTC audio-processing module and+uses PeerConnection playout as the echo reference. Setting `contentHint` to+`music` after capture does not rewrite those source properties; current Blink's+WebRTC audio sink has no matching handler, and libwebrtc's Opus encoder retains+a TODO for content-hint use.++The Chrome/Edge capture request therefore supplies bare `false` constraints for+echo cancellation, noise suppression, automatic gain, and voice isolation, plus+`channelCount: { ideal: 2 }`. These are post-selection preferences, not source+picker restrictions or cross-browser guarantees. The declared Host baseline+accepts them; a browser may ignore unsupported dictionary members. No `exact`,+`min`, `advanced`, or fixed sample rate is requested, so this change does not+turn optional screen audio into a hard capture gate.## Standard API Boundary| Concern | Standard request or control | Honest readback | What it does not prove | Current product action || --- | --- | --- | --- | --- |-| Audio presence | `getDisplayMedia({ audio: true, video: ... })` expresses interest | `stream.getAudioTracks().length` proves only whether a track was returned | The browser may still return video only; a track does not identify system, window, tab, or selected-game audio | Keep the existing presence check and visible no-audio warning |+| Audio presence | A `MediaTrackConstraints` audio dictionary expresses interest | `stream.getAudioTracks().length` proves only whether a track was returned | The browser may still return video only; a track does not identify system, window, tab, or selected-game audio | Keep the existing presence check and visible no-audio warning || Audio source choice | `windowAudio: "window"` asks for window audio and `systemAudio: "include"` offers system audio for monitor surfaces; a user agent may ignore either hint | There is no standard audio-source category readback corresponding to those hints | The selected audio scope, per-application isolation, or cross-browser availability | Let the picker expose the source-appropriate option without adding an inferred source label || Content intent | `track.contentHint = "music"` records the source intent | The assigned hint can be read back | A codec, bitrate, stereo mode, or evidence that current Chromium changed Opus encoding | Keep it as metadata only; do not use it as a quality acceptance signal || Voice-app exclusion | `restrictOwnAudio` concerns audio produced by the document that invoked capture; `suppressLocalAudioPlayback` concerns local playback of a captured browser surface | The app may observe whether a returned track exists, not which OS processes it contains | Excluding Discord, KOOK, WeChat, notifications, or any other independent process from system audio | Web keeps video-only available and warns that system audio may include calls/notifications; it does not claim isolation |-| Capture channels | The Screen Capture specification does not list generic `channelCount` as applicable to display audio | `track.getSettings().channelCount` may describe the returned track when the browser supplies it | That the app controlled the value, or that the RTP encoder sends stereo | Observe only in a future diagnostic; absent means unknown |+| Source processing | Current Chromium accepts EC/NS/AGC/voice-isolation constraints on web display audio | Corresponding `track.getSettings()` fields can confirm values when exposed | Portable support, or that a missing field means false | Request all four off for movie/game audio and verify the target Host settings |+| Capture channels | Current Chromium accepts `channelCount: { ideal: 2 }`; the Screen Capture specification does not make it portable | `track.getSettings().channelCount` may describe the returned track when exposed | That every source/browser can supply stereo, or that RTP sends stereo | Prefer two without using `exact`; keep negotiated Opus truth separate || Capture sample rate | The Screen Capture specification does not list generic `sampleRate` as applicable to display audio | `track.getSettings().sampleRate` may be present in an implementation | The Opus mode, RTP clock semantics, receiver output rate, or end-to-end fidelity | Observe only in a future diagnostic; absent means unknown || RTP send bitrate | `RTCRtpSender.setParameters()` can set `encodings[].maxBitrate` for audio; Opus `maxaveragebitrate` advertises the receiver's maximum | A following `getParameters()` can show the applied sender ceiling; negotiated fmtp shows the receiver maximum; outbound byte deltas show actual traffic | A minimum, audible improvement, or moment-to-moment rate; congestion may keep traffic lower | Pair the 128 kbps sender ceiling with the same Opus receive maximum and retain actual bitrate as the acceptance fact || Codec | The user agent chooses among negotiated send codecs unless a separately negotiated codec selection is available | `RTCCodecStats.mimeType` and `sdpFmtpLine` identify the codec and negotiated format parameters in use | That Opus was selected before stats exist, or that negotiated preferences describe actual content | Label only observed negotiated data; do not force a codec |@@ -116,10 +125,13 @@ actual traffic and congestion behavior remain runtime observations.The Screen Capture Working Draft says constraints are applied only after theuser chooses a surface and that `getUserMedia()` constraints do not apply to-display tracks unless this specification lists them. The only audio-constrainable properties it currently lists are `restrictOwnAudio` and-`suppressLocalAudioPlayback`; neither controls fidelity. It explicitly permits-a browser to return no audio despite an audio request.+display tracks unless this specification lists them. The only portable audio+properties it currently lists are `restrictOwnAudio` and+`suppressLocalAudioPlayback`; neither controls fidelity. Chromium's processing+and channel behavior is therefore an implementation contract for the declared+Chrome/Edge Host baseline. The specification also explicitly permits a browser+to return no audio despite an audio request and rejects `advanced` or `min`/+`exact` display constraints; this request uses none of them.MDN browser-compatibility data on the access date reports:@@ -173,17 +185,13 @@ normal congestion adaptation. This is implementation evidence for the currentChrome/Edge baseline, while the RFC still defines the parameter as a receivermaximum rather than a minimum or continuous bitrate guarantee.-The poor movie/music report against production `6ccb516` is consistent with its-historical state. That release and its pre-stereo source set a 128 kbps sender-ceiling, but Web peer negotiation did not request stereo; the SFU publisher set-`dtx: false` while inheriting `forceStereo: false` and `red: true`. That-mono-by-default contract is no longer current. The present integration base-already upserts peer `stereo=1` and publishes SFU audio with `forceStereo: true`,-`dtx: false`, and RED retained. Its remaining peer-specific gap is the absent-`maxaveragebitrate`: libwebrtc starts stereo at 64 kbps despite the 128 kbps-sender ceiling. This slice adds the matching receiver maximum. Capture/source-loss, packet loss, jitter and concealment can still degrade audio and remain-separate diagnostic facts.+The poor movie/music report against production `6ccb516` began under a+historical mono negotiation contract, but it remained after the current source+added peer `stereo=1;maxaveragebitrate=128000` and SFU `forceStereo: true`,+128 kbps, DTX off, and RED retained. Those encoder settings cannot restore PCM+already changed or collapsed to mono by the Host capture processor. Loss,+jitter and concealment remain separate diagnostic facts, but direct SFU+reproduction makes source processing the first reversible correction.## Reference Implementations@@ -273,12 +281,14 @@ Never substitute `48000`, `2`, `false`, or `0` for an unavailable field.## Minimal Route-Consistent Runtime Slice-The source-complete runtime slice changes negotiation, not capture or congestion-control:+The route-consistent runtime covers capture and negotiation without replacing+browser congestion control:-1. Keep `contentHint = "music"`, one audio track and the existing 128 kbps- sender ceiling. Do not add Web Audio mixing, resampling, a second audio- representation or a new rate controller.+1. Request display audio with echo cancellation, noise suppression, automatic+ gain, and voice isolation disabled plus ideal two-channel capture. Keep+ `contentHint = "music"` as metadata, one audio track and the existing 128 kbps+ sender ceiling. Do not force a sample rate or add Web Audio mixing,+ resampling, a second representation or a new rate controller.2. On every Web Viewer answer, including ICE restart/rebuild answers, parse SDPwith direct dependencies on MIT-licensed `sdp-transform` 2.15.0 and itsTypeScript declarations. Select the single non-rejected audio media section,@@ -443,7 +453,9 @@ be copied into Screener's screen-media path.- [libwebrtc Opus encoder](https://webrtc.googlesource.com/src/+/refs/heads/main/modules/audio_coding/codecs/opus/audio_encoder_opus.cc)- [libwebrtc media-track interface](https://webrtc.googlesource.com/src/+/refs/heads/main/api/media_stream_interface.h)- [Chromium `MediaStreamTrack` content hint](https://chromium.googlesource.com/chromium/src/+/refs/heads/main/third_party/blink/renderer/modules/mediastream/media_stream_track_impl.cc)-- [Chromium content-capture audio defaults](https://chromium.googlesource.com/chromium/src/+/refs/heads/main/content/renderer/media/stream/media_stream_constraints_util_audio_unittest.cc)+- [Chromium web display-audio constraint selection](https://github.com/chromium/chromium/blob/3620c35de32f20cfb11d0a616227c44750e31c67/third_party/blink/renderer/modules/mediastream/media_stream_constraints_util_audio.cc)+- [Chromium M142 display-audio default restoration](https://chromium.googlesource.com/chromium/src/+/b059fa325c6da901f1b0b6afd9e736d67f62960e)+- [Chromium display-capture audio processing](https://github.com/chromium/chromium/blob/0d07b03783490c156526384073fb5e97e7463e77/third_party/blink/renderer/modules/mediastream/media_stream_audio_processing_layout.cc)- [LiveKit 2.22.0 track options](https://github.com/livekit/client-sdk-js/blob/v2.22.0/src/room/track/options.ts)- [LiveKit 2.22.0 publish defaults](https://github.com/livekit/client-sdk-js/blob/v2.22.0/src/room/defaults.ts)- [LiveKit 2.22.0 local publication](https://github.com/livekit/client-sdk-js/blob/v2.22.0/src/room/participant/LocalParticipant.ts)diff --git a/docs/status.md b/docs/status.mdindex 95c3167a..c70ea3c1 100644--- a/docs/status.md+++ b/docs/status.md@@ -4,7 +4,7 @@ Last updated: 2026-08-21## Phase-Production is exact `3d75e7b886350852d08027eb2d3c460f36a791e4` at `https://share.bonfire.icu`, release `3d75e7b88635`, wire `screener-v4`; rollback is release `20cb1bdb2be3`. SQLite v3/five rooms keeps SHA-256 `aef724ae52c4107be8ec8791e72f8dcaa11b0ec849fb432d022e2cfb9cfe0974`, owner/mode `screener:screener`/0600. Four services and local/public health are green.+Production is exact `4ee2f27f3f3e0882ae6f9d970fef1cf3b6fb1f7b` at `https://share.bonfire.icu`, release `4ee2f27f3f3e`, wire `screener-v4`; rollback is release `3d75e7b88635`. SQLite v3/five rooms keeps SHA-256 `aef724ae52c4107be8ec8791e72f8dcaa11b0ec849fb432d022e2cfb9cfe0974`, owner/mode `screener:screener`/0600. Four services and local/public health are green.Ordinary ICE is STUN-only; limits are SFU roots <=2, one `peer-selected` attempt excluding Host ingress, and selected UDP TTL 120. No browser/media/SFU/TURN/performance canary ran; exact-`16f6eab` Host-ingress proof is separate.Stable SFU, route/transport truth, preview notice, entry/nickname UI and Web relay cap2 are live. Native is source-only. The controlled production A/B uses browser/LiveKit codec defaults; explicit codec controls are source-complete.@@ -16,7 +16,7 @@ Parallel flagship work; use minimum relevant checks and rollback proof. Target-d- Capture precedes rooms; source/quality changes and AV pause preserve peers. Defaults are balanced and automatic codec; clarity/fluid plus H.264/VP8 stay explicit, with codec locked during a share. Browser degradation and Host SFU A+B remain open.- Deployed `screener-v4` admits private fragment grants directly; code-only Viewers need site access, and private rooms additionally need their password. Credentials remain unstored. Web presence fields remain opt-in and Native does not subscribe to them.-- Deployed UI has nickname editing, room entry, Viewer roster, duplicate-only ID suffixes, pause notice, and session-bound SFU first-media truth that clears on track/route/session loss. P2P/SFU/TURN labels require evidence. A source candidate gives an opted-in Web Host guarded evidence for relayed Viewers without Host-local transport claims or false parent-edge proof.+- Deployed UI has nickname editing, room entry, Viewer roster, duplicate-only ID suffixes, pause notice, and session-bound SFU first-media truth that clears on track/route/session loss. P2P/SFU/TURN labels require evidence. Guarded relay evidence reaches opted-in Web Host rosters without Host-local transport claims or false parent-edge proof.- Native v4 is source-only (memory rooms, 300s reclaim); it does not subscribe to Web presence, follows authenticated direct-child assignments up to two, and fails unsupported SFU/selected ingress boundedly.- Production is roots/Web relay <=2; every Viewer has one upstream and rejects child3. One-root healthy-SFU MBB is deployed but media-unverified; capacity `0 -> 1`, multi-root and browser gates remain open. Room `1` is historical; HTTPS/WSS is TLS/TCP.- After an answer, a generation-bound 15s initial-connect deadline enters ICE restart; success/replacement/disposal cancels it. It is deployed but not mobile-verified.@@ -55,7 +55,7 @@ Recovery uses one ICE restart, one same-parent rebuild, one alternate peer, thenNative WGC/MF passed one-Viewer hardware; package download, Viewer2/FIFO and game A/V remain. Use representative target-device or production evidence for performance, not an ordinary-PC synthetic gate.Ordinary peers stay STUN-only; initial ingress, `peer-selected`, and healthy-reselection browser gates remain open.ADR-0004 still needs its resource/quality matrix; the 20-viewer gate precedes a default change. Mobile uses the same capacity and is a compatibility observation.-Peer/SFU stereo targets 128 kbps in production; user route comparison remains. Next: codec-lock explanation, then existing-stats H.264 encoder follow-up.+Screen-audio candidate disables Chromium speech APM and prefers stereo before 128 kbps peer/SFU; verify Host settings and direct routes.## Blockers And Decisionsdiff --git "a/docs/\346\226\271\346\241\210\350\256\276\350\256\241.md" "b/docs/\346\226\271\346\241\210\350\256\276\350\256\241.md"index db689d75..8c91a91f 100644--- "a/docs/\346\226\271\346\241\210\350\256\276\350\256\241.md"+++ "b/docs/\346\226\271\346\241\210\350\256\276\350\256\241.md"@@ -158,7 +158,7 @@ Zod 在服务边界拒绝未知类型、超长字符串、非法 SDP/candidateWeb 视频端不做视频 SDP munging。`automatic` 不调用 P2P `setCodecPreferences()` 且不覆盖 LiveKit 默认 codec;显式 H.264/VP8 在首个 offer/publication 前应用,P2P 与 browser relay 仍保留完整 browser codec/repair 回退列表,SFU 始终保持 `backupCodec: false`。codec 改动不热切换现有连接。实际 outbound codec/profile、encoder implementation 与 stats 是结果真相;浏览器支持 H.264 不证明命中硬编。AV1 仍不得仅凭压缩率推断默认启用。唯一获准的 Web SDP 变换是下述 Viewer answer 的 Opus stereo receive preference,不得借此扩展视频码率、codec 或通用 munging。-`audio: true` 只是请求。若 `getAudioTracks()` 为空,分享者界面必须显示“当前来源没有可共享音频”。Web 端同时传入 `windowAudio: "window"` 与 `systemAudio: "include"`:窗口选项请求该窗口/应用音频,整个屏幕选项允许用户勾选系统音频;标签页使用浏览器自身的标签页音频选择。浏览器可以忽略这些 picker hints,且没有对应的标准来源类型读回,因此 UI 不额外推断或标注来源。系统音频由用户显式选择,可能包含语音或通知;video-only 始终可用。+Web display-audio 请求显式关闭 `echoCancellation`、`noiseSuppression`、`autoGainControl` 和 `voiceIsolation`,并以 `channelCount: { ideal: 2 }` 偏好双声道;这是当前 Chrome/Edge Host 基线的实现契约,用于避开网页 `getDisplayMedia()` 默认的语音处理和单声道 APM 候选,不宣称跨浏览器保证,也不固定采样率。所有值都是非强制 post-selection preference;不使用 `exact`、`min` 或 `advanced`。若 `getAudioTracks()` 为空,分享者界面必须显示“当前来源没有可共享音频”。Web 端同时传入 `windowAudio: "window"` 与 `systemAudio: "include"`:窗口选项请求该窗口/应用音频,整个屏幕选项允许用户勾选系统音频;标签页使用浏览器自身的标签页音频选择。浏览器可以忽略这些约束或 picker hints,且没有对应的标准来源类型读回,因此 UI 不额外推断或标注来源。系统音频由用户显式选择,可能包含语音或通知;video-only 始终可用。当前 Windows Native sender 用本地 opaque ID 保存所选窗口的 HWND、PID 与进程创建时间;helper 在使用前重新验证三者绑定,并以 WASAPI process loopback 的 include-target-process-tree 捕获游戏及其子进程。目标进程无渲染流、退出或捕获失败时显示无声/未知,不回退为整机音频,也不上传 PID、路径、窗口标题、设备标识或原始音频。该路径只支持 Windows 11;Windows 10 game-only 音频保持明确不支持。@@ -172,7 +172,7 @@ Host 本地预览直接绑定现有 capture stream,不创建 viewer、`RTCPeer部署版 `769de201f7cc` 的模糊、游戏低帧、持续 `bandwidth` 提示和 Host 刷新恢复都只作为同一 release 的用户报告。首轮复现必须在相同机器、Chrome/Edge、驱动、游戏场景和单个有线 direct Viewer 上对照该 release 与最新 `main`,并分别执行只重建受影响 `HostPeer`、只替换 capture、完整 Host 重建和预览开/关;任何一次只改变一个变量。若实际 codec/encoder 不变而 BWE/发送恢复,则下调 codec 根因优先级;只有编码成本异常时才进入受控 codec spike。-当前 Web “高级视频设置”不暴露音频质量控件。Screen Capture 规范未把 `channelCount`、`sampleRate` 列为 display-audio 可控属性;`track.getSettings()` 中偶尔出现的值只能作为捕获观测。每个 Web Host、浏览器 relay 或 selected-edge 的实际音频 sender 在首次绑定和换源后通过标准 `RTCRtpSender.setParameters()` 请求并读回 128 kbps ceiling;这只是上限,浏览器 WebRTC 拥塞控制仍可降低实际流量,不新增应用层音频降级器。RFC 7587 将 20 ms full-band stereo music 的建议区间列为 64--128 kbps,pinned LiveKit 2.22.0 也把 128 kbps 命名为 `musicHighQualityStereo`。当前 libwebrtc 在未收到 `maxaveragebitrate` 时把 full-band stereo 的初始 codec bitrate 配成 64 kbps,因此 peer answer 同时声明 128 kbps receiver maximum,和 sender ceiling/SFU preset 对齐;普通 PC synthetic 不用于标定参数、听感或性能。+当前 Web “高级视频设置”不暴露音频质量控件。`track.getSettings()` 中存在的 EC/NS/AGC/voice-isolation、`channelCount` 和 `sampleRate` 只能作为当前捕获观测;缺失字段保持未知,Opus 协商仍是独立事实。每个 Web Host、浏览器 relay 或 selected-edge 的实际音频 sender 在首次绑定和换源后通过标准 `RTCRtpSender.setParameters()` 请求并读回 128 kbps ceiling;这只是上限,浏览器 WebRTC 拥塞控制仍可降低实际流量,不新增应用层音频降级器。RFC 7587 将 20 ms full-band stereo music 的建议区间列为 64--128 kbps,pinned LiveKit 2.22.0 也把 128 kbps 命名为 `musicHighQualityStereo`。Peer answer 同时声明 `stereo=1;maxaveragebitrate=128000`,与 sender ceiling/SFU preset 对齐;普通 PC synthetic 不用于标定参数、听感或性能。Web peer 的最小 stereo 契约只改 Viewer 生成的 answer。实现把 MIT `sdp-transform` 2.15.0 与 `@types/sdp-transform` 声明为 root direct dependencies,不依赖 LiveKit 的 transitive install,也不用字符串或正则拼接 SDP。Helper 仅在解析出唯一非 rejected audio media、通过结构化 `rtp` entry 找到唯一 Opus payload 时,才在该 payload 的 fmtp 幂等 upsert `stereo=1` 与 `maxaveragebitrate=128000`;随后 `ViewerPeer` 把同一个结果交给 `setLocalDescription()` 和 signaling。首次连接、ICE restart、同 parent rebuild、浏览器 relay child 与 selected-edge TURN 都走该边界;TURN 只改变 ICE transport。空 SDP、无或歧义 Opus、多个有效 audio、重复目标参数、畸形 fmtp、parse/write 异常都按对象 identity 返回浏览器原 answer,保住仍可继续的 mono/video edge,不发送半修改 SDP。RFC 7587 说明这两个值都是可选的单向 receiver parameters;`maxaveragebitrate` 是 maximum 而非最低保证,实际发送仍可随拥塞下降。当前 libwebrtc 把缺省 full-band stereo codec bitrate 配成 64 kbps,而 `RTCRtpSender.maxBitrate=128000` 只限制上界,不能单独把它提高;显式 128 kbps 参数让 peer 与 LiveKit preset 使用同一 codec 配置目标。`sprop-stereo` 只是 sender likelihood hint,`usedtx` 缺省已是 0,本 slice 不增加二者,也不改浏览器协商的 `useinbandfec`。diff --git a/src/client/media/audio-capture.ts b/src/client/media/audio-capture.tsindex 67672254..17683600 100644--- a/src/client/media/audio-capture.ts+++ b/src/client/media/audio-capture.ts@@ -3,12 +3,24 @@ type DisplayMediaAudioHints = DisplayMediaStreamOptions & {windowAudio?: "exclude" | "window" | "system";};+type DisplayMediaAudioConstraints = MediaTrackConstraints & {+ voiceIsolation?: ConstrainBoolean;+};+export function displayMediaOptions(video: MediaTrackConstraints,): DisplayMediaStreamOptions {+ // Chromium web display capture otherwise defaults to speech processing.+ const audio: DisplayMediaAudioConstraints = {+ echoCancellation: false,+ noiseSuppression: false,+ autoGainControl: false,+ voiceIsolation: false,+ channelCount: { ideal: 2 },+ };return {video,- audio: true,+ audio,systemAudio: "include",windowAudio: "window",} as DisplayMediaAudioHints;diff --git a/tests/audio-capture.test.ts b/tests/audio-capture.test.tsindex c5cf1afc..b6226cdd 100644--- a/tests/audio-capture.test.ts+++ b/tests/audio-capture.test.ts@@ -3,11 +3,17 @@ import { describe, expect, it } from "vitest";import { displayMediaOptions } from "../src/client/media/audio-capture.ts";describe("browser display audio capture", () => {- it("offers source-appropriate audio for windows and full displays", () => {+ it("keeps screen audio free of speech processing and prefers stereo", () => {const options = displayMediaOptions({ width: { ideal: 1280 } });expect(options).toMatchObject({- audio: true,+ audio: {+ echoCancellation: false,+ noiseSuppression: false,+ autoGainControl: false,+ voiceIsolation: false,+ channelCount: { ideal: 2 },+ },systemAudio: "include",windowAudio: "window",});diff --git a/tests/quality.test.ts b/tests/quality.test.tsindex 195660c6..3bea0c35 100644--- a/tests/quality.test.ts+++ b/tests/quality.test.ts@@ -54,7 +54,13 @@ describe("realtime quality controls", () => {height: { ideal: 1080, max: 1080 },frameRate: { ideal: 30, max: 30 },},- audio: true,+ audio: {+ echoCancellation: false,+ noiseSuppression: false,+ autoGainControl: false,+ voiceIsolation: false,+ channelCount: { ideal: 2 },+ },systemAudio: "include",windowAudio: "window",});