NvSciStream Sample Application

The NvSciStream sample application demonstrates how to use the NvSciStream API to build a simple stream. This sample application streams packets from NvMedia producer to CUDA consumer.
Prerequisites
The sample application streams packets between a producer process and consumer process via IPC channels. NvSciStream does impose some minimum requirements on the IPC channels to be able to transmit the required messages. The NvSciIpc channel must be created with at least 24K (24576) bytes per frame.
The NvSciIpc channels are configured via the device tree (DT) on QNX and via a plain text file, /etc/nvsciipc.cfg, on Linux. For more information on NvSciIpc configuration data, see the NvSciIpc Configuration Data chapter. The recommended NvSciIpc channel for this sample application is:
INTER_PROCESS nvscistream_0 nvscistream_1 16 24576

Building the NvSciStream Sample Application

The NvSciStream sample includes source code and a Makefile.
To build a sample application
1. On the host system, navigate to the sample application directory:
On Linux:
cd <top>/drive-t186ref-linux/samples/nvsci/nvscistream/
On QNX:
cd <top>/drive-t186ref-qnx/samples/nvsci/nvscistream/
Note:
The NvSciStream sample application is not available in the Safety build.
2. Build the sample application:
make clean
make
The pre-built sample application nvscistream_sample is in the same directory.

Running the NvSciStream Sample Application

The NvSciStream Sample application supports these command line switches:
Option
Meaning
Default
-p <ipc_endpoint1_name>
Specifies IPC channel name of producer process
-c <ipc_endpoint2_name>
Specifies IPC channel name of consumer process
-q <0/1>
Specifies streaming type in the consumer process. Accepted values are 0 (Mailbox), and 1 (FIFO).
0
To run the NvSciStream sample application
1. On Linux, navigate to the sample application directory on the target system:
cd /home/nvidia/drive-t186ref-linux/samples/nvsci/nvscistream/
On QNX, copy the sample application to the target filesystem:
cp <top>/drive-t186ref-qnx/samples/nvsci/nvscistream/nvscistream_sample
<top>/drive-t186ref-qnx/targetfs/samples
2. Run the sample application with the IPC channel <nvscistream_0, nvscistream_1>:
Producer process:
./nvscistream_sample -p nvscistream_0 &
Consumer process:
./nvscistream_sample -c nvscistream_1 -q 1
Note:
On Linux:
1. The nvscistream_sample application must be run as root user (with sudo);
2. If the nvscistream_sample application fails to open IPC channel, clean up NvSciIpc resources may help.
sudo rm -rf /dev/mqueue/*
sudo rm -rf /dev/shm/*