Receiving Buffers#
When a pool completes a new packet, any producer or consumers that pool serves is notified with a NvSciStreamEventType_PacketCreate
event.
Upon receiving this event, the endpoint calls NvSciStreamBlockPacketNewHandleGet()
to dequeue the handle of the new packet and then NvSciStreamBlockPacketBufferGet()
to get the buffers for the elements in the packet. After checking whether it can map in all the buffers for a given packet, the endpoint signals status back to the pool by NvSciStreamBlockPacketStatusSet()
. The status
parameter indicates if the application was successful in setting up the new packet. If so, the value is NvSciError_Success
. Otherwise, it can be any value the application chooses. NvSciStream does not interpret the value except to check for success, and then passes it back to the pool. If successful, the cookie parameter provides the endpoint cookie for the packet. Each endpoint can provide its own cookie for each packet, which is used in subsequent events.
The producer and consumers may assign the same cookies as the pool but are not required to do so.
NvSciError
NvSciStreamBlockPacketNewHandleGet(
NvSciStreamBlock const block,
NvSciStreamPacket* const handle
)
NvSciError
NvSciStreamBlockPacketBufferGet(
NvSciStreamBlock const block,
NvSciStreamPacket const handle,
uint32_t const elemIndex,
NvSciBufObj* const bufObj
)
NvSciError
NvSciStreamBlockPacketStatusSet(
NvSciStreamBlock const block,
NvSciStreamPacket const handle,
NvSciStreamCookie const cookie,
NvSciError const status
After the pool finishes exporting the packets, the endpoints receive an NvSciStreamEventType_PacketsComplete
event. They can complete setup related to packet resources and call the NvSciStreamBlockSetupStatusSet()
function with a value ofNvSciStreamSetup_PacketImport
to indicate they finished importing the packets.
If a pool deletes a packet, when the producer or consumer receives theNvSciStreamEventType_PacketDelete
event it can determine the identity of the deleted packet by calling NvSciStreamBlockPacketOldCookieGet()
, which retrieves the cookie of a packet pending deletion. The handle of the returned packet becomes invalid for subsequent function calls.
NvSciError
NvSciStreamBlockPacketOldCookieGet(
NvSciStreamBlock const block,
NvSciStreamCookie* const cookie
)