Streaming
During streaming, the applications must validate the correctness of the payload before accessing the buffer data.
Frame Production
After the producer application receives a new packet, it must validate that the received cookie is one of those provided to the NvSciStream during packet creation and perform the following validation steps:
- Clear the magic number in the producer's CRC element, in case that the consumer tries to access this packet.
- For each consumer:
- Verify that the magic number in the consumer’s CRC buffer matches the user-defined runtime magic number
- If the magic number matches, but CRC value is
0
, the packet may be returned from the mailbox queue. You can skip validating the CRC value. Otherwise, reset the input CRC value to0
and pass it toNvSciStreamBlockPacketFenceGetWithCrc()
when querying the pre-fences from the consumer. Verify that it is the same as the CRC value in the consumer’s CRC buffer. You can skip validating the CRC values if the packet is in use first and not released from consumers - Clear the data in the consumer’s CRC element and fill in the runtime magic number
- Write the data into the data element once validation is complete
- Before presenting the packet to the consumers, the producer application must write the
validation data into producer’s CRC element:
- Reset the input CRC to
0
and pass it toNvSciStreamBlockPacketFenceSetWithCrc()
when setting all the post-fences to get the updated fence CRC value - Write the runtime magic number, fence CRC, frame count, and current timestamp to the producer’s CRC element.
- Reset the input CRC to
Frame Consumption
After the consumer application acquires a new packet, it must validate that the received cookie is one of those provided to the NvSciStream during packet creation and perform following validation steps:
- Clear the magic number in its consumer’s CRC element in case the producer tries to access this packet
- Reset the input CRC value to
0
and pass it toNvSciStreamBlockPacketFenceGetWithCrc()
when querying all of the pre-fences from the producer - Perform the following validation steps before accessing buffer data:
- Verify that the magic number in the producer’s CRC buffer matches the user-defined runtime magic number
- Reset the input CRC value to
0
and pass it toNvSciStreamBlockPacketFenceGetWithCrc()
when querying all the pre-fences from the producer. Verify that it is the same value as the CRC value in the producer’s CRC buffer - The frame count should be incremented. With FIFO queue, it should be incremented by
1
for no packet drops. - With a mailbox queue, if the application only wants to process the latest data, it can check the timestamp of when the producer sends the data to decide if it is acceptable.
- Read the data from the data element once validation is complete.
- Before releasing the packet back to the producer for reuse, the consumer application
must write the validation data into producer’s CRC element:
- Reset the input CRC to
0
and pass it toNvSciStreamBlockPacketFenceSetWithCrc()
when setting all the post-fences to get the updated fence CRC value. - Write the runtime magic number and fence CRC into its consumer’s CRC element.
- Reset the input CRC to