DriveWorks SDK Reference
3.5.78 Release
For Test and Development only

Image Streamer Multi-Thread
SW Release Applicability: This tutorial is applicable to modules in both NVIDIA DriveWorks and NVIDIA DRIVE Software releases.

In addition to using the ImageStreamer module in a single thread, you can also use it across multiple threads.

This workflow is similar to the single thread case since the same APIs are thread safe.
For details on how to stream an image from CPU to CUDA memory, please refer to
Image Streamer. All other details are left out of this tutorial for simplicity.

Initializing the ImageStreamer Module in Thread A

In the following example, the ImageStreamer is initialized in Thread A before it is used to send images:

// Thread A:
// streamer from CPU to CUDA
dwImageStreamer_initialize(streamerCPU2CUDA, &cpuProp, DW_IMAGE_CUDA, dwContext);
// CODE: Get an image to stream
dwImageStreamer_producerSend(imgCPU, streamerCPU2CUDA);
dwImageStreamer_producerReturn(nullptr, TIMEOUT, streamerCPU2CUDA);

Retrieving the Output from Thread B

After sending the images from Thread A, retrieve the output from Thread B:

// Thread B:
dwImageStreamer_consumerReceive(&imageCuda, TIMEOUT, streamerCPU2CUDA);
// CODE: Use the streamed image
dwImageStreamer_consumerReturn(&imageCuda, streamerCPU2CUDA);

Releasing the Handle


To see a full demonstration of this workflow, please refer to Multi-Thread Image Streamer Sample.