|
18 | 18 | // #include <cuda_runtime.h> // For cudaStreamSynchronize |
19 | 19 |
|
20 | 20 | // Include dynamic loader for interface |
21 | | -#include "src/torchcodec/_core/NVCUVIDDynamicLoader.h" |
| 21 | +#include "src/torchcodec/_core/NVCUVIDRuntimeLoader.h" |
22 | 22 |
|
23 | 23 | // Include NVCUVID headers for types |
24 | 24 | #include "src/torchcodec/_core/nvcuvid_include/cuviddec.h" |
@@ -161,11 +161,6 @@ bool nativeNVDECSupport(const SharedAVCodecContext& codecContext) { |
161 | 161 | // Return true iff the input video stream is supported by our NVDEC |
162 | 162 | // implementation. |
163 | 163 |
|
164 | | - // First check if NVCUVID is available |
165 | | - if (!isNVCUVIDLoaded()) { |
166 | | - return false; |
167 | | - } |
168 | | - |
169 | 164 | auto codecType = validateCodecSupport(codecContext->codec_id); |
170 | 165 | if (!codecType.has_value()) { |
171 | 166 | return false; |
@@ -234,13 +229,7 @@ BetaCudaDeviceInterface::BetaCudaDeviceInterface(const torch::Device& device) |
234 | 229 | initializeCudaContextWithPytorch(device_); |
235 | 230 | nppCtx_ = getNppStreamContext(device_); |
236 | 231 |
|
237 | | - // Try to load NVCUVID - if this fails, we'll use CPU fallback |
238 | | - if (!initNVCUVID()) { |
239 | | - // NVCUVID loading failed, we'll create CPU fallback during initialize() |
240 | | - nvcuvidAvailable_ = false; |
241 | | - } else { |
242 | | - nvcuvidAvailable_ = true; |
243 | | - } |
| 232 | + nvcuvidAvailable_ = loadNVCUVIDLibrary(); |
244 | 233 | } |
245 | 234 |
|
246 | 235 | BetaCudaDeviceInterface::~BetaCudaDeviceInterface() { |
@@ -719,15 +708,16 @@ void BetaCudaDeviceInterface::convertAVFrameToFrameOutput( |
719 | 708 | } |
720 | 709 |
|
721 | 710 | std::string BetaCudaDeviceInterface::getDetails() { |
| 711 | + std::string details = "Beta CUDA Device Interface."; |
722 | 712 | if (cpuFallback_) { |
| 713 | + details += " Using CPU fallback."; |
723 | 714 | if (!nvcuvidAvailable_) { |
724 | | - return "Beta CUDA Device Interface. Using CPU fallback (NVCUVID not available - install NVIDIA drivers with NVDEC support)."; |
725 | | - } else { |
726 | | - return "Beta CUDA Device Interface. Using CPU fallback."; |
| 715 | + details += " NVCUVID not available!"; |
727 | 716 | } |
728 | 717 | } else { |
729 | | - return "Beta CUDA Device Interface. Using NVDEC."; |
| 718 | + details += " Using NVDEC."; |
730 | 719 | } |
| 720 | + return details; |
731 | 721 | } |
732 | 722 |
|
733 | 723 | } // namespace facebook::torchcodec |
0 commit comments