as CUvideoctxlock still appears in the latest SDK, I would finally like to understand if/how to use it. The cuviddec.h file states that cudaVideoCreate_PreferCUDA “requires valid vidLock object for multi-threading”. The header file also states “when using a floating context, all cuda calls should only be made within a cuvidCtxLock/cuvidCtxUnlock section”. To solve my ctxlock nightmare, my questions are:
What do you mean by multi-threading? Are you talking about calling the methods of one decoder from different threads or creating multiple decoders each running a separate thread?
The NVDEC samples create one lock per decoder. This way, running multiple decoders, no synchronization will occur at all. Is this correct?
As noted above, you recommend to only do CUDA calls when the lock is applied. In your samples, you do some CUDA calls and never apply the lock. What am I missing?
When using a floating context, we are advised to use the lock for all CUDA calls. But why? Using just one CUDA context means that all CUDA calls will be enqeued (i.e. serialized) with respect to the default CUDA stream of the context. So why should we bother locking the code when we do not make use of cuda streams?
Thank you very much.