Commit 4dc27ae
feat(video-conf): blur the background properly, and say what is being sent
Background blur was `@livekit/track-processors`, which composites the background into a texture at a quarter of the
frame's size and stretches it back — a 480×270 background on a 1080p frame. That upscale, not the radius, is what
looked like low quality, and the factor is a constant in the library: setting blur to 0.1 and still seeing a heavy,
coarse background is what found it.
So the blur is ours now. MediaPipe's segmenter and a 2D canvas, compositing at full frame size in three draws, with
`ctx.filter` doing the Gaussian on the GPU. Strengths are fractions of frame height rather than pixels, since the
same track is watched at whatever size the other end's tile happens to be. Changing strength is a number on the
running processor, and "no blur" leaves it attached passing frames through, because detaching one re-publishes the
camera.
Two things about the mask are the opposite of what they look like, and both were wrong first:
- MediaPipe returns a mask the size of the image it is given, so segmenting the frame meant reading 1080p worth of
mask off the GPU every frame — 94ms. It segments a copy scaled to the model's own input size instead, which is what
the model does internally anyway, and the same frame costs 20ms. Segmentation runs on its own 20Hz clock from there.
- which category is the person differs by model: the two-class one marks the *room*, the multiclass one marks five
kinds of person. Reading it the wrong way blurred the face and left the room sharp. It now builds a lookup table
from `getLabels()` — everything not called `background` — which is right for both. The multiclass model is the
default: its separate `hair` class holds an edge far better, at 65× the download.
Alongside it, the same three choices — noise cancelling, send resolution, blur — are now in the preflight's own mic
and camera menus, which meant giving the preflight a real LiveKit track so its preview runs the processor the call
will run rather than showing an unblurred picture beside a blurred promise. The local tile carries a badge with the
resolution actually going out, read from `getRTCStatsReport()`, because the encoder picks simulcast layers and what
leaves the machine is often not what the camera captured.
Also fixes the camera flashing whenever the microphone was toggled or switched: the video element was being handed a
new `srcObject` on every render that touched audio. `@livekit/track-processors` is dropped; `@mediapipe/tasks-vision`
is a direct dependency, pinned because the WASM URL carries its version.
Known, and written down in the feature doc: the resolution picker sets a capture constraint rather than an encoder
cap, and a remembered blur level is still not applied on join.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>1 parent 1dce466 commit 4dc27ae
26 files changed
Lines changed: 1434 additions & 147 deletions
File tree
- apps/meteor
- client/views
- conference
- hooks
- videoConference/livekit
- docs/features/native-video-conference
- packages
- i18n/src/locales
- ui-voip/src
- components
- context
- providers
- views
- MediaCallRoomSection
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
| 11 | + | |
10 | 12 | | |
11 | 13 | | |
12 | 14 | | |
13 | | - | |
| 15 | + | |
| 16 | + | |
14 | 17 | | |
15 | 18 | | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
16 | 26 | | |
17 | 27 | | |
18 | 28 | | |
| |||
51 | 61 | | |
52 | 62 | | |
53 | 63 | | |
54 | | - | |
| 64 | + | |
55 | 65 | | |
56 | 66 | | |
57 | 67 | | |
58 | 68 | | |
59 | 69 | | |
60 | 70 | | |
61 | | - | |
62 | | - | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
63 | 82 | | |
64 | | - | |
65 | | - | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
66 | 110 | | |
67 | 111 | | |
68 | 112 | | |
| |||
73 | 117 | | |
74 | 118 | | |
75 | 119 | | |
76 | | - | |
77 | | - | |
| 120 | + | |
| 121 | + | |
78 | 122 | | |
79 | 123 | | |
80 | 124 | | |
81 | | - | |
| 125 | + | |
82 | 126 | | |
83 | 127 | | |
84 | 128 | | |
85 | 129 | | |
86 | 130 | | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | | - | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
108 | | - | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
109 | 142 | | |
110 | | - | |
| 143 | + | |
111 | 144 | | |
112 | 145 | | |
113 | 146 | | |
| |||
Lines changed: 103 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
11 | | - | |
12 | | - | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
13 | 21 | | |
14 | 22 | | |
15 | 23 | | |
| |||
59 | 67 | | |
60 | 68 | | |
61 | 69 | | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
62 | 98 | | |
63 | 99 | | |
64 | 100 | | |
| |||
77 | 113 | | |
78 | 114 | | |
79 | 115 | | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
80 | 126 | | |
81 | 127 | | |
82 | 128 | | |
83 | 129 | | |
84 | 130 | | |
85 | | - | |
86 | 131 | | |
87 | | - | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
88 | 145 | | |
89 | 146 | | |
90 | | - | |
91 | | - | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
92 | 150 | | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
93 | 157 | | |
94 | | - | |
| 158 | + | |
95 | 159 | | |
96 | 160 | | |
97 | 161 | | |
| |||
164 | 228 | | |
165 | 229 | | |
166 | 230 | | |
167 | | - | |
| 231 | + | |
168 | 232 | | |
169 | 233 | | |
170 | 234 | | |
171 | 235 | | |
172 | 236 | | |
173 | 237 | | |
174 | 238 | | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
175 | 248 | | |
176 | 249 | | |
177 | 250 | | |
| |||
219 | 292 | | |
220 | 293 | | |
221 | 294 | | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
222 | 303 | | |
223 | 304 | | |
224 | 305 | | |
| |||
235 | 316 | | |
236 | 317 | | |
237 | 318 | | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
238 | 333 | | |
239 | 334 | | |
240 | 335 | | |
| |||
Lines changed: 5 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
35 | | - | |
36 | | - | |
| 35 | + | |
| 36 | + | |
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
| |||
77 | 77 | | |
78 | 78 | | |
79 | 79 | | |
80 | | - | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
81 | 83 | | |
82 | 84 | | |
83 | 85 | | |
| |||
0 commit comments