Releasing Packets

When it finishes issuing instructions to read from a packet, the consumer must return the packet to the producer for reuse. Packets may be returned in any order, regardless of the order they were acquired.

Before sending the frame back, the consumer provides synchronization to indicate when its operations complete. For synchronous elements, the consumer must perform a CPU wait for reading to finish before inserting the packet in the stream. For asynchronous elements, it must instruct the APIs it used to generate fences, which trigger when rendering finishes. The application sets the fences for the elements of the packet that is going to be released by calling NvSciStreamBlockPacketFenceSet().

The application can now insert the packet back into the stream along with the fences by calling NvSciStreamConsumerPacketRelease() with the handle of the packet. The stream returns the packet to the producer, performing any necessary copy or translations steps to make the fences accessible. When a packet is released, the application must not attempt to read its contents until a new payload using the packet arrives.

NvSciError
NvSciStreamConsumerPacketRelease(
    NvSciStreamBlock const      consumer,
    NvSciStreamPacket const     handle,
    NvSciSyncFence const *const postfences
)