Download OpenAPI specification:Download
Layouter is our development that manages the layout of streams and agents across streamers. This API describes how Layouter interacts with Central and based on which data it performs streams and agents layouts.
Permanent download link to JSON schema file.
Layout of stream or agent describes on which nodes the stream or agent is being captured:
layout.ingest field contains hostname of streamer where the stream is being captured.
layout.inference field contains the hostname of the Vision Inference node on which stream analytics is running.
layout.dvr_backups field contains an array of streamer hostnames that will contain a copy of the DVR archive.
Similarly with stream, the agent's layout.ingest field contains hostname of streamer where the stream is being captured.
Layouter runs with interval specified by layouter_sleeping_interval between its iterations, ensuring that the layout is up-to-date with the latest cluster state.
The state of the cluster is described by the following entities:
Streamer
Configuration of the streamer including its stats.
If there stats are null, the streamer is considered offline.
Depending on the streamer's role, it will be used to set
layout.ingest
or layout.inference
fields for the stream. Streamers with role Identification
are ignored by layouter.
Layouter operates with labels
and channel_limit
fields of streamer.
Stream
If no streamer is online, the layout of the streams will not be changed. Based on the current layout for a particular stream, the layouter decides if the layout needs to be updated.
Also layouter sends long-polling 'streams_list' requests to fetch streams with empty layout.ingest
and updated_at
greater than the maximum updated_at
among the same request's streams. Layouter processes these streams immediately.
Agent
Agent without its corresponding stream. This means that there is no stream that uses the agent as input.
Layouter fetches data using streams_list, agents_list and streamers_list operations and processes the current state of the cluster from Central. After processing, if necessary, it updates the layout of the streams and agents using batch_update_streams_layouts and batch_update_agents_layouts operations if necessary.
The situation of overloading the streamer is considered first.
That is when the number of streams with ingest equal to hostname exceeds channel_limit of this streamer.
If such a situation is detected, the layout will be changed for N = channel_limit - online_streams
streams of this streamer.
After that, the need to change the layout for streams that were not processed in the first step is checked. Thus, if a stream already has layout.ingest set, it will not be redistributed.
Agents are processed in a similar way. If layout.ingest is set and this streamer is online, the agent will not be redistributed.
This API method is used by layouter to fetch all streams in the cluster.
Layouter will use this method along with the query parameters limit
and cursor
.
It is therefore necessary that the system supports them.
{- "estimated_count": 5,
- "next": "JTI0cG9zaXRpb25fZ3Q9MA==",
- "prev": "JTI0cG9zaXRpb25fbHQ9MSYlMjRyZXZlcnNlZD10cnVl",
- "timing": { },
- "streams": [
- {
- "name": "string",
- "disabled": false,
- "inputs": [
- {
- "url": "fake://fake",
- "via": "string"
}
], - "transcoder": {
- "global": {
- "target": "uhdtv",
- "hw": "cpu",
- "deviceid": "auto",
- "external": true,
- "keep_ts": true,
- "fps": 24,
- "gop": 150,
- "resize_mode": "vic",
- "burn": {
- "text": {
- "text": "string",
- "x": 0,
- "y": 0,
- "position": "tl",
- "font": {
- "file": "/usr/share/fonts/truetype/freefont/FONT_NAME.ttf",
- "size": 24,
- "color": "string",
- "alpha": 1
}, - "box": {
- "borderw": 10,
- "color": "string",
- "alpha": 0
}
}, - "time": {
- "text": "string",
- "x": 0,
- "y": 0,
- "position": "tl",
- "font": {
- "file": "/usr/share/fonts/truetype/freefont/FONT_NAME.ttf",
- "size": 24,
- "color": "string",
- "alpha": 1
}, - "box": {
- "borderw": 10,
- "color": "string",
- "alpha": 0
}
}
}
}, - "decoder": {
- "pix_fmt": "yuv420p",
- "deinterlace": true,
- "deinterlace_rate": "frame",
- "crop": {
- "left": 0,
- "top": 0,
- "width": 0,
- "height": 0
}, - "drop_frame_interval": 3,
- "no_dpb": false,
- "streaming_frame": false
}, - "audio": {
- "codec": "opus",
- "bitrate": 64000,
- "avol": "-6dB",
- "split_channels": false,
- "sample_rate": 48000,
- "channels": 2
}, - "video": [ ],
- "tracks": [ ]
}, - "dvr": {
- "redundancy_factor": 1,
- "expiration": 0
}, - "labels": {
- "key1": "value1",
- "key2": "value2"
}, - "vision": {
- "alg": "faces",
- "areas": "string"
}, - "stats": {
- "last_running_at": 1737975543123,
- "dvr_info": {
- "from": 1641045644,
- "depth": 259200,
- "ranges": [
- {
- "from": 1525186456,
- "duration": 28800,
- "opened_at": 1000000000000,
- "closed_at": 1000000000000
}
], - "bytes": 129600000000,
- "disk_size": 1099511627776,
- "duration": 172800
}
}, - "updated_at": 1637098611000,
- "layout": {
- "change_reason": "stream_misses_node_required_labels",
- "dvr_backups": [
- "string"
], - "inference": "string",
- "failover_from": "string",
- "node_layout_decisions": [
- {
- "role": "streamer"
}
], - "ingest": "string",
- "created_at": 1637094994000,
- "originator": "layouter"
}, - "claims": {
- "bitrate": 2543
}
}
]
}
Batch update layouts of streams. This operation does everything or nothing. If at least one stream has an invalid configuration or can't be processed, the request will fail.
List of new layouts for streams
Array of objects (central_stream_layout_list_item) List of streams layouts |
{- "layouts": [
- {
- "name": "string",
- "change_reason": "stream_misses_node_required_labels",
- "dvr_backups": [
- "string"
], - "inference": "string",
- "failover_from": "string",
- "node_layout_decisions": [
- {
- "role": "streamer"
}
], - "ingest": "string"
}
]
}
{- "errors": [
- {
- "id": "string",
- "status": "string",
- "code": "string",
- "title": "string",
- "source": {
- "pointer": "string",
- "parameter": "string"
}, - "meta": {
- "property1": "string",
- "property2": "string"
}
}
], - "error": "string"
}
This API method is used by layouter to fetch all streamers of the cluster
"inference" (string) or "streamer" (string) Examples: role=inference role=streamer Role of the streamer |
{- "estimated_count": 5,
- "next": "JTI0cG9zaXRpb25fZ3Q9MA==",
- "prev": "JTI0cG9zaXRpb25fbHQ9MSYlMjRyZXZlcnNlZD10cnVl",
- "timing": { },
- "streamers": [
- {
- "role": "streamer",
- "hostname": "peer.example.com",
- "stats": {
- "streamer_status": "running",
- "config_external_status": {
- "status": "loaded",
- "reason": "validation_error",
- "while": "refresh",
- "code": 0,
- "error": "invalid_authorization",
- "path": [
- "streams",
- 0,
- "inputs",
- 0,
- "url",
- "input_url"
], - "detail": "string"
}, - "transcoder": true,
- "partitions": [
- {
- "path": "_var_lib_docker_overlay2_3684778579db0a4d418fdc1a8a6953b680ab92d179a7d6f9506710d073095e36_merged",
- "device": "sda1",
- "total_mb": 45423,
- "usage": 30,
- "io_util": 42
}
], - "transcoder_devices": [
- {
- "type": "cpu",
- "id": "auto",
- "name": "string",
- "can_logo": true,
- "can_interlace": true,
- "can_internal": true,
- "memTotal": 0,
- "memFree": 0,
- "memUsed": 0,
- "reconfig_support": "full",
- "gpu_temp": 0,
- "gpu_enc": 0,
- "gpu_dec": 0,
- "gpu_sm": 0
}
], - "total_streams": 45,
- "online_streams": 27,
- "error": "string"
}, - "channel_limit": 5,
- "cluster_key": "xS6i6Q3DCc5nEvnu",
- "dvrs": [
- {
- "name": "string",
- "root": "string",
- "stats": {
- "errors": {
- "read_errors": 0,
- "write_errors": 0,
- "delete_errors": 0,
- "collapsed_write_count": 0,
- "drop_write_count": 0
}, - "size": 0,
- "used": 0,
- "usage": 0
}, - "expiration": 0
}
], - "labels": {
- "key1": "value1",
- "key2": "value2"
}
}
]
}
This API method is used by layouter to fetch agents without their corresponding stream.
By agent without its corresponding stream is meant that no stream has the agent in its inputs field.
Layouter will use this method along with the query parameters limit
, cursor
and stream_is
.
It is therefore necessary that the system supports them.
{- "estimated_count": 5,
- "next": "JTI0cG9zaXRpb25fZ3Q9MA==",
- "prev": "JTI0cG9zaXRpb25fbHQ9MSYlMjRyZXZlcnNlZD10cnVl",
- "timing": { },
- "agents": [
- {
- "id": "1234567",
- "layout": {
- "ingest": "string",
- "created_at": 1637094994000,
- "originator": "layouter"
}
}
]
}
Batch update layouts of agents. This operation does everything or nothing. Only agents without streams will be processed, other ones would be ignored. If at least one agent has an invalid configuration or can't be processed, the request will fail.
List of new layouts for agents
Array of objects (central_agent_layout_list_item) List of agent layouts |
{- "layouts": [
- {
- "id": "string",
- "ingest": "string"
}
]
}
{- "errors": [
- {
- "id": "string",
- "status": "string",
- "code": "string",
- "title": "string",
- "source": {
- "pointer": "string",
- "parameter": "string"
}, - "meta": {
- "property1": "string",
- "property2": "string"
}
}
], - "error": "string"
}