mediamtx v1.21.2

v1.21.2
Added 2
  • The H264 DTS extractor treats an SEI recovery point message as a random access point
  • RTP/JPEG implementation is completed with support for restart headers, limited to JPEG types 0 and 1
Changed 3
Fixed 11
  • UDP packets are dropped during connection close only when they are empty and there is an error, instead of regardless of size
  • The YouTube RTMPS URL in the documentation is corrected and the fingerprint is no longer required
  • Possible out-of-memory caused by empty datagram packets allocating unnecessary entries in the rewindable reader is fixed
  • Race condition when kicking RTSP sessions is fixed
  • Config patch requests no longer change passwords whose value is '<redacted>', which are now ignored and the original password is kept
  • Deadlock when reloading the API is fixed by canceling requests from API endpoints to the server when the API is closing
Security 3
  • Playback server access is granted only to users authenticated with readUser and readPass when legacy credentials are in use, instead of to anyone
  • JWT authentication returns 'JWT not provided' before fetching the JWKS when a request carries no token
  • JWKS responses with a non-2xx status code are rejected with the status code and are no longer cached as the key set

2 changes to check, marked in the notes below

From mediamtx

Fixes and improvements

General

  • fix dropping UDP packets during connection close (https://github.com/bluenviron/mediamtx/issues/6278) UDP packets were dropped in case of errors regardless of their size. Now they are dropped only if they are empty and there's an error.
  • docs: fix youtube rtmps URL (https://github.com/bluenviron/mediamtx/issues/6286) The rtmps URL for Youtube was wrong. The fingerprint is not required anymore.
  • prevent free access to playback server in case of legacy credentials (https://github.com/bluenviron/mediamtx/issues/6311) When legacy credentials are in use (readUser, readPass, publishUser, publishPass), access to the playback server is granted to anyone. Prevent this by granting access only to users using readUser, readPass.
  • auth: skip JWKS fetch when no JWT is provided (https://github.com/bluenviron/mediamtx/issues/6274) authenticateJWT fetched the JWKS before checking whether the request carried a token at all. Every anonymous request, such as the first unauthenticatedRTSP DESCRIBE or HLS request that precedes a 401, caused an outbound request to the JWKS server while holding the manager's write lock. An unauthenticated client could therefore make the server contact the identity provider at will and, while that endpoint was slow or unreachable, stall JWT authentication for everybody. Return "JWT not provided" before touching the JWKS. Also check the JWKS response status code. A non-2xx reply was fed straight to the JSON decoder, so an error page surfaced as a confusing parse error,and an error reply that happened to hold valid JSON was cached as the key set for an hour. Reject it with the status code, as authenticateHTTP already does. Behavior for requests that carry a token against a healthy JWKS server is unchanged.
  • rewindablereader: fix possible OOM (https://github.com/bluenviron/mediacommon/issues/383) empty datagram packets might cause the allocation of unnecessary entries. Fix that.
  • h264: revert https://github.com/bluenviron/mediacommon/issues/142 (https://github.com/bluenviron/mediacommon/issues/384) supporting standalone SEI units should not be necessary anymore since these are filtered out at the root (https://github.com/bluenviron/gortsplib/pull/1184). In case of any issue that should arise after this change, open a bug report and we'll adjust things accordingly.
  • h264: support SEI recovery point in DTS extractor (https://github.com/bluenviron/mediacommon/issues/341) Treat a SEI recovery point message (payload type 6) as a random access point, similarly to a CRA in H265, so the DTS extractor can (re)initialize its state from the first coded frame that follows the recovery point.

API

Media-Over-QUIC

RTSP

RTMP

  • detect read errors even when the server is writing (https://github.com/bluenviron/mediamtx/issues/6267) Until now we relied exclusively on write errors to detect broken RTMP connections. Now read errors are checked too.
  • make rawmessage.Write thread-safe (https://github.com/bluenviron/gortmplib/issues/136)
  • writer: drain inbound messages (https://github.com/bluenviron/mediamtx/issues/5776) (https://github.com/bluenviron/gortmplib/issues/132) Some servers periodically send messages even when we're publishing. If they are not read, they fill an internal connectionbuffer and cause periodic disconnections. Now the Writer also drains inbound messages.
  • reader: support FLV video command frames and skip empty audio messages (https://github.com/bluenviron/gortmplib/issues/128) Someservers (e.g. Wowza Streaming Engine) send a video info/command frame before the first frame: a 2-byte message with frame type 5 and a single command byte (start of seek / end of seek). Video.unmarshal rejected it on length, aborting the whole connection. Add Video.FrameType (key frame, inter frame, command) and Video.Command, deprecate Video.IsKeyFrame in favour of FrameType, and skip command frames in Reader since they carry no data. Some servers (e.g. Wowza Streaming Engine) send an audio message with an empty bodybefore the first frame. allocateMessage rejected it with "not enough bytes", aborting the whole connection. Parse an empty body into an Audio with Codec = 0 and no other field, marshal it back to an empty body, and skip such messages in Reader since they carry no data, like FFmpeg does.
  • rename message.Video.Type into message.Video.PacketType (https://github.com/bluenviron/gortmplib/issues/138) This is to avoid confusion with the new message.Video.FrameType field. renamed · inferred

HLS

  • muxer: keep EXT-X-MAP in delta updates (https://github.com/bluenviron/gohlslib/issues/397) Delta updates were generated without EXT-X-MAP, although all tags that are not skipped must remain in them. Apple clients stop playback (MoofManifold -16046) at the first delta update that skips a segment after delta updates without skipped segments.

WebRTC

Dependencies

  • Go updated from 1.26 to 1.27
  • code.cloudfoundry.org/bytefmt updated from v0.90.0 to v0.92.0
  • github.com/bluenviron/gohlslib/v2 updated from v2.4.5 to v2.4.6
  • github.com/bluenviron/gortmplib updated from v1.0.3 to v1.0.4
  • github.com/bluenviron/gortsplib/v5 updated from v5.6.6 to v5.6.7
  • github.com/bluenviron/mediacommon/v2 updated from v2.9.5 to v2.9.6
  • github.com/datarhei/gosrt updated from v0.11.1-0.20260812091715-a77b40bb4b76 to v0.12.0
  • github.com/gin-contrib/pprof updated from v1.5.5 to v1.5.6
  • github.com/go-git/go-billy/v5 updated from v5.9.1 to v5.9.2
  • github.com/go-git/go-git/v5 updated from v5.19.2 to v5.19.3
  • github.com/pion/ice/v4 updated from v4.4.2 to v4.4.5
  • github.com/pion/interceptor updated from v0.1.48 to v0.1.49
  • github.com/pion/rtcp updated from v1.2.17 to v1.2.19
  • github.com/pion/transport/v4 removed
  • github.com/pion/webrtc/v4 updated from v4.2.20 to v4.2.22
  • github.com/quic-go/quic-go updated from v0.62.0 to v0.63.0
  • github.com/pion/datachannel updated from v1.6.2 to v1.6.3
  • github.com/pion/dtls/v3 updated from v3.1.8 to v3.1.9
  • github.com/pion/mdns/v2 updated from v2.2.0 to v2.2.2
  • github.com/pion/sctp updated from v1.11.1 to v1.11.3
  • github.com/pion/srtp/v3 updated from v3.0.15 to v3.1.3
  • github.com/pion/stun/v4 updated from v4.0.0 to v4.0.1
  • github.com/pion/turn/v5 updated from v5.1.0 to v5.1.2
  • github.com/pjbgf/sha1cd updated from v0.6.0 to v0.7.0
  • github.com/pion/transport/v5 v5.1.1 added
Security

Binaries are compiled from source code by the Release workflow, which is a fully-visible process that prevents any change or external interference in produced artifacts.

Checksums of binaries are also published in a public blockchain by using GitHub Attestations, and they can be verified by running:

ls mediamtx_* | xargs -L1 gh attestation verify --repo bluenviron/mediamtx

You can verify checksums of binaries by downloading checksums.sha256 and running:

cat checksums.sha256 | grep "$(ls mediamtx_*)" | sha256sum --check
View original

Upgraded? How did it go?

Discussion