Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/cuda_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ jobs:
python_version: ["3.9"]
# TODO: Add more cuda versions.
cuda_arch_version: ["12.4"]
ffmpeg_version: ["origin/release/6.1"]
# TODO: Get ffmpeg 4 to work. Currently fails to build with nvcc.
ffmpeg_version: ["origin/release/5.1", "origin/release/6.1", "origin/release/7.1"]
fail-fast: false
uses: pytorch/test-infra/.github/workflows/linux_job.yml@main
with:
Expand Down
6 changes: 6 additions & 0 deletions src/torchcodec/decoders/_core/CudaDevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ AVBufferRef* getFromCache(const torch::Device& device) {
return nullptr;
}

#if LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(58, 26, 100)

AVBufferRef* getFFMPEGContextFromExistingCudaContext(
const torch::Device& device,
torch::DeviceIndex nonNegativeDeviceIndex,
Expand Down Expand Up @@ -105,6 +107,8 @@ AVBufferRef* getFFMPEGContextFromExistingCudaContext(
return hw_device_ctx;
}

#else

AVBufferRef* getFFMPEGContextFromNewCudaContext(
const torch::Device& device,
torch::DeviceIndex nonNegativeDeviceIndex,
Expand All @@ -122,6 +126,8 @@ AVBufferRef* getFFMPEGContextFromNewCudaContext(
return hw_device_ctx;
}

#endif

AVBufferRef* getCudaContext(const torch::Device& device) {
enum AVHWDeviceType type = av_hwdevice_find_type_by_name("cuda");
TORCH_CHECK(type != AV_HWDEVICE_TYPE_NONE, "Failed to find cuda device");
Expand Down
Loading