Commit e297b86
fix: AbortSignal now actually stops the running ffmpeg exec (#719)
Previously, aborting an exec() or ffprobe() only rejected the JS
Promise — the underlying WASM process kept running to completion.
This caused wasted CPU and made AbortController useless for long
transcoding operations.
Fix: when the abort signal fires for EXEC or FFPROBE, immediately
send a CANCEL message to the worker. The worker calls
ffmpeg.setTimeout(1), setting the WASM watchdog to fire after 1 ms.
This stops the running command as quickly as possible (exit code 1)
without terminating the entire worker — the FFmpeg instance stays
loaded and ready for the next command.
Also: fix a memory leak where Blob URLs created for coreData /
wasmData / workerData were never revoked. They are now tracked in
#blobURLs and revoked in terminate().
Changes:
- const.ts: add FFMessageType.CANCEL
- worker.ts: add cancel() handler calling ffmpeg.setTimeout(1)
- classes.ts: send CANCEL on exec/ffprobe abort; track blob URLs
Closes #719
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>1 parent ad665df commit e297b86
3 files changed
Lines changed: 60 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
27 | 30 | | |
28 | 31 | | |
29 | 32 | | |
| |||
55 | 58 | | |
56 | 59 | | |
57 | 60 | | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
58 | 68 | | |
59 | 69 | | |
60 | 70 | | |
| |||
123 | 133 | | |
124 | 134 | | |
125 | 135 | | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
126 | 150 | | |
127 | 151 | | |
128 | 152 | | |
| |||
219 | 243 | | |
220 | 244 | | |
221 | 245 | | |
222 | | - | |
223 | | - | |
224 | | - | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
225 | 256 | | |
| 257 | + | |
| 258 | + | |
226 | 259 | | |
227 | 260 | | |
228 | 261 | | |
| |||
329 | 362 | | |
330 | 363 | | |
331 | 364 | | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
332 | 371 | | |
333 | 372 | | |
334 | 373 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
108 | 108 | | |
109 | 109 | | |
110 | 110 | | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
111 | 124 | | |
112 | 125 | | |
113 | 126 | | |
| |||
181 | 194 | | |
182 | 195 | | |
183 | 196 | | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
184 | 201 | | |
185 | 202 | | |
186 | 203 | | |
| |||
0 commit comments