The programmer guide for NVDEC suggests a couple of funny things regarding threading, but without further explanation. The examples on the other hand are extremely conservative.
A couple of requests for clarification:
Is it still safe to call cuvidMapVideoFrame outside of CUVIDPARSERPARAMS::pfnDisplayPicture callback?
In the PDF code doing this is quoted, but the bundled examples have all been changed to exclusively use cuvidMapVideoFrame synchronously within the scope of pfnDisplayPicture. There is also no documentation on for how long a specific CUVIDPARSERDISPINFO::picture_index is safe to reference.
Is cuvidUnmapVideoFrame synchronizing on CUVIDPROCPARAMS::output_stream?
In the examples, a full CPU sync point with cuStreamSynchronize is introduced prior to cuvidUnmapVideoFrame. Is this sync point necessary, or is it legal to call cuvidUnmapVideoFrame while work is enqueued on CUVIDPROCPARAMS::output_stream?
E.g. consider the sequence “cuMemcpy2DAsync” from mapped frame -> “cuEventRecord” -> “cuvidUnmapVideoFrame” -> switch to consumer thread -> “cuEventSynchronize”