NVIDIA Tegra
NVIDIA DRIVE OS 5.1 Linux

Developer Guide
5.1.0.2 Release


 
Stream-Server
 
Stream-Server Architecture
Location of Stream-Server and Plugins
Running Stream-Server
Configure Stream-Server
JSON File Based Configuration
Command-Line Configuration
This section describes stream-server, a plugin based application that can be used in place of any eglstream consumer application with rich configuration capabilities. This application runs on Linux and QNX target NVIDIA® Tegra® devices.
Stream-Server Architecture
Stream-Server can be run in any VM. Plugins are used to get an eglstream handle and attach a consumer or producer. Steam-Server is configured to run with different sets of plugins. This configuration is done by either command line arguments or by a JSON file.
There are two types of plugins:
1. Input Plugin - This type of plugin is used to connect to an eglstream producer app. Two important plugins in this category are CrossProcInput and CrossPartInput, which are used to get cross process and cross partition eglstream from the external producer app.
2. Output Plugin -This type of plugin is used to attach a consumer to eglstream coming from external application via Input Plugin. Based on functionality needed, there are two broad categories of output plugins. The first category can be called display based output plugins, which displays stream frames on the monitor and second category can be called forward output plugins, which does not display anything but serves as the mediator for an external eglstream consumer app.
The following image shows Stream-Server running with different external Producers and Consumers.
Location of Stream-Server and Plugins
Stream-Server binary is kept under the ~nvidia*/SS/ directory and all available plugins are kept under the /usr/local/lib directory.
Running Stream-Server
Go in the directory where Stream-Server binary is kept and type the command below to get the help screen:
$./stream-server -h
Configure Stream-Server
Configuration may be controlled using one of two methods: JSON file or command line arguments. They are mutually exclusive.
JSON File Based Configuration
This is the more versatile means of configuring Stream-Server. Any number of Inputs and Outputs may be created and connected together for advanced configuration.
A JSON formatted file must be saved to disk and referenced at startup using the -c, --config option. The JSON file is broken into sections, one per component to initialize.
Here is a sample configuration test.json file:
{
"Inputs": [{
"name": "CrossProcInput1",
"type": "CrossProcInput",
"output": "EGLOutputOutput1",
"socket": "/tmp/ss/socket/ss1"
},{
"name": "CrossPartInput1",
"type": "CrossPartInput",
"output": "EGLOutputOutput2",
"port": "8889"
}],
"Outputs": [{
"name": "EGLOutputOutput1",
"type": "EGLOutputOutput",
"windowSize": "1920X1080",
"dispNo": "1",
"layerNo": "0"
},{
"name": "EGLOutputOutput2",
"type": "EGLOutputOutput",
"windowSize": "1080X720",
"dispNo": "1",
"layerNo": "1"
}]
}
There are two Input and two Output plugins that are mentioned in the above test.json configuration file. Between the two Input plugins, one is of type CrossProcInput and the second is of type CrossPartInput, having names CrossProcInput1 and CrossPartInput1 respectively. In case of Output plugins, both plugins have same type EGLOutputOutput with names EGLOutputOutput1 and EGLOutputOutput2.
For the Input plugin, there is a parameter called output that tells the Stream-Server to form mapping between Input and Output plugins at run time. So CrossProcInput1 and CrossPartInput1 connects to EGLOutputOutput1 and EGLOutputOutput2 respectively at runtime.
CrossprocInput1 plugin will use path /tmp/ss/socket/ to create a socket name ss1 to listen for the incoming cross process eglstream producer client’s connect request. In the same manner, CrossPartInput1 uses port number 8889 to bind a socket and uses this socket to listen for the incoming cross partition eglstream producer client’s connect request.
The following are the set of commands to run.
1. Create socket path on VM0:
$ mkdir -p /tmp/ss/socket/
2. Run Stream-Server with this configuration file on VM0:
$./stream-server -c test.json
3. Run first producer on VM0:
$./gears -eglstreamsocket /tmp/ss/socket/ss1 -1
4. Run second producer on VM1, assuming the IP of VM0 as seen by VM1 is 12.1:
$./gears -proctype producer -ip 12.1 -port 8889 -1
The first gears are now connected to CrossProcInput1, which in turn is connected to EGLOutputOutput1. The parameters windowsize, dispNo, and layerNo of EGLOutputOutput1 determine the display number and overlay layer number of connected displays on which window appears of dimension windowsize.
So, the first gears instance appears in a window of dimension 1920 x 1080 on 0th layer of 0th display. Likewise, the second gears instance appears in a window of dimensions 1080 x 720 on 1st layer of 0th display.
There are many more parameters for different kinds of plugins, which are explained in the table given below.
Plugin
Parameter
Default Allowed
Description
Example
For All Plugins
name
No
Name of the plugin.
"name": "EGLOutputOutput1"
type
No
Type of the plugin.
"type": "EGLOutputOutput"
For All Input Plugins
output
No
Name of the output plugin to connect with this input plugin.
"output": "EGLOutputOutput1"
For All Output Plugins
windowSize
Yes
Size of window to appear on the display or to send out through EGLStream.
"windowSize": "1920X1080"
CrossPartInput
port
No
Port number to listen for incoming EGLStream producer.
{
"name": " CrossPartInput1",
"type": " CrossPartInput ",
"output": "ImageFileWriter",
"port": "8889"
}
Cross ProcInput
socketName
No
Socket path to listen for incoming EGLStream producer. This parth of socket must be created explicitly.
{
"name": " CrossProcInput1",
"type": " CrossProcInput ",
"output": "ImageFileWriter",
"socketName": "/tmp/ss/ss1"
}
TestInput
size
No
Size of frames to be generated.
{
"name": " TestInput1",
"type": " TestInput ",
"output": "ImageFileWriter",
"size": "600X400",
"frames": "10"
}
frames
No
Number of frames to be generated.
EGLOutputOutput
dispNo
Yes
Number of displays to show window.
{
"name": "EGLOutputOutput1",
"type": "EGLOutputOutput",
"windowSize": "1920X1080",
"dispNo": "1",
"layerNo": "0"
}
layerNo
Yes
Number of layers to show window.
ImageFileWriter
frames
No
Number of frames to dump of disk.
{
"name": "ImageFileWriter1",
"type": "ImageFileWriter",
"windowSize": "1920X1080",
"frames": "10",
"outpath": "/tmp/ss/out"
}
outpath
 
Path of directory to dump frames into. This path must be explicitly created prior to invoking Stream-Server.
ScreenOutput
dispNo
Yes
Specifies which display to show Screen window on.
{
"name": "ScreenOutput1",
"type": "ScreenOutput",
"windowSize": "1920X1080",
"dispNo": "1",
"layerNo": "0"
}
layerNo
Yes
Specifies which layer number to show Screen window on.
WaylandOutput
ivisurfaceid
Yes
ID number of an IVI surface when used with ivi-shell.
{
"name": "WaylandOutput1",
"type": "WaylandOutput",
"windowSize": "1920X1080",
"x": "100",
"y": "100"
}
X
Yes
X offset (ivi-shell only)
Y
Yes
Y offset (ivi-shell only)
CrossProcOutput
socketName
No
Path of socket on which cross process consumer client is listening.
{
"name": "CrossProcOutput1",
"type": "CrossProcOutput",
"windowSize": "1920X1080",
"socketName": "/tmp/ss/ss1"
}
CrossPartOutput
Ip
No
IP address VM where cross partition consumer client is running.
{
"name": "CrossPartOutput1",
"type": "CrossProcOutput",
"windowSize": "1920X1080",
"ip": "12.1",
"port": "8888"
}
Port
No
Port number on which cross partition consumer client is listening.
Command-Line Configuration
This is the more accessible, but limited means of configuring Stream-Server. It permits for configuration with precisely one Input and one Output.
Example usage is given below:
$ ./stream-server --in <input_type> <input options> --out <output_type> <output options>
 
input_type: TestInput, <additional Input type plugin names as queried from modules>
output_type: ImageFileWriter, <additional output types>
 
Examples:
./stream-server --in TestInput --size 200x200 --frames 10 --out ImageFileWriter --frames 10 --outputpath /tmp/stream-stream/out
 
./stream-server --in CrossPartInput -p 8888 --out EGLOutputOutput -dispNo 1 -layerNo 0