Skip to content

fix(browser): restore a working rasterizer for screen-share capture - #213

Open
Lazare-42 wants to merge 1 commit into
v2-improvementsfrom
fix/teams-screenshare-gpu-rasterizer
Open

Lazare-42 wants to merge 1 commit into
v2-improvementsfrom
fix/teams-screenshare-gpu-rasterizer

Conversation

@Lazare-42

Copy link
Copy Markdown
Contributor

Problem

Teams recordings turn into row-shifted garbage the moment someone screen-shares. Confirmed on prod bot cdb011f5-9530-4a3c-81af-5ef42baaaafa (2026-07-09, customer-reported): clean for the first 3 min, then 46 minutes of unusable video — and zero errors logged. Corruption is present in raw_video.mp4, i.e. at capture, so ffmpeg/branding is not involved. The Teams DOM overlay stays crisp, so x11grab is fine — Chromium is painting the video surfaces as garbage.

Reproduced live on prod today with a fresh bot + screen share.

Cause

f531646 (Jul 2) moved Teams from plain Chrome to CloakBrowser, carrying over these flags:

--disable-gpu --disable-software-rasterizer --disable-gpu-compositing

CloakBrowser launches through Playwright with ignoreDefaultArgs = ["--enable-automation", "--enable-unsafe-swiftshader"] (its config.js), so it drops the SwiftShader flag Playwright normally passes, and adds --ignore-gpu-blocklist in headed mode. Result: no hardware GPU, no SwiftShader, no GPU compositing — but the blocklist ignored. Nothing is left that can raster a large surface. Small camera tiles still paint; a full-size share track does not.

The pre-Jul-2 Chrome path passed no GPU flags and kept --enable-unsafe-swiftshader, which is why this never happened before. Meet has run this same broken combo since Jun 2 — its screen-shares are likely affected too, just unreported.

Fix

BROWSER_GPU_MODE env var selects the flag set (browser/browser.ts):

mode flags
swiftshader (default) --disable-gpu --use-gl=angle --use-angle=swiftshader
none (none — pre-Jul-2 plain-Chrome behaviour)
legacy the broken combo, kept to reproduce on demand

Env-selectable so preprod can bisect the three variants without rebuilding the image.

Note: --enable-unsafe-swiftshader is deliberately not passed — Playwright applies ignoreDefaultArgs as a filter over the whole arg list, user args included (coreBundle.js:38322), so it would just be stripped again. It only gates WebGL; ANGLE-SwiftShader raster/compositing works without it.

Test plan

  • Preprod Teams bot + screen share on swiftshader → clean capture
  • If still corrupt, flip BROWSER_GPU_MODE=none (no rebuild) → clean capture
  • Confirm Meet join/record unaffected (Meet keeps CloakBrowser)
  • Then promote to prod and re-check a real screen-shared meeting

🤖 Generated with Claude Code

@coderabbitai

coderabbitai Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 8fd8f7f6-a5fa-400a-a0cb-2a5ae334b52f

📥 Commits

Reviewing files that changed from the base of the PR and between 434c2d6 and fa8a602.

📒 Files selected for processing (2)
  • src/browser/browser.ts
  • src/config/env-vars.ts

Summary by CodeRabbit

  • New Features
    • Added configurable Chromium GPU modes: swiftshader, none, and legacy.
    • GPU behavior is now selectable via an environment setting, with swiftshader as the default.
    • Allows swapping GPU launch behavior across environments without rebuilding.

Walkthrough

Chromium browser startup now supports configurable GPU argument profiles. The environment schema validates BROWSER_GPU_MODE and defaults it to swiftshader; openBrowser selects the matching profile with a fallback for unrecognized values.

Changes

GPU mode configuration

Layer / File(s) Summary
GPU mode contract and profiles
src/config/env-vars.ts, src/browser/browser.ts
Defines the supported BROWSER_GPU_MODE values and Chromium argument profiles for swiftshader, none, and legacy.
Browser launch selection
src/browser/browser.ts
Selects GPU arguments from the configured mode and falls back to swiftshader.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested reviewers: yusuf023, amr-meetingbaas, pdrion

Poem

A rabbit sees flags in a neat little row,
Swiftshader hops where the browsers go.
“None” and “legacy” join the parade,
With defaults carefully made.
GPU carrots launch bright and true!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: restoring a working browser rasterizer for screen-share capture.
Description check ✅ Passed The description matches the changeset and explains the browser GPU mode fix and rollout plan.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/teams-screenshare-gpu-rasterizer

Comment @coderabbitai help to get the list of available commands.

CloakBrowser launches Chromium through Playwright with
ignoreDefaultArgs = ["--enable-automation", "--enable-unsafe-swiftshader"],
dropping the SwiftShader flag Playwright passes by default, and adds
--ignore-gpu-blocklist in headed mode. Since f531646 moved Teams onto
CloakBrowser, our --disable-gpu + --disable-software-rasterizer +
--disable-gpu-compositing stacked on top of that, leaving no rasterizer able
to handle a large surface. Small camera tiles still paint; the moment a
screen-share track appears the whole stage is captured as row-shifted garbage
(bot cdb011f5, 2026-07-09: 46 min of unusable video, zero errors logged).

Replace the flag set with a coherent software stack (--disable-gpu +
ANGLE-SwiftShader) and make it env-selectable via BROWSER_GPU_MODE so the
config can be swapped in preprod without a rebuild.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@Lazare-42
Lazare-42 force-pushed the fix/teams-screenshare-gpu-rasterizer branch from 434c2d6 to fa8a602 Compare July 13, 2026 16:36
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