Commit 195900f
{CUDA Decoding} Restore SW decoder fallback in xprsDecoderMaker
Summary:
A wheel built with `ENABLE_NVCODEC=ON` segfaults on any machine without an NVIDIA driver. The GitHub CI "Test wheel" job crashes with exit 139 after:
Cannot load libcuda.so.1
[XPRS][WARNING]: Loading CUDA functions failed
[DecoderFactory][WARNING]: Could not create a decoder for 'H.265'!
With no driver, `getNvCodecContext()` throws and `enumDecoders()` catches it, returning a non-OK result -- but the SW `hevc`/`h264` decoders were already collected before the throw, so the list is usable. `xprsDecoderMaker` bailed on the non-OK result and discarded that list, so no decoder was created and the null decoder was dereferenced downstream.
Three changes:
- Ignore the `enumDecoders()` result and fail only when the decoder list is genuinely empty. This is what fixes the crash.
- On decoder `init()` failure, continue to the next decoder instead of returning, so HW->SW fallback works.
- Skip HW decoders for monochrome streams, which NVDEC cannot decode.
These changes were reviewed as part of D103253728 and D110227872 but never reached master: the landed commit for D103253728 (`a4556645655d`) contains only its four `arvr/projects/compression/xprs/` files, and D110227872 was never landed. This file was last modified on 2026-04-29, so ShipIt exported a copy that had never received them.
The GPU path is unchanged.
Reviewed By: kongchen1992
Differential Revision: D1148064131 parent 2f4fc9e commit 195900f
1 file changed
Lines changed: 23 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
93 | 93 | | |
94 | 94 | | |
95 | 95 | | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
96 | 108 | | |
97 | 109 | | |
98 | 110 | | |
| |||
373 | 385 | | |
374 | 386 | | |
375 | 387 | | |
376 | | - | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
377 | 393 | | |
378 | 394 | | |
379 | 395 | | |
| |||
388 | 404 | | |
389 | 405 | | |
390 | 406 | | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
391 | 412 | | |
392 | 413 | | |
393 | 414 | | |
| |||
399 | 420 | | |
400 | 421 | | |
401 | 422 | | |
402 | | - | |
| 423 | + | |
403 | 424 | | |
404 | 425 | | |
405 | 426 | | |
| |||
0 commit comments