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. Again, none of the extra data fields in the event structure are
used for this type of event, and the packet info is retrieved by a subsequent call. 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 the consumer assigned to the packet. The prefences field points to an array with space for one fence for each of the sync objects provided by the producer. If the producer provides zero sync objects, this field can be NULL. The function fills in the array with the fences that indicate when the producer is finished writing data to the buffers.
Consumer packets are always received in the order that the producer sends them, but depending on the stream settings (e.g., 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
)