Skip to content

Don't attach the background blur processor to an ended camera track - #4231

Open
ara4n wants to merge 1 commit into
mainfrom
matthew/blur-processor-ended-track
Open

Don't attach the background blur processor to an ended camera track#4231
ara4n wants to merge 1 commit into
mainfrom
matthew/blur-processor-ended-track

Conversation

@ara4n

@ara4n ara4n commented Sep 3, 2026

Copy link
Copy Markdown
Member

This is a lowish priority Fable-generated PR to go and remove logspam around rejected promises.

Content

trackProcessorSync and useTrackProcessorSync called videoTrack.setProcessor(processor) with void. If the camera track has already ended, the blur processor's MediaStreamTrackProcessor cannot be constructed and the promise rejects, which surfaces as

Unhandled promise rejection: TypeError: Failed to construct 'MediaStreamTrackProcessor': Input track cannot be ended

Both call sites now go through one applyProcessor helper that skips tracks whose mediaStreamTrack.readyState is ended and catches and logs attach/detach failures.

Motivation and context

Seen in element-call-rageshakes#17225 (Element Desktop, background blur on). Harmless to the user since the track was going away anyway, but it is an unhandled rejection at warning level that shows up when reading logs.

Tests

  • New TrackProcessorContext.test.ts covering: attaches to a live track, skips an ended track, a rejected setProcessor does not become an unhandled rejection, stops the processor when none is wanted.
  • pnpm lint (tsc, oxlint, knip) clean.

Checklist

  • A linked, pre-approved issue exists for this feature or UI change. (bug fix, no UI change)
  • I have read CONTRIBUTING.md in full.
  • Pull request includes screenshots or videos for any UI changes. (none)
  • Tests written for new code (and existing touched code where feasible).
  • Linter and other CI checks pass.
  • I have licensed the changes to Element by completing the Contributor License Agreement (CLA)

If the camera track has already ended by the time the blur processor is
applied to it, MediaStreamTrackProcessor cannot be constructed and
setProcessor rejects. Both call sites used `void`, so this surfaced as

    Unhandled promise rejection: TypeError: Failed to construct
    'MediaStreamTrackProcessor': Input track cannot be ended

(element-call-rageshakes#17225). Skip ended tracks, and catch and log
processor attach/detach failures instead of leaking them.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

PR-Bug-Fix Release note category. A PR that fixes a bug.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant