Commit Graph
3905 Commits
Author SHA1 Message Date
Shayne Parlo ee45c3f0b1 Update README to include snippet about Agents (#4808)
* Add Agents snippet to README.

Added important information about LiveKit Agents SDK for building Voice AI, including a code example and links to relevant documentation.

* Add tags for snippet
2026-09-01 16:05:24 -04:00
Jacob Gelman 4645bca189 Move data track packet serialization to protocol (#4829)
* Pin protocol to data track serialization branch

* Use datatrack package from protocol repo

* Update protocol sha
2026-09-01 13:02:04 -07:00
Benjamin PrachtandClaude Opus 5 91f33da004 ingress: add opt-in support for udp:// URL pull ingress (#4810)
* ingress: add opt-in support for udp:// URL pull ingress

URL pull ingress previously accepted only http, https and srt source
URLs. Add udp:// as an accepted scheme, gated behind a new
`ingress.enable_udp_url_pull` config option that defaults to false, so
unauthenticated UDP sources are not reachable unless the operator opts
in.

Also add a counterfeiter fake for IngressLauncher and a test covering
the scheme validation matrix.

The ingress handler binds a local socket on the caller supplied address
and port instead of connecting out like the http and srt sources do.
Spell out what that means for operators in both the config field doc
comment and config-sample.yaml: caller controlled local port binding,
unauthenticated and spoofable input, and multicast relaying of traffic
on the handler's local network.

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-01 12:11:14 -07:00
Raja SubramanianandClaude Opus 5 0aae7a4894 fix: hold signal messages until the ReconnectResponse goes out (#4827)
* fix: hold signal messages until the ReconnectResponse goes out

Clients take the ReconnectResponse as the first message on a resumed or
migrated in signal connection, anything ahead of it is dropped. Hold
messages back until it has been written.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* fix: keep queued participant updates on a path that always flushes

Queue only while the participant is not ready, that queue is always
drained by the join or reconnect response. Log a dropped SDP, it leaves
the negotiation waiting until the state machine recovers it.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* fix: flush queued updates whenever the connection opens

Queue participant updates while the handshake is pending again, and give
the signaller a hook that fires when the connection opens, on an explicit
open and on the handshake window expiring, so the queue always drains.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* fix: drive the handshake window off a timer and read the gate atomically

The window ran only when something asked whether the handshake was
pending, so a connection with nothing else to send held its queue.
Reading the gate under the lock the flush takes closes the race where an
update queued just after a flush.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* fix: ignore a handshake timeout from a wait that has ended

Stop cannot cancel a timeout that is already running, so tag each wait
and let a timeout act only on its own. Count opens atomically in the
test, the timer fires on its own goroutine.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-09-01 13:59:04 +05:30
cnderrauber 60e08cb19f update ice fork for warp (#4824) 2026-08-31 15:29:34 +08:00
renovate[bot] 460014023f Update github.com/livekit/protocol digest to a469dd4 (#4820)
Generated by renovateBot

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-08-31 10:10:59 +05:30
cnderrauberandClaude Opus 5 a1f46b310a Do not escape the ICE server URI in the WHIP Link header (#4795)
The link target was passed through url.PathEscape, which turns the '?' of
turn:host:3478?transport=udp into %3F. The target of a Link header field
is a URI reference and "?transport=" is part of TURN URI syntax
, not a query string, so a publisher that percent-decodes the
target ends up with an unparsable host.

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-08-31 11:14:15 +08:00
Viacheslav Sergeev 8b38f61fa1 Remove duplication within cpuload and sysload (#4818)
* Removed duplication within cpuload and sysload

* spelling fix
2026-08-30 19:39:35 +05:30
Raja Subramanian c934aa29b7 log telemetry guard details (#4817)
* log telemetry guard details

* nil guard
2026-08-29 16:46:13 +05:30
Raja SubramanianandClaude Opus 5 5528c464a0 telemetry: support roomID change for a participant (#4816)
* telemetry: support roomID change for a participant

A room can get a new id while participants are connected. Key stats
workers as map[roomID]map[participantID] so moving a room is a single
map splice, and add reKeyRoom/RoomIDChanged to do the move.

Stats collected before the change are sealed off with the room they
were collected in so they stay attributed to it.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* telemetry: close superseded worker on re-key collision

Only one worker can be keyed at (room, participant). If a re-key lands
on a room that already has a worker for the same participant, keep the
one already filed there and close the superseded one so it drains and
is reaped instead of lingering in the flush list.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* telemetry: hand references to the successor on force close

A ReferenceGuard records that it activated some worker, not which one,
so a superseded worker cannot just drop its references - the survivor
would be left with references it never sees released and would never
close. Hand them over instead.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-29 12:58:22 +05:30
Paul Wells 54496c765d report a reason on room-ended telemetry (#4815)
* report a reason on room-ended telemetry

Room.Close already took a ParticipantCloseReason, but OnClose was func()
with no arguments, so the reason was structurally dropped before it could
reach RoomEnded.

Add types.RoomCloseReason and carry it through Close -> OnClose -> RoomEnded,
where it lands on both the analytics event and the room_finished webhook.

Room.Close now takes the room reason and derives the participant reason from
it, so the two can never disagree. ToParticipantCloseReason maps each reason
to exactly what its call site passed before, so no participant-facing
behaviour changes; a table test pins that mapping.

* fix(test): update webhook test for RoomCloseReason

test/ was outside the packages checked before pushing, so this Close call
site was missed. Also assert the reason reaches the room_finished webhook,
which the unit test cannot cover since it runs with a nil notifier.
2026-08-28 23:41:59 -07:00
shishirngandCursor a1be640b12 Participant kind agent details (#4809)
* Carry worker kind details into agent job tokens.

WorkerRegistration gains a server-controlled KindDetails field that is
passed to BuildAgentToken when assigning jobs, so kind details flow into
the participant join token for the whole session.

Co-authored-by: Cursor <cursoragent@cursor.com>

Signed-off-by: shishir gowda <shishir@livekit.io>
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-28 08:02:17 -04:00
cnderrauber d185224719 warp log (#4811) 2026-08-28 16:59:21 +08:00
Sanjay P c88fd2b4d7 utils: make Median generic, overflow-safe, and add tests (#4553)
* utils: make Median generic, overflow-safe, and add comprehensive

* tests: fix staticcheck unused variable warning in changenotifier_test.go

* tests: switch from assert to require for consistency with existing tests

* trigger ci rerun
2026-08-28 10:42:14 +05:30
Raja Subramanian c362e61d3c Set up track info properly for dummy receiver. (#4807)
In migration cases, dummy receiver trackInfo is used by relay tracks to
set up the receivers and those need the proper track info.

Also check for proper receiver when adding a migrated track.
2026-08-28 00:27:50 +05:30
Alex FeldgendlerandClaude Opus 5 dc2bd1d3b4 Wait for the callbacks these tests assert on. (#4803)
TestUnsubscribe checked that the changed-notifier observer was gone as
soon as the unsubscribe had settled, but setDesired leaves the
RemoveObserver call to a goroutine of its own and nothing the test waits
on orders against it, so CI caught the assertion running first.
TestSubscribe has the same defect on the unsubscribed callback, which
unmarkSubscribedTo delivers with a bare go while the subscribed one is
called inline.

Wait for both, each with a message of its own, so that a leak that is
real still says which of them broke.

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-08-27 12:25:01 +05:30
Alex FeldgendlerandClaude Opus 5 64a1211517 Skip the docker-backed service tests when there is no docker (#4799)
Let the docker-backed service tests be skipped with a flag.

TestMain called log.Fatalf when it could not reach a docker daemon, so
the whole package refused to run without one, including every test in it
that needs no container at all.

Record why docker is unavailable instead, and gate the tests that want a
container on it. A run asks to go without them with -docker=false;
otherwise a missing daemon still fails the package, so an unreachable
daemon stays a broken build rather than a run that quietly covers less
than the last one did.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-26 10:32:15 -07:00
Raja SubramanianandClaude Opus 5 3cfbd12426 Release v1.13.6. (#4802)
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
v1.13.6
2026-08-26 17:58:15 +05:30
Raja SubramanianandClaude Opus 5 bbdfd50d62 Fix simulcast RTX pairing broken by pion/webrtc#3470 (#4800)
pion no longer starts the repair stream reader when a custom BufferFactory
is set, so the mid/rid/rsid extensions were never observed and simulcast RTX
streams were never paired with their primary streams.

Extract the extensions on the buffer write path instead. Migrated publishers
send no extensions at all, so pair those from SimTracks.

Adds an integration test covering both paths, and moves the vnet setup it
shares with the downtrack test into pkg/testutils/vnettest.

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-08-26 13:01:22 +05:30
cnderrauber 763ea15293 Strip packet trailers from every VP9 layer frame (#4773)
VP9 SVC sends each spatial layer as its own encoded frame,
so a picture carries one trailer per layer, but only the
top layer's last packet has the RTP marker bit set.

Fix https://github.com/livekit/egress/issues/1347
2026-08-26 14:05:34 +08:00
Marcin Beczynski b79f1c425f config: clarify AdvertiseInternalIP applies to explicit node_ip too (#4754)
* config: clarify AdvertiseInternalIP applies to explicit node_ip too

The advertise_internal_ip comment in config-sample.yaml said it works
only when use_external_ip is true. That was accurate until
livekit/mediatransportutil#94, which extended AdvertiseInternalIP to
also be respected on the explicit node_ip path (use_external_ip: false
with rtc.node_ip set) — previously that branch always replaced the
host candidate with node_ip, dropping the original local candidate,
regardless of AdvertiseInternalIP.

Update the comment so it reflects both cases: advertise_internal_ip
keeps the original local candidate alongside the mapped one whether
the mapped IP comes from external-IP discovery or from an explicitly
configured node_ip.

* Update config-sample.yaml
2026-08-25 14:40:33 +08:00
cnderrauber f7954d5747 Return created ingress info from io service (#4787)
The stream key is randomly generated for each request. Return
exsiting record if the `ingressID` already exists on retry.
2026-08-25 09:03:09 +08:00
Benjamin PrachtandClaude Opus 5 906764691c Group livekit dependency updates in renovate (#4791)
First-party livekit modules are co-released and depend on each other,
so bump them together in a single PR instead of one PR per module.

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-24 14:21:55 -07:00
Raja Subramanian b0710f7a6a Reduce locking in media track + telemetry listener on move participant. (#4790)
* Reduce locking in media track + telemetry listener on move participant.

Telemetry listener was not getting it from new room on room move.

* update comment

* fix signal bytes reporting

* room aware telemetry listener in media track

* data track telemetry listener
2026-08-25 02:45:40 +05:30
renovate[bot] 5c7713b336 Update github.com/livekit/mediatransportutil digest to f234b53 (#4785)
Generated by renovateBot

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-08-24 14:06:04 -07:00
Raja Subramanian 26975ef057 Join failure is a canceled connection attempt. (#4788)
Could happen due to participant being already in room, exceeding max
participants, etc.
2026-08-24 10:56:17 +05:30
Genseric 788d4c3544 TEL-912 Adding response for TransferSIPParticipant rpc (#4783)
* Replacing empty return type with rpc.CreateIngressResponse and livekit.TransferSIPParticipantResponse

* removing ambiguous comment
2026-08-21 14:27:06 -04:00
cnderrauber 803864dc7b Add bytes cap on migration data cache size (#4782) 2026-08-21 16:49:09 +08:00
Raja Subramanian 6a64df20df Add a small cache for data messages received via SendData API. (#4781)
SendData API messages do not have sender ID or sequence number. So, they
were not cached and hence excluded from the reliable caching feature
which is meant to provide reliability of data channel messages between
the time other participants see participant as ACTIVE (which happens on
ICE connected) and data channel being open (DTLS done + data channels
opened).

Add a small cache for that and flush those messages on data channel
establishment.
2026-08-20 13:51:10 +05:30
Raja Subramanian 972c64a29b Check for ICE connection before closing participant on signal close. (#4780)
* Check for ICE connection before closing participant on signal close.

Only close the participant if ICE has not connected by the time signal
source is closed. If ICE had connected, candidates have been exchanged
and link was established. So, it should be resumable.

Waiting for DTLS closed the participant sometimes in the windowa after
ICE connection, but before DTLS finishes and that unnecessarily closed
the participant forcing a full reconnect.

* variable name
2026-08-20 13:07:28 +05:30
Raja SubramanianandClaude Opus 5 c52b1b2a30 Flush pending signal responses before closing the web socket. (#4776)
* Flush pending signal responses before closing the web socket.

When the request direction of a signalling connection goes away, the
web socket was closed right away. Responses that the participant had
already sent were dropped.

This loses the leave request on migration. The media node writes
leave(RESUME) and closes the signalling connection just after. The
close won the race, so the client saw a plain web socket close with
code 1000 and never got the leave. It then did a full reconnect
instead of a resume.

Now the response pump is signalled first and drains what is pending,
then the web socket is closed. The producer closes the response
source after its last write, so draining till the source is closed is
a complete flush. A deadline bounds the case where the source stays
open.

The web socket is still closed on all paths, so the ping worker does
not leak.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* Give the response pump a margin over the drain deadline.

Both waits used the same timeout and started at about the same time.
So when the drain ran to its deadline, the outer wait could give up at
the same moment and close the web socket while the pump was still
writing. That write failed and the message was lost. It also logged a
timeout even though nothing was stuck.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-08-20 01:13:50 +05:30
Raja Subramanian 0ef7ee440c Fix deadlock in regress codec check. (#4775) 2026-08-19 20:17:53 +05:30
David Colburn 502ad1bc76 bump protocol for passthrough + UpdateEgress removal (#4774) 2026-08-19 07:55:09 -04:00
dependabot[bot] 636214a6b0 Bump github.com/cilium/ebpf in the go_modules group across 1 directory (#4770)
Bumps the go_modules group with 1 update in the / directory: [github.com/cilium/ebpf](https://github.com/cilium/ebpf).


Updates `github.com/cilium/ebpf` from 0.16.0 to 0.22.0
- [Commits](https://github.com/cilium/ebpf/compare/v0.16.0...v0.22.0)

---
updated-dependencies:
- dependency-name: github.com/cilium/ebpf
  dependency-version: 0.22.0
  dependency-type: indirect
  dependency-group: go_modules
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-08-17 11:50:54 -07:00
Benjamin Pracht 2cad1cc936 Update renovate and pinning behavior, run tools from go.mod (#4759)
- Renovate

config:recommended (config:base is deprecated) and matchPackageNames globs instead of the deprecated matchPackagePrefixes.
Vulnerability alerts get a fast path: 2-day quarantine, no concurrency/hourly/schedule limits.
Go modules are no longer grouped into one "go deps" PR — each gets its own, so a bad bump can be reverted alone. The pion modules stay grouped as a documented exception: they're co-released and interdependent, so individual PRs wouldn't build.
First-party github.com/livekit/** skips the 2-week quarantine.
go.mod's go directive is no longer an update target — the build toolchain is pinned in the Dockerfile instead.
Dockerfile deps get pinDigests; the golang image is ungrouped with separateMinorPatch so a patch and a minor bump are each separately approvable.
Custom manager to bump the builder image's -alpineA.B suffix together with its digest, which the stock docker manager holds fixed.

- Pinning

Both Dockerfiles pin golang and alpine by digest alongside the readable tag.
GOTOOLCHAIN=local so a go.mod bump fails loudly instead of silently downloading a different toolchain.
apk upgrade in the runtime stage — a digest pin plus the 2-week quarantine would otherwise ship base-package CVEs Alpine has already fixed. This relies on a cold layer cache, which holds today because the release workflow configures no buildx cache; there's a comment saying so.
Workflows resolve the Go version from the Dockerfile via .github/scripts/go-version.sh, so tests, releases and images share one toolchain.

- Tools

All four code generators now come from the module graph, and tools/tools.go (the pre-Go-1.24 blank-import idiom) is replaced by go.mod tool directives:

tool	how	why
goimports	go tool	lives in x/tools — its own module is the one being selected
gotestfmt	go tool	zero dependencies, nothing to skew
wire	go run	pins x/tools v0.24.1; building it in our graph changes its output
counterfeiter	go run	unchanged, matches its //go:generate directives

The wire distinction is load-bearing. Building wire inside our module raises it from the x/tools v0.24.1 it pins to our v0.48.0, and that module version difference changes what it generates: it falls back to v/v2/v3 instead of deriving real identifiers from the type. wire_gen.go is regenerated here to match the in-module build — a cosmetic rename of 9 lines, with no other change to the generated code.

golangci-lint deliberately keeps its action rather than becoming a tool: it pins its own x/tools (v0.44.0 vs our v0.48.0) for the analyzers it bundles, adding it to go.mod would double our go.mod/go.sum (158→338 / 441→889 lines), and the action supplies caching, only-new-issues and PR annotations that invoking a binary can't. Its version stays manual by request.
2026-08-17 09:25:02 -07:00
renovate[bot] 70d2df837b Update module github.com/moby/moby/client to v0.5.1 (#4769)
Generated by renovateBot

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-08-16 21:59:43 -07:00
Milos PesicandClaude Fable 5 b0e2d89826 Redact stream keys in UpdateStream API log fields (#4763)
* Redact stream keys in UpdateStream API log fields

UpdateStream add/remove urls were logged raw into the API request log,
including rtmp stream keys and mux/twitch shorthand keys. Redact them
with utils.RedactStreamKey before appending log fields.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* Bump protocol for query-value redaction fallback

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-08-14 14:19:30 +02:00
Raja Subramanian 035bef4111 Log invalid APIKey on API failures. (#4762)
Useful to understand which key is used.
2026-08-14 17:20:10 +05:30
Raja SubramanianandClaude Opus 4.8 68ecd38c00 Flush sequencer on stream restart; bound frame-integrity loops (#4760)
Flush the downtrack sequencer on stream restart (Resync, ReceiverRestart,
codec change) so NACK retransmissions can't use metadata that no longer
matches the resynced bucket. Add a defensive bounds guard on the RTX and
forward payload slicing.

Cap the PacketHistory and FrameIntegrityChecker catch-up loops to the ring
size so a large sequence/frame-number jump can't drive a big per-packet
iteration count.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-08-14 17:00:29 +05:30
cnderrauber dbe06aa8d1 Experimental WARP (#4649)
* Experimental WARP

* fix panic

* go dep

* stats
2026-08-14 16:26:08 +08:00
Raja Subramanian df20578a78 Remove auth token from log/being sent back to client on invalid token… (#4756)
* Remove auth token from log/being sent back to client on invalid token error

* actually remove API key also
2026-08-14 11:51:14 +05:30
Raja SubramanianandClaude Opus 4.8 7d612428f9 Process NACK retransmissions in a single worker per DownTrack (#4758)
Replace the per-NACK-packet goroutine spawn in DownTrack.handleRTCP with a
single long-lived worker that coalesces pending NACKs into one retransmit
pass. Pending sequence numbers are capped so a high NACK arrival rate cannot
grow goroutine count or memory unboundedly.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-08-14 11:51:03 +05:30
Raja SubramanianandClaude Opus 4.8 f72254ba6b Limit API request body size (#4757)
Bound the size of HTTP request bodies on the main API listener so large
messages cannot exhaust memory. Configurable via limit.max_api_request_body_size
(defaults to 10 MiB, 0 disables).

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-08-14 10:36:40 +05:30
Raja Subramanian cc6551d617 Check slice length before access in a couple of more places (#4752)
* Check slice length before access in a couple of more places

* min 🤦

* lint
2026-08-13 18:20:37 +05:30
cnderrauber 7d556cfefe sample codec payload mismatch error log (#4751) 2026-08-13 19:32:21 +08:00
Raja Subramanian 9d676e3a60 Limit number of pending tracks per participant. (#4750)
* Limit number of pending tracks per participant.

Prevents just a signalling connection adding tracks without actually
publishing them growing a large number.

* add to supervisor only if pending track is accepted
2026-08-13 16:48:49 +05:30
Raja Subramanian 2561589868 Fail server start up on partial prom config. (#4749)
* Fail server start up on partial prom config.

* tweaking error message a bit
2026-08-13 13:49:17 +05:30
Raja Subramanian d51533e25c Make subscription limit log Debugw as it could spam in a large room. (#4748) 2026-08-13 13:33:32 +05:30
Raja Subramanian 2cd50a961f Record publish time on participant close for pending tracks. (#4738)
With https://github.com/livekit/livekit/pull/4706, there was a case of
some downstream component taking a long time while lock was held. While
the underlying cause of holding a lock while doing callback was removed
in that PR, to catch such cases, some publish side metric anomaly would
be useful to monitor and alert on.

Adding a publish time record for pending tracks on participant close.
That would inflate the publish time for participants not being able to
publish and can be alerted on as it will spike up the value at node
level and at cluster level if multiple nodes have the issue.
2026-08-12 21:41:52 +05:30
Raja Subramanian 35fe831f1d Close web socket connections in all paths. (#4747)
* Close web socket connections in all paths.

There was a leak of WebSocket pingWorker if the initial response write
errored as it did not close the WebSocket connection.

* graceful close
2026-08-12 15:15:38 +05:30