Acquiring Packets

Just as the producer block receives a NvSciStreamEventType_PacketReady event when a packet is available for reuse, the consumer block receives one when a packet containing new data arrives. If multiple packets are available, the consumer receives separate events for each of them.

After a packet becomes available, a consumer application may call NvSciStreamConsumerPacketAcquire() to obtain it. The cookie field is filled in with the cookie that the consumer assigned to the packet. With the packet handle, the consumer application calls NvSciStreamBlockPacketFenceGet() to obtain the prefences for the packet elements. The prefence field points to the location that will be filled with the fence value indicating when the producer indexed by queryBlockIndex (always 0 for one producer) is no longer using the data in the packet element buffer.

Consumer packets are always received in the order that the producer sends them, but depending on the stream settings (such as if a mailbox queue is used) some packets may be skipped. The consumer may acquire and hold multiple packets at once.

NvSciError
NvSciStreamConsumerPacketAcquire(
    NvSciStreamBlock const   consumer,
    NvSciStreamCookie *const cookie,
    NvSciSyncFence *const    prefences
)