-
Notifications
You must be signed in to change notification settings - Fork 64
Open
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
#if
on the FFmpeg version directly inside the implementation to dispatch to different functions. - Outside of the function, we
#if
on 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
FFMPEGCommon
that internally does a#if
on FFmpeg version, callingav_hwdevice_ctx_create()
in the appropriate way for each version. - Remove
getFFMPEGContextFromExistingCudaContext()
,getFFMPEGContextFromNewCudaContext()
and the#if
surrounding 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
#if
out of decoding code as much as possible. We want to abstract it into a function inFFMPEGCommon
that decoding code can call. - The minimum code necessary should be inside the FFmpeg version
#if
s.
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.