-
Notifications
You must be signed in to change notification settings - Fork 67
Closed
Labels
refactorImproves code itself, but does not fix a bug or add new functionality.Improves code itself, but does not fix a bug or add new functionality.
Description
The implementation of CudaDeviceInterface::getCudaContext() is unnecessarily confusing:
- There is a
#ifon the FFmpeg version directly inside the implementation to dispatch to different functions. - Outside of the function, we
#ifon the FFmpeg version to define two different functions. - The only difference between both functions is one parameter to
av_hwdevice_ctx_create(), but all of the surrounding code is the same.
What we should do:
- Create a single function in
FFMPEGCommonthat internally does a#ifon FFmpeg version, callingav_hwdevice_ctx_create()in the appropriate way for each version. - Remove
getFFMPEGContextFromExistingCudaContext(),getFFMPEGContextFromNewCudaContext()and the#ifsurrounding them. - Call the function defined in 1 directly in
getCudaContext()with the logic removed in 2 directly ingetCudaContext().
There's two main principles we want to apply here:
- Keep FFmpeg version
#ifout of decoding code as much as possible. We want to abstract it into a function inFFMPEGCommonthat decoding code can call. - The minimum code necessary should be inside the FFmpeg version
#ifs.
NicolasHug
Metadata
Metadata
Assignees
Labels
refactorImproves code itself, but does not fix a bug or add new functionality.Improves code itself, but does not fix a bug or add new functionality.