Skip to content

WebScreenShareFixes: fix malformed SDP#4159

Merged
Vendicated merged 2 commits into
Vendicated:devfrom
coleleavitt:fix/wssf-malformed-sdp
Jun 8, 2026
Merged

WebScreenShareFixes: fix malformed SDP#4159
Vendicated merged 2 commits into
Vendicated:devfrom
coleleavitt:fix/wssf-malformed-sdp

Conversation

@coleleavitt

Copy link
Copy Markdown
Contributor

Summary

The WebScreenShareFixes plugin generates SDP that Discord's RTC server silently rejects on non-Mutter Wayland compositors (niri, hyprland, sway), causing "chooser appears, you pick, viewers see nothing" for Vesktop users on those compositors. Two specific bugs in the plugin:

  1. x-google-max-bitrate=80_000 — JavaScript numeric-literal underscore separator. The 80_000 is a valid JS literal (= 80000) but the replacement string is interpolated literally into the SDP, producing x-google-max-bitrate=80_000 (with underscore) on the wire. RFC 4566 requires plain integers; Discord's parser rejects this fmtp parameter and falls back to a codec the encoder isn't configured to send.

  2. b=AS:800000 injected inside an a=fmtp: line. b=AS: is a session/media-level bandwidth attribute (its own SDP line per RFC 4566), not an fmtp parameter. Injecting it inside a=fmtp:96 ...;b=AS:800000;level-asymmetry-allowed=1;... produces malformed SDP. Discord rejects the entire H.264 codec line.

Why this only surfaces now

Discord-in-Firefox uses the web JS pipeline (no Vencord, no SDP munging) and sends valid SDP — works everywhere. Discord-in-Chromium-via-Vencord on GNOME/Mutter also worked because Mutter's WebRTC stack has lenient SDP parsing OR because the codec falls back gracefully. On niri/hyprland/sway the rejection is fatal.

Fix

-                    replace: '"x-google-max-bitrate=80_000"'
+                    replace: '"x-google-max-bitrate=80000"'
-                {
-                    match: ";level-asymmetry-allowed=1",
-                    replace: ";b=AS:800000;level-asymmetry-allowed=1"
-                },

Removed the entire b=AS: injection — it was never valid SDP. The 80 Mbps bitrate cap removal (which is the legitimate purpose of the plugin per its description) still works via the corrected x-google-max-bitrate=80000 line.

Test plan

Empirically verified on Vesktop 1.6.5 + Vencord v1.14.10 + niri 26.04 + Electron 40.4.0 + Chromium 144 + xdg-desktop-portal-gnome 48:

  • Before: chooser dialog opens, source picked, stream "starts" but viewers see no video. Discord side: stream session ends after ~700ms.
  • After: chooser opens, source picked, stream starts cleanly, viewers see the screenshare.

No regression on Mutter/GNOME — verified the corrected SDP is still accepted there.

Refs

@coleleavitt
coleleavitt force-pushed the fix/wssf-malformed-sdp branch from 8e3def4 to 100f02a Compare May 1, 2026 01:54
…roots

- x-google-max-bitrate=80_000 -> 80000 (underscore invalid in SDP per RFC 4566)
- remove b=AS:800000 fmtp injection (b=AS is session-level, not fmtp)

Both caused Discord RTC server to reject the video codec on niri/wlroots.
Firefox-Discord (no Vencord) was unaffected, masking the bug on Mutter.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes WebScreenShareFixes generating malformed SDP in the web (Chromium/Vesktop) pipeline, which could cause Discord’s RTC server to reject the offer/answer on some Wayland compositors (wlroots/niri/hyprland/sway), resulting in screenshare starting but showing no video to viewers.

Changes:

  • Replace the injected SDP fmtp value x-google-max-bitrate=80_000 with x-google-max-bitrate=80000 to avoid sending an underscore in the SDP integer.
  • Remove the invalid injection of b=AS:800000 inside an a=fmtp: parameter list (not valid SDP syntax in that position).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@Vendicated
Vendicated changed the base branch from main to dev June 8, 2026 14:52
@Vendicated Vendicated changed the title WebScreenShareFixes: fix malformed SDP rejected by Discord on niri/wlroots WebScreenShareFixes: fix malformed SDP Jun 8, 2026
@Vendicated
Vendicated merged commit b6516a1 into Vendicated:dev Jun 8, 2026
1 check passed
@coleleavitt
coleleavitt deleted the fix/wssf-malformed-sdp branch June 8, 2026 15:08
@thecatontheceiling

Copy link
Copy Markdown

aislop

marcmy added a commit to marcmy/Vencord that referenced this pull request Jul 7, 2026
* fix ReviewDB & other stuff (Vendicated#4264)

* CustomCommands: fix rename leading to duplicate commands

Closes Vendicated#4283

* fix CallTimer (Vendicated#4280)

* PinDMS: fix duplicate context menu ids (Vendicated#4274)

* ViewRaw: add profile support

* Fix AccountPanelServerProfile sometimes erroring (Vendicated#4252)

* SupportHelper: improve snippet functionality (Vendicated#4282)

* WebScreenShareFixes: fix malformed SDP (Vendicated#4159)

* VcNarrator: don't narrate twice when using Overlay (Vendicated#4300)

Fixes Vendicated#2717

* SupportHelper: add "Run Snippet" to all issue posts (Vendicated#4289)

* AppleMusicRichPresence: make links customizable (Vendicated#4298)

* ViewRaw: improve UI

* BetterRoleContext: support role headers in member list (Vendicated#4276)

Co-authored-by: Vendicated <vendicated@riseup.net>

* Add Display Names for Settings (Vendicated#3212)

* AlwaysAnimate: support gradient roles (Vendicated#3528)

* ReviewDB: it's a big day for reddit nation (Vendicated#4216)

add updoots/downdoots

* ShikiCodeblocks: Fix line numbers wrapping in modals (Vendicated#4310)

* ReviewDB: Fix DM Profile Sidebar Patch (Vendicated#4315)

* fix PlatformIndicator badges appearing as blank

* Delete FriendsSince - now a stock Discord feature

* CharacterCounter: add selected text count (Vendicated#4129)

Co-authored-by: V <vendicated@riseup.net>

* PermissionsViewer: only show relevant permissions

* v1.14.14

* fix various plugins (Vendicated#4328)

Co-authored-by: thororen <78185467+thororen1234@users.noreply.github.com>
Co-authored-by: Vendicated <vendicated@riseup.net>

* sigh... v1.14.15

* YoutubeAdblock: fix lag/high memory usage after clicking videos (Vendicated#4317)

* Updater: fix potentially erroring in edge case

* Fix FakeNitro sticker support

* upgrade pnpm & dependencies

* Fix Decor, GameActivityToggle, SpotifyControls Finds (Vendicated#4366)

* ci: declare read-only permissions for tests

* ci: declare read-only permissions for patch reports

* ci: scope dev build token permissions

* ci: declare read-only permissions for mirror workflow

* ci: declare read-only permissions for browser publishing

* fix(browser): validate response URL hostnames

* build: remove legacy zip-local dependency

* deps: override vulnerable transitive packages

* build: create extension archives with fflate

* ci: refresh security lockfile

* security: document intentional Dev Companion evaluation

* security: document intentional patch regex construction

* ci: finish generated security updates

* ci: run security generation for pull request

* ci: self-remove security generation helper

* deps: refresh lockfile after security overrides

* deps: refresh lockfile and document bounded regexes

* deps: refresh lockfile and document bounded regexes

* ci: split test suite into diagnosable steps

* style: restore canonical source header

* style: restore Dev Companion source header

* ci: apply final CodeQL hardening fixes

* security: make lazy chunk matching linear

* security: bound Dev Companion dynamic inputs

* security: document trusted regex canonicalization

* ci: narrow CodeQL patch helper to shared matcher

* security: make shared chunk matcher linear

* ci: remove completed CodeQL patch helper

* security: anchor Dev Companion CodeQL suppressions

---------

Co-authored-by: thororen <78185467+thororen1234@users.noreply.github.com>
Co-authored-by: Vendicated <vendicated@riseup.net>
Co-authored-by: Clov <273623891+chloricacid@users.noreply.github.com>
Co-authored-by: Cole W. Leavitt <75138914+coleleavitt@users.noreply.github.com>
Co-authored-by: 5xk <gabrhhfk@gmail.com>
Co-authored-by: Ryan Cao <70191398+ryanccn@users.noreply.github.com>
Co-authored-by: NightmareSan7 <NightmareSan@web.de>
Co-authored-by: Suffocate <70031311+lolsuffocate@users.noreply.github.com>
Co-authored-by: Lumap <lumap@duck.com>
Co-authored-by: Manti <67705577+mantikafasi@users.noreply.github.com>
Co-authored-by: sadan4 <117494111+sadan4@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
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.

4 participants