Commit Graph

191 Commits

Author SHA1 Message Date
Alessandro Ros 0eb7089ed6 use safer atomic structs instead of atomic functions (#5622) 2026-03-31 11:30:50 +02:00
Alessandro Ros d5d1de0bd2 webrtc: strip TWCC extension of incoming RTP packets (#5146) (#5605)
The TWCC extension is used as part of the WebRTC congestion control
algorithm placed between the publisher and the server. If this
extension is routed untouched from the server to readers, it messes
with the congestion control algorithm present between the server and
each reader. Remove it.
2026-03-23 14:14:46 +01:00
t-animal 8568d8c57c webrtc: fix random absolute timestamps with Opus, G711 and LPCM (#5597)
When rewriting audio RTP timestamps in WebRTC egress, NTP was
derived using regenerated packet timestamps minus the incoming
RTP base timestamp.

That mixed timestamp domains and could shift absolute time by an
arbitrary offset while still exposing mapping as available.

Fix by using a consistent outgoing RTP domain in rewritten audio
paths:
- snapshot outgoing base timestamp before rewriting each unit
- compute NTP from (outgoing packet timestamp - outgoing base
  timestamp)

This keeps RTP<->NTP mapping coherent for sender reports and prevents
random absolute-time offsets in WebRTC loopback with
useAbsoluteTimestamp.

---------

Co-authored-by: aler9 <46489434+aler9@users.noreply.github.com>
2026-03-21 19:46:39 +01:00
Alessandro Ros 3381b196fb solve codec labels internally (#5603)
stop using gortsplib format.Format.Codec() for getting codec names.
2026-03-21 18:22:49 +01:00
Alessandro Ros adf45596a3 api: rename WebRTC stats to match RTSP ones (#5581) 2026-03-16 23:29:25 +01:00
Alessandro Ros dfce20fefa api: add RTSP reported lost packets (#5198) (#5579)
The new outboundRtpPacketsReportedLost property allows to track RTP
packets that have been reported lost by readers. Furthermore, stats now
have a "inbound" or "outbound" prefix to improve readability.
2026-03-16 22:10:18 +01:00
Alessandro Ros a7290a2069 webrtc: support publishing multiple video/audio renditions (#5573)
this allows to receive multiple video tracks from OBS Studio with the
new WebRTC Simulcast feature introduced in v32.1.0.
2026-03-14 16:59:05 +01:00
Alessandro Ros a6856e9e58 tests: fix race conditions (#5571) 2026-03-13 22:32:06 +01:00
JulienCossec 184899dfab fix: avoid buffering HTTP response body in loggerWriter (#5552)
loggerWriter was shadow-copying every response byte into a bytes.Buffer
to report the body size, causing the entire response to be accumulated
in memory for the lifetime of each request. Replace the buffer with a
plain int counter since dump() only ever reported the byte count anyway.
2026-03-07 18:36:10 +01:00
dependabot[bot] 0f46e4982d build(deps): bump github.com/bluenviron/gortsplib/v5 from 5.3.2-0.20260222121945-18b06189ef23 to 5.3.2 (#5504)
* build(deps): bump github.com/bluenviron/gortsplib/v5

Bumps [github.com/bluenviron/gortsplib/v5](https://github.com/bluenviron/gortsplib) from 5.3.2-0.20260222121945-18b06189ef23 to 5.3.2.
- [Commits](https://github.com/bluenviron/gortsplib/commits/v5.3.2)

---
updated-dependencies:
- dependency-name: github.com/bluenviron/gortsplib/v5
  dependency-version: 5.3.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* additional changes

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: aler9 <46489434+aler9@users.noreply.github.com>
2026-02-22 17:14:02 +01:00
Alessandro Ros 35e1f486c9 add integrated packet dumper (#5488)
this allows to dump any incoming and outgoing packet, to disk, in
pcapng format.
2026-02-22 13:34:05 +01:00
bluenviron-bot a07526d57c bump Golang to 1.26 (#5460) 2026-02-21 14:48:53 +01:00
Alessandro Ros 98a9cf8238 improve tests (#5497) 2026-02-21 14:25:32 +01:00
Alessandro Ros 87fbfebf06 webrtc: add whepBearerTokenParameter (#3796) (#5486)
this allows to pass Authorization: Bearer to servers that require it.
2026-02-19 11:57:39 +01:00
Alessandro Ros f991821a5f webrtc: allow tuning WHEP timeouts (#5027) (#5479)
add whepHandshakeTimeout, whepTrackGatherTimeout, whepSTUNGatherTimeout
2026-02-18 16:29:25 +01:00
Alessandro Ros ddaafd4ef3 rtmp: prevent legacy clients from reading multiple video/audio tracks (#5478) 2026-02-18 11:02:58 +01:00
Alessandro Ros bbefa5bc8b improve tests (#5469) 2026-02-15 12:50:26 +01:00
bluenviron-bot ea6977d918 bump golangci-lint to 2.9.0 (#5459) 2026-02-12 15:18:02 +01:00
dependabot[bot] 88a15c7654 build(deps): bump github.com/bluenviron/gortmplib from 0.2.0 to 0.2.1 (#5394)
* build(deps): bump github.com/bluenviron/gortmplib from 0.2.0 to 0.2.1

Bumps [github.com/bluenviron/gortmplib](https://github.com/bluenviron/gortmplib) from 0.2.0 to 0.2.1.
- [Commits](https://github.com/bluenviron/gortmplib/compare/v0.2.0...v0.2.1)

---
updated-dependencies:
- dependency-name: github.com/bluenviron/gortmplib
  dependency-version: 0.2.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* additional changes

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: aler9 <46489434+aler9@users.noreply.github.com>
2026-01-31 15:57:00 +01:00
Alessandro Ros a56408db19 add always available streams (#5335)
When the publisher or source of a stream is offline, the server can be
configured to fill gaps in the stream with a video that is played on
repeat until a publisher comes back online. This allows readers to stay
connected regardless of the state of the stream. The offline video and
any future online stream are concatenated without decoding or
re-encoding packets, using the original codec.
2026-01-31 14:44:58 +01:00
Alessandro Ros 06c7cc3d7f fix race condition when closing HTTP servers (#5390)
when a HTTP server is closed, open connections are now immediately
closed and open routines are waited before the server is considered
closed.
2026-01-31 14:09:10 +01:00
dependabot[bot] aa6dc4ea9f build(deps): bump github.com/pion/webrtc/v4 from 4.2.1 to 4.2.3 (#5341)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: aler9 <46489434+aler9@users.noreply.github.com>
2026-01-20 18:21:05 +01:00
Yaroslav Molochko 8901ac4e9c webrtc: support reading KLV tracks (#4722)
Co-authored-by: aler9 <46489434+aler9@users.noreply.github.com>
2026-01-16 23:40:21 +01:00
Alessandro Ros 653d10fb75 use the same filtering process for every codec (#5324)
this allows to apply features that were previously implemented for
single codecs (like RTP packet resizing), to any codec, and simplifies
future development.
2026-01-16 14:03:13 +01:00
Alessandro Ros e4c60e1e62 tests: fix race condition (#5338) 2026-01-12 21:46:48 +01:00
Alessandro Ros cd34de8770 print last decode error (#5319)
decode errors are still grouped together, but the last one is now
printed.
2026-01-05 15:28:24 +01:00
dependabot[bot] 62effa79ef build(deps): bump github.com/bluenviron/gortmplib from 0.1.2 to 0.2.0 (#5300)
Bumps [github.com/bluenviron/gortmplib](https://github.com/bluenviron/gortmplib) from 0.1.2 to 0.2.0.
- [Commits](https://github.com/bluenviron/gortmplib/compare/v0.1.2...v0.2.0)

---
updated-dependencies:
- dependency-name: github.com/bluenviron/gortmplib
  dependency-version: 0.2.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-12-28 17:29:27 +01:00
dependabot[bot] f843df4ab8 build(deps): bump github.com/bluenviron/mediacommon/v2 (#5297)
Bumps [github.com/bluenviron/mediacommon/v2](https://github.com/bluenviron/mediacommon) from 2.5.3 to 2.6.0.
- [Commits](https://github.com/bluenviron/mediacommon/compare/v2.5.3...v2.6.0)

---
updated-dependencies:
- dependency-name: github.com/bluenviron/mediacommon/v2
  dependency-version: 2.6.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-12-28 15:44:36 +01:00
Alessandro Ros 55f93eddde rtsp: call rtsp.ToStream before advertising the stream (#5288) 2025-12-24 20:37:01 +01:00
Alessandro Ros 9e82b5233d fix 1-minute offset when recording a H264 WebRTC track (#5275) (#5278) 2025-12-19 13:32:14 +01:00
KHuynh ade0cddeb3 support multiple CORS origins (#5150)
Co-authored-by: aler9 <46489434+aler9@users.noreply.github.com>
2025-11-21 02:00:46 +01:00
Alessandro Ros 2d02ca0df7 webrtc: use rtpReceiver and rtpSender to count packets (#5193) 2025-11-14 17:10:50 +01:00
Alessandro Ros d02fb4ed8e move constant (#5190) 2025-11-12 18:09:53 +01:00
Alessandro Ros ff187b6d8a update golangci-lint configuration (#5182) 2025-11-11 23:57:52 +01:00
Alessandro Ros 5be9b0eb97 rename variable (#5173) 2025-11-09 22:19:17 +01:00
Alessandro Ros 1ef5db5b3c extend udpReadBufferSize to WebRTC UDP sockets (#5130)
this allows to decrease packet losses without touching system parameters.
2025-10-29 11:45:15 +01:00
Alessandro Ros ccaccc51b4 replace incoming absolute timestamps of any source (#5081)
Absolute timestamps are used to generate recording segments, so users
should not be able to change them, unless explicitly allowed.

Parameter useAbsoluteTimestamp allowed to re-enable absolute timestamps
with RTSP and WebRTC, now it is extended to all protocols.
2025-10-13 12:23:51 +02:00
Alessandro Ros 0cdae40fe3 estimate absolute timestamp more precisely (#5078)
When the absolute timestamp of incoming frames was not available, it
was filled with the current timestamp, which is influenced by latency
over time.

This mechanism is replaced by an algorithm that detects when latency is
the lowest, stores the current timestamp and uses it as reference
throughout the rest of the stream.
2025-10-12 11:02:14 +02:00
Alessandro Ros f5f03562d3 rewrite Unit definition (#5079)
Stream units now share the same struct, with a specialized payload.
2025-10-11 12:18:51 +02:00
Alessandro Ros 7634370818 add read and write timeouts in HTTP servers (#5056)
this prevents zombie connections from piling up.
2025-10-04 10:01:21 +02:00
Alessandro Ros 691d7290fb webrtc: fix packet corruption when reading G711 (#5048)
when a reader is reading a G711 track, stream units are modified
globally, affecting every other reader. This fixes the issue.
2025-09-30 10:42:24 +02:00
Alessandro Ros 2024783eec webrtc: fix clippy audio when reading Opus (#3878) (#5047)
Opus timestamp is now recomputed from scratch.
2025-09-30 10:35:56 +02:00
Alessandro Ros cd80814009 do not include recorder and HLS muxer in sent bytes (#4380) (#5039)
in API (/paths/list, /paths/get) and metrics (paths_bytes_sent), the
amount of sent bytes was increased even in case of writes to the
recorder and HLS muxer, which are not generating network traffic. This
fixes the issue.
2025-09-29 09:28:04 +02:00
dependabot[bot] 253df883c2 build(deps): bump github.com/bluenviron/mediacommon/v2 (#4990)
Bumps [github.com/bluenviron/mediacommon/v2](https://github.com/bluenviron/mediacommon) from 2.4.2 to 2.4.3.
- [Commits](https://github.com/bluenviron/mediacommon/compare/v2.4.2...v2.4.3)

---
updated-dependencies:
- dependency-name: github.com/bluenviron/mediacommon/v2
  dependency-version: 2.4.3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-09-18 13:10:42 +02:00
Alessandro Ros e3b8af8933 switch to gortsplib/v5 (#4978) 2025-09-16 13:10:34 +02:00
dependabot[bot] ebd9eb6665 build(deps): bump github.com/bluenviron/mediacommon/v2 (#4975)
Bumps [github.com/bluenviron/mediacommon/v2](https://github.com/bluenviron/mediacommon) from 2.4.2-0.20250909112826-017d0bbe41db to 2.4.2.
- [Commits](https://github.com/bluenviron/mediacommon/commits/v2.4.2)

---
updated-dependencies:
- dependency-name: github.com/bluenviron/mediacommon/v2
  dependency-version: 2.4.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-09-15 22:56:28 +02:00
Alessandro Ros 35aceaa4a9 send server name (SNI) when opening TLS connections (#4973) 2025-09-15 19:38:36 +02:00
Alessandro Ros 1b8897d30d rtmp: move implementation to gortmplib (#4968) 2025-09-13 11:50:36 +02:00
Alessandro Ros 57021467e9 rename formatprocessor into codecprocessor (#4962) 2025-09-12 10:24:11 +02:00
Alessandro Ros 9318107779 rtmp: support additional enhanced RTMP features (#4168) (#4321) (#4954)
* support reading AV1, VP9, H265, Opus, AC-3, G711, LPCM
* support reading multiple video or audio tracks at once
2025-09-11 23:18:46 +02:00