Receive decoded frame after first call to parser (NVDEC)

Hi. My goal is to receive the first decoded frame as soon as possible. What I observe at the API config level is this,we have two places where we setup number decode surfaces:

CUVIDPARSERPARAMS::ulMaxNumDecodeSurfaces

CUVIDDECODECREATEINFO::ulNumDecodeSurfaces

By default,at least in the NVIDIA decode sample the number for parser = 1 and for decoder = 20 .And what I see is that it takes the parser 20 calls to cause decoder spit a frame. So that means,if I set the CUVIDDECODECREATEINFO::ulNumDecodeSurfaces = 1,then I will get the first frame after the first call to the parser? If that’s true,I have another question. In my app,I perform decoding in separate thread.I cache the decoded CUVIDPARSERDISPINFO packets for further processing in another thread where I perform YUV to RGB conversion. If I set CUVIDDECODECREATEINFO::ulNumDecodeSurfaces = 1,will I still be able to cache the received frames? Or in this case I must decode -> process in a sync manner?
Thanks.

The old examples had parity for both ulMaxNumDecodeSurfaces settings iirc. The parser’s ulMaxNumDecodeSurfaces will be used to map the number of slots in FrameQueue to NVDEC memory on the card. [I’m going off the old examples/SDK from memory] I believe this is how CurrPicIdx is determined.

CUVID ulMaxNumDecodeSurfaces are the number of those memory slots available for decoding. This must be large enough to actually decode the stream. (So either the size of the GOP or the number of bframes + 1 or similar). I believe I used 2 for an iframe only stream.

NVDEC will wait till the next forward reference frame before it dumps a frame out. So in an I-Frame only stream it will wait till the second IFrame is sent before the first one is actually decoded and available. I don’t believe there’s a way to get a 0-frame delay.