fix: ensure GPU availability is checked before using hardware acceleration
- Check both preferHardware AND gpuAvailable before using NVENC codecs (h264_nvenc, hevc_nvenc) - Check gpuAvailable before adding CUDA hwaccel flag for input decoding - Fix test assertion to check correct call index for CUDA hwaccel verification This prevents hardware acceleration attempts when GPU is unavailable, addressing code review feedback.
This commit is contained in:
parent
db3acff4f7
commit
00931098c1
2 changed files with 5 additions and 4 deletions
|
|
@ -253,7 +253,8 @@ test("does not add CUDA hwaccel for image input when hardware preferred", async
|
|||
|
||||
console.log = originalConsoleLog;
|
||||
|
||||
expect(calls[0]).not.toEqual(expect.arrayContaining(["-hwaccel", "cuda"]));
|
||||
// calls[0] is nvidia-smi, calls[1] is ffprobe, calls[2] is ffmpeg
|
||||
expect(calls[2]).not.toEqual(expect.arrayContaining(["-hwaccel", "cuda"]));
|
||||
expect(loggedMessage).toBe("stdout: Fake stdout");
|
||||
|
||||
delete process.env.FFMPEG_PREFER_HARDWARE;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue