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. If the producer set the synchronousOnly flag during setup of the synchronization objects, then the consumer must perform a CPU wait for reading to finish before inserting the packet in the stream. Otherwise, it must instruct the APIs it used to generate fences, which triggers when rendering finishes. It fills in an array of fences, one for each of the sync objects the consumer created. If some of the sync objects aren't relevant for how a given packet was used, the application can clear their entries in the fence array to empty but must not leave the array contents undefined.

The application can now insert the packet back into the stream along with the fences by calling NvSciStreamConsumerPacketRelease() with the handle of the packet and the array of post-fences. The stream returns the packet to the producer, performing any necessary copy or translations steps along the way to make the fences accessible. Once 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
)