support forwarding streams natively (#5558)

It is now possible to define forward destinations for each path configuration. For each destination, the server will create a client that will forward the stream to the intended destination. Supported protocols are RTSP, RTMP, SRT. API and metrics have also been improved to allow monitoring the new forwarding system.

---------

Co-authored-by: aler9 <46489434+aler9@users.noreply.github.com>
This commit is contained in:
Aniol Pagès
2026-08-04 21:57:15 +02:00
committed by GitHub
co-authored by aler9
parent f36c41d90a
commit 98ab3009ea
44 changed files with 2957 additions and 54 deletions
+161
View File
@@ -141,6 +141,22 @@ components:
- webRTCSource
- moqSession
ForwardDestProtocol:
type: string
enum:
- rtmp
- rtmps
- rtsp
- rtsps
- srt
ForwardDestState:
type: string
enum:
- idle
- forwarding
- error
PathTrackCodec:
type: string
enum:
@@ -915,6 +931,11 @@ components:
type: string
nullable: true
deprecated: true
forward:
type: array
description: Forward
items:
$ref: "#/components/schemas/PathConfForwardDest"
maxReaders:
type: integer
format: int64
@@ -1235,6 +1256,12 @@ components:
type: integer
format: int64
PathConfForwardDest:
type: object
properties:
dest:
type: string
PathList:
type: object
properties:
@@ -1382,6 +1409,43 @@ components:
type: integer
format: int64
ForwardDest:
type: object
properties:
conf:
$ref: "#/components/schemas/PathConfForwardDest"
created:
type: string
id:
type: string
format: uuid
lastError:
type: string
outboundBytes:
type: integer
format: uint64
pos:
type: integer
format: int64
protocol:
$ref: "#/components/schemas/ForwardDestProtocol"
state:
$ref: "#/components/schemas/ForwardDestState"
ForwardDestList:
type: object
properties:
itemCount:
type: integer
format: int64
items:
type: array
items:
$ref: "#/components/schemas/ForwardDest"
pageCount:
type: integer
format: int64
Recording:
type: object
properties:
@@ -2667,6 +2731,103 @@ paths:
schema:
$ref: "#/components/schemas/Error"
/v3/paths/forward/list:
get:
operationId: pathsForwardList
tags: [Paths]
summary: returns all forward destinations of a path.
description: ""
parameters:
- name: path
in: query
required: true
description: name of the path.
schema:
type: string
- name: page
in: query
description: page number.
schema:
type: integer
default: 0
- name: itemsPerPage
in: query
description: items per page.
schema:
type: integer
default: 100
responses:
"200":
description: the request was successful.
content:
application/json:
schema:
$ref: "#/components/schemas/ForwardDestList"
"400":
description: invalid request.
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
"404":
description: path not found.
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
"500":
description: server error.
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
/v3/paths/forward/get:
get:
operationId: pathsForwardGet
tags: [Paths]
summary: returns a forward destination.
description: ""
parameters:
- name: id
in: query
required: true
description: ID of the forward destination.
schema:
type: string
format: uuid
- name: path
in: query
required: true
description: name of the path.
schema:
type: string
responses:
"200":
description: the request was successful.
content:
application/json:
schema:
$ref: "#/components/schemas/ForwardDest"
"400":
description: invalid request.
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
"404":
description: path or forward destination not found.
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
"500":
description: server error.
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
/v3/rtspconns/list:
get:
operationId: rtspConnsList