feat(nvenc): implement async encode and hang recovery (#3629)

* feat(nvenc): implement async encode

* fix(video): allow NVENC to complete teardown asynchronously
This commit is contained in:
Cameron Gutman
2025-02-06 22:22:00 -06:00
committed by GitHub
parent dbba364ed7
commit 265a00793c
4 changed files with 34 additions and 6 deletions

View File

@@ -10,11 +10,19 @@
namespace nvenc {
nvenc_d3d11::nvenc_d3d11(NV_ENC_DEVICE_TYPE device_type):
nvenc_base(device_type) {
async_event_handle = CreateEvent(NULL, FALSE, FALSE, NULL);
}
nvenc_d3d11::~nvenc_d3d11() {
if (dll) {
FreeLibrary(dll);
dll = NULL;
}
if (async_event_handle) {
CloseHandle(async_event_handle);
}
}
bool nvenc_d3d11::init_library() {
@@ -53,5 +61,9 @@ namespace nvenc {
return false;
}
bool nvenc_d3d11::wait_for_async_event(uint32_t timeout_ms) {
return WaitForSingleObject(async_event_handle, timeout_ms) == WAIT_OBJECT_0;
}
} // namespace nvenc
#endif