Skip to content

SRT egress to lalmax (gosrt) fails: connection established but readBytes=0, no data transmitted #1372

Description

@124111294

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

  1. Start a lalmax SRT server on port 6001
  2. Start a LiveKit room with a participant publishing audio + video
  3. 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"]
      }
    ]
  }
}
  1. Check lalmax server logs — connection is accepted but readBytes=0
  2. 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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions