Describe the bug
When using SRT stream output to push to a lalmax SRT server (https://github.com/q191201771/lalmax, which uses the gosrt library), the SRT connection is established successfully but no data is transmitted (readBytes=0 on the server side). The egress then keeps reconnecting in an infinite loop.
The same SRT server works perfectly with ffmpeg, which strongly suggests a compatibility issue between GStreamer's srtsink element and the gosrt library's SRT implementation.
To Reproduce
- Start a lalmax SRT server on port 6001
- Start a LiveKit room with a participant publishing audio + video
- Start a room composite egress with SRT output:
{
"room_composite": {
"room_name": "test-room",
"layout": "grid",
"stream_outputs": [
{
"protocol": 2,
"urls": ["srt://127.0.0.1:6001?streamid=#!::h=live,m=publish"]
}
]
}
}
- Check lalmax server logs — connection is accepted but
readBytes=0
- Egress keeps reconnecting repeatedly
Expected behavior
SRT stream should transmit data successfully, same as ffmpeg does.
Actual behavior
- ✅ Connection established successfully (lalmax sees the incoming connection)
- ❌ No data transmitted (lalmax reports
readBytes=0)
- ❌ Egress reconnects in an infinite loop
- ❌ GStreamer logs:
Socket is broken or closed. Trying to reconnect
Version info
| Component |
Version |
| LiveKit Server |
v1.13.6 |
| LiveKit Egress |
v1.14.1 |
| GStreamer (inside egress container) |
1.24.x |
| lalmax SRT server |
latest (uses gosrt) |
| OS |
Ubuntu 22.04 |
Additional context
1. ffmpeg works fine with the same server:
ffmpeg -re -i test.mp4 -c copy -f mpegts 'srt://host:6001?streamid=#!::h=live,m=publish'
This pushes successfully, and the stream can be played back via ffplay/VLC.
2. Direct GStreamer srtsink test also fails:
gst-launch-1.0 videotestsrc ! x264enc ! mpegtsmux ! srtsink uri="srt://host:6001?streamid=#!::h=live,m=publish"
Error: Socket is broken or closed. Trying to reconnect
This confirms the issue is between GStreamer srtsink and gosrt, not specific to LiveKit's egress pipeline.
3. streamid not passed via URL query parameter:
GStreamer srtsink does not pass the streamid query parameter from the URL to the SRT server. The server receives an empty streamid. Setting streamid as a GStreamer property (streamid="#!::h=live,m=publish") does pass the ID correctly, but data transmission still fails.
4. RTMP works fine:
Pushing via RTMP (rtmp://host:1936/live/stream) to the same lalmax server works correctly.
Possible cause
Compatibility issue between GStreamer's srtsink (which uses libsrt) and the gosrt library's SRT implementation. The SRT handshake completes successfully, but data transmission fails. Possible reasons:
- Different default latency settings (GStreamer default 120ms vs gosrt default 300ms)
- Different TSBPD (Timestamp-Based Packet Delivery) mode handling
- SRT protocol version mismatch
- Stream ID format/handling differences
Server-side logs (lalmax)
INFO srt connection request: remoteAddr=127.0.0.1:xxxxx, rawStreamId=""
INFO srt streamid is empty, use config default streamName=live
INFO srt AddCustomizePubSession success: streamName=live, sessionKey=CUSTOMIZEPUBxxxx
INFO srt publisher finished normally: streamName=live, remoteAddr=127.0.0.1:xxxxx, readBytes=0 ← no data!
Egress-side logs (GStreamer)
[srtobject warning] gst_srt_object_write_one: warning: Socket is broken or closed. Trying to reconnect
[basesink warning] gst_base_sink_chain_main: Push on pad srtsink_xxx:sink, but it was not activated in push mode
References
Describe the bug
When using SRT stream output to push to a lalmax SRT server (https://github.com/q191201771/lalmax, which uses the gosrt library), the SRT connection is established successfully but no data is transmitted (
readBytes=0on the server side). The egress then keeps reconnecting in an infinite loop.The same SRT server works perfectly with ffmpeg, which strongly suggests a compatibility issue between GStreamer's
srtsinkelement and the gosrt library's SRT implementation.To Reproduce
{ "room_composite": { "room_name": "test-room", "layout": "grid", "stream_outputs": [ { "protocol": 2, "urls": ["srt://127.0.0.1:6001?streamid=#!::h=live,m=publish"] } ] } }readBytes=0Expected behavior
SRT stream should transmit data successfully, same as ffmpeg does.
Actual behavior
readBytes=0)Socket is broken or closed. Trying to reconnectVersion info
Additional context
1. ffmpeg works fine with the same server:
ffmpeg -re -i test.mp4 -c copy -f mpegts 'srt://host:6001?streamid=#!::h=live,m=publish'This pushes successfully, and the stream can be played back via ffplay/VLC.
2. Direct GStreamer srtsink test also fails:
Error:
Socket is broken or closed. Trying to reconnectThis confirms the issue is between GStreamer srtsink and gosrt, not specific to LiveKit's egress pipeline.
3. streamid not passed via URL query parameter:
GStreamer
srtsinkdoes not pass thestreamidquery parameter from the URL to the SRT server. The server receives an empty streamid. Settingstreamidas a GStreamer property (streamid="#!::h=live,m=publish") does pass the ID correctly, but data transmission still fails.4. RTMP works fine:
Pushing via RTMP (
rtmp://host:1936/live/stream) to the same lalmax server works correctly.Possible cause
Compatibility issue between GStreamer's
srtsink(which uses libsrt) and the gosrt library's SRT implementation. The SRT handshake completes successfully, but data transmission fails. Possible reasons:Server-side logs (lalmax)
Egress-side logs (GStreamer)
References