NvMedia SIPL API, correct time to release the buffer reference

Please provide the following info (check/uncheck the boxes after clicking “+ Create Topic”):
Software Version
DRIVE OS Linux 5.2.0
DRIVE OS Linux 5.2.0 and DriveWorks 3.5
NVIDIA DRIVE™ Software 10.0 (Linux)
NVIDIA DRIVE™ Software 9.0 (Linux)
other DRIVE OS version

Target Operating System

Hardware Platform
NVIDIA DRIVE™ AGX Xavier DevKit (E3550)
NVIDIA DRIVE™ AGX Pegasus DevKit (E3550)

SDK Manager Version

Host Machine Version
native Ubuntu 18.04

When using the NvMedia SIPL API, inside the callback function implemented by my app and registered with SIPL, I’m feeding the buffer into a queue and adding a ref count via


In another consumer thread, I’m popping from this queue and using the GetImage() API to feed the image pointer obtained from the buffer to an encoder.

My question is, what is the correct instance to release the buffer? Is it right after feeding the NvMediaImage* to the encoder, or do I need to wait for the encoder to be done to release the buffer?


Hi @goksani,

Please refer to nvsipl::INvSIPLClient::INvMCallback::OnFrameAvailable(). The consumer must release it.

The consumer must use INvSIPLBuffer::AddRef and INvSIPLBuffer::Release on the buffer if it intends to consume the buffer asynchronously in a different thread.

Yes I am aware of the fact that consumer must release it.

What I’m asking is, if the consumer is the encoder, should it be release right after feeding it to the encoder, or after the encoder is done. This would depend on inner workings of the encoder, based on if its copying the frame and how its reading the memory, etc. which we as users do not have access to.

What encoder are you referring to? NvMedia?
May I know what APIs you are using?

I’m using NvMediaIEPFeedFrame() and NvMediaIJPEFeedFrame()



There are internal buffers for the APIs so you should be able to release them right away.
Below is from NvMediaIEPFeedFrame().

Thank you for pointing this out. However, the buffering being explained above is for the output of the encoder. The more relevant parameter maxInputBuffering, which is the maximum number of allowed frames in the encode pipeline, is said to be deprecated.

After double-checking with our team, applications need to wait for the encoding to complete (by calling NvMediaIEPBitsAvailable()) before releasing the encoder input buffer.

Thank you for the correction.