Skip to content

SRT Connection stat msReceiveBuf incorrect values #5611

@dbussert

Description

@dbussert

Which version are you using?

d5d1de0

Which operating system are you using?

Linux amd64 standard

Describe the issue

SRT streamid pushes to MediaMTX show a 0 value for msReceiveBuf when reading connection stats. The value returned by the API /v3/srtconns/list jumps between the real value and 0.

This is an example log of the msReceiveBuf value from the API, queried once a second.

2026-03-25T14:14:09.848Z 0
2026-03-25T14:14:10.837Z 995
2026-03-25T14:14:11.839Z 1006
2026-03-25T14:14:12.837Z 996
2026-03-25T14:14:13.841Z 0
2026-03-25T14:14:14.839Z 995
2026-03-25T14:14:15.837Z 1004
2026-03-25T14:14:16.847Z 1005
2026-03-25T14:14:17.848Z 1002
2026-03-25T14:14:18.846Z 0
2026-03-25T14:14:19.843Z 0
2026-03-25T14:14:20.840Z 996
2026-03-25T14:14:21.840Z 1003
2026-03-25T14:14:22.847Z 0
2026-03-25T14:14:23.842Z 0
2026-03-25T14:14:24.839Z 0

Graphed

Image

Describe how to replicate the issue

  1. Publish a MPEG-TS over SRT stream to MediaMTX ffmpeg -i <mpegts source> -c copy -map 0 -f mpegts "srt://<ip>:8890?streamid=publish:test&pkt_size=1316&latency=1000&passphrase=mypassphrase"
  2. Query /v3/srtconns/list and observe the msReceiveBuf jumps between 0 and 1000. The value should be around 1000 since this is an environment with low latency and no packet loss
  3. Watch the video and observe that it's smooth and that the Receive Buffer isn't actually dropping to 0, or you would have stuttering playback ffplay "srt://<ip>:8890?streamid=read:test&passphrase=mypassphrase"

MediaMTX configuration

pathDefaults:
  srtPublishPassphrase: mypassphrase

MediaMTX logs

curl -s localhost:9997/v3/srtconns/list | jq
{
  "itemCount": 1,
  "pageCount": 1,
  "items": [
    {
      "id": "a9fce94b-819f-4409-bb41-50e7a9359b1f",
      "created": "2026-03-24T22:48:18.999764894Z",
      "remoteAddr": "172.28.242.2:50090",
      "state": "publish",
      "path": "test",
      "query": "",
      "user": "",
      "packetsSent": 0,
      "packetsReceived": 6417964,
      "packetsSentUnique": 0,
      "packetsReceivedUnique": 6417964,
      "packetsSendLoss": 0,
      "packetsReceivedLoss": 0,
      "packetsRetrans": 0,
      "packetsReceivedRetrans": 0,
      "packetsSentACK": 3842739,
      "packetsReceivedACK": 0,
      "packetsSentNAK": 0,
      "packetsReceivedNAK": 0,
      "packetsSentKM": 0,
      "packetsReceivedKM": 0,
      "usSndDuration": 0,
      "packetsReceivedBelated": 0,
      "packetsSendDrop": 0,
      "packetsReceivedDrop": 0,
      "packetsReceivedUndecrypt": 0,
      "bytesReceived": 8856790320,
      "bytesSent": 0,
      "bytesSentUnique": 0,
      "bytesReceivedUnique": 8856790320,
      "bytesReceivedLoss": 0,
      "bytesRetrans": 0,
      "bytesReceivedRetrans": 0,
      "bytesReceivedBelated": 0,
      "bytesSendDrop": 0,
      "bytesReceivedDrop": 0,
      "bytesReceivedUndecrypt": 0,
      "usPacketsSendPeriod": 10.967254638671875,
      "packetsFlowWindow": 25600,
      "packetsFlightSize": 0,
      "msRTT": 1.0924169709279459,
      "mbpsSendRate": 0,
      "mbpsReceiveRate": 1.0437949185276045,
      "mbpsLinkCapacity": 2852.858097407865,
      "bytesAvailSendBuf": 0,
      "bytesAvailReceiveBuf": 0,
      "mbpsMaxBW": -1,
      "byteMSS": 1500,
      "packetsSendBuf": 0,
      "bytesSendBuf": 0,
      "msSendBuf": 0,
      "msSendTsbPdDelay": 1000,
      "packetsReceiveBuf": 134,
      "bytesReceiveBuf": 176344,
      "msReceiveBuf": 0,
      "msReceiveTsbPdDelay": 1000,
      "packetsReorderTolerance": 0,
      "packetsReceivedAvgBelatedTime": 0,
      "packetsSendLossRate": 0,
      "packetsReceivedLossRate": 0,
      "outboundFramesDiscarded": 0
    }
  ]
}

Packet dump

No response

Metadata

Metadata

Assignees

No one assigned

    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