Commit 5af7d53
committed
fix(wgc): give the audio write its own breadcrumb instead of the video's
An adversarial review of 4d1a0cc caught this, and three independent passes
landed on it separately: naming the audio write was right, putting it in
encodeStage_ was not.
encodeStage_ is a single slot. Almost all of the video thread's stages -- the
whole DXGI bridge sequence in convertBgraTextureToNv12 and captureDxgiSample --
are set with no MFEncoder lock held; only submitVideoSample's stamp sits under
writerMutex_. So the previous commit's claim that "both stamps are serialized
by the mutex they sit under" was true of the two WriteSample stamps and of
nothing else.
The consequence ran backwards from the intent. writeAudio runs on the
audio-mixer thread, which emits roughly every 10 ms and ends each call by
storing "idle". A video thread wedged in bridge-copy therefore had its
breadcrumb erased within milliseconds, and the watchdog line -- the single
piece of evidence this instrumentation exists to produce -- would have printed
encode_stage=idle for precisely the hang it was added to identify. Worse on
the system-audio configuration than anywhere else, which is the configuration
reproducing #252 most consistently.
One slot per writing thread. encodeStage_ is single-writer again (the video
thread), audioStage_ belongs to the mixer, and the abandoned-step line prints
both. A report showing audio_stage=write-audio next to a video stage stuck on
a bridge call now says the two are contending for writerMutex_, which is a
thing no shared slot could have expressed.
Verified at runtime on the previous commit: a 10-minute DXGI recording
(16,177 frames, gpu_bridge_contended=0) and a 15-second one both stopped
cleanly, so the surrounding path this touches is exercised, not just compiled.1 parent ef2d59d commit 5af7d53
3 files changed
Lines changed: 31 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1130 | 1130 | | |
1131 | 1131 | | |
1132 | 1132 | | |
| 1133 | + | |
| 1134 | + | |
| 1135 | + | |
| 1136 | + | |
| 1137 | + | |
| 1138 | + | |
1133 | 1139 | | |
1134 | | - | |
| 1140 | + | |
| 1141 | + | |
1135 | 1142 | | |
1136 | 1143 | | |
1137 | 1144 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
366 | 366 | | |
367 | 367 | | |
368 | 368 | | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
369 | 373 | | |
370 | 374 | | |
371 | 375 | | |
| |||
1365 | 1369 | | |
1366 | 1370 | | |
1367 | 1371 | | |
1368 | | - | |
| 1372 | + | |
| 1373 | + | |
| 1374 | + | |
| 1375 | + | |
| 1376 | + | |
| 1377 | + | |
| 1378 | + | |
| 1379 | + | |
| 1380 | + | |
| 1381 | + | |
1369 | 1382 | | |
1370 | 1383 | | |
1371 | | - | |
| 1384 | + | |
1372 | 1385 | | |
1373 | 1386 | | |
1374 | 1387 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
93 | 93 | | |
94 | 94 | | |
95 | 95 | | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
96 | 102 | | |
| 103 | + | |
97 | 104 | | |
98 | 105 | | |
99 | 106 | | |
| |||
156 | 163 | | |
157 | 164 | | |
158 | 165 | | |
| 166 | + | |
159 | 167 | | |
160 | 168 | | |
161 | 169 | | |
| |||
0 commit comments