1660 Commits
Author SHA1 Message Date
armaan4658 0ad326e7f2 rtc: answer an ICE restart offer while ICE is gathering (#5186)
* rtc: answer an ICE restart offer while ICE is gathering

A remote offer that restarts ICE was held while the peer connection was
still gathering candidates and only applied when gathering completed.
Until then no answer was sent, so the remote waited in have-local-offer
for as long as gathering ran, for example until a STUN request timed
out. The remote candidates of the new ICE generation that were trickled
in the meantime were added against the previous remote description,
dropped by pion as not matching the current ufrag, and never added
again.

Holding the offer was added when the ICE agent could not restart while
gathering. The ICE agent now cancels a gather in progress on restart,
so apply the restart offer and answer it right away, and remove the
held offer and its replay on gathering complete.

Refs #5167

* rtc: remove comment
2026-11-20 17:11:05 +08:00
armaan4658 6c88c98604 rtc: remove a closing participant's data tracks from the room (#5246)
UpDataTrackManager.Close empties its map and closes each track, but
does not report them unpublished. When the participant closes itself
(a peer connection disconnect timeout, a full reconnect), the room
removes it afterwards and finds no data tracks, so they stay in
RoomTrackManager and subscribers never get the removal notification.

Report each track unpublished on close, as a closing media track does.

Tests cover both close paths against a real room, and Close itself:
each track reported once, nothing on a second Close or for a track
unpublished before it.
2026-11-20 14:31:57 +05:30
cnderrauber 4778fe46d8 Remove ParticipantJoined/Left telemetry call on signal node (#5243)
Fix double count problem in #5241.
Remove the call loss nothing, because the
SendStats/SendEvents are no-op now.
2026-11-19 20:01:05 +08:00
armaan4658 529bd357b1 rtc: re-check data track permission after the subscriber is recorded (#5196)
subscribeDataTrack checks the publisher's permission when it resolves
the data track and records the subscriber on the track afterwards. A
publisher revoke removes only the subscribers already recorded on its
data tracks, so a subscribe that passed the check before the revoke and
was recorded after it is never removed. The subscriber keeps receiving
a data track it is no longer allowed to receive.

Resolve the track again once the subscriber is recorded, as is already
done for canSubscribe. If it is still the same data track and
permission is now denied, remove the subscriber and return
ErrNoTrackPermission. The reconcile that follows records the denial,
tells the client, and keeps the subscription waiting until permission
is granted again.
2026-11-19 18:00:39 +08:00
Mansur AkhmadiandMansur Akhmadi c8196add0a rtc: re-check track permission after the subscriber is recorded (#5177)
* rtc: re-check track permission after the subscriber is recorded

* rtc: cover the denial after an in-flight revoke in the subscribe test

---------

Co-authored-by: Mansur Akhmadi <10739460+mansur-akhmadi@users.noreply.github.com>
2026-11-18 18:12:07 +08:00
Perfloop Agent 1d0bae0f76 sfu: bind retransmissions to the source cache generation (#5213)
* sfu: reproduce retransmission across receiver restart

Signed-off-by: Perfloop Agent <agent@perfloop.ai>

* sfu: use an atomic counter for cache generations

Signed-off-by: Perfloop Agent <agent@perfloop.ai>

* sfu: give test packets a stream generation

Signed-off-by: Perfloop Agent <agent@perfloop.ai>

---------

Signed-off-by: Perfloop Agent <agent@perfloop.ai>
2026-11-17 15:43:00 +05:30
armaan4658 baf98cc567 rtc: publish the upgraded receiver under the dummy receiver's lock (#5218)
DummyReceiver.Upgrade stored the real receiver and only then took
downTrackLock to move the pending down tracks to it. A DeleteDownTrack
that ran in between saw the real receiver, deleted from it (a no-op,
the down track had not moved yet) and returned. Upgrade then moved the
deleted down track to the real receiver, which kept a closed down track
in its spreader for as long as the track lived. DummyRedReceiver.upgrade
had the same order.

Store the receiver while holding downTrackLock in both, so a delete
either removes the down track from the pending map before the move or
finds it on the real receiver after it. GetDownTracks also no longer
returns the real receiver's list without the pending down tracks
during an upgrade.
2026-11-17 12:53:41 +05:30
Raja SubramanianandClaude Opus 5.5 80cfa6e73f config: count lk. participant attributes against their own size limit (#5130)
* config: count lk. participant attributes against their own size limit

LiveKit services set participant attributes with the lk. prefix. These
attributes now count against a new max_lk_attributes_size limit
(default 1024 bytes), so they do not use up the customer's
max_attributes_size budget. All attribute size checks enforce both
limits and keep the existing error types.

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

* rtc: check attribute limits against the merged participant attributes

UpdateMetadata checked only the attributes in the update, but
SetAttributes merges them into the stored attributes. Sequential
updates could each pass and leave the participant above either limit.
The check now runs on the attributes that the update would store.

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

* service: return invalid argument when merged attributes exceed a limit

The admin API checks only the attributes in the request. The participant
checks them merged with the attributes it already has, so a request can
pass the first check and fail the second. That error reached the caller
as unknown. Return InvalidArgument for it.

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

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-16 16:39:06 +05:30
Dipesh Babu bcd327976a rtc: advance local subscription-permission versions past remote updates (#5208) 2026-11-15 18:52:16 +05:30
lukasIOandClaude Fable 5.2 800d6bfa0f rtc: re-use the offered transceiver in one shot signalling on Safari (#5212)
A one shot client, i. e. WHIP, cannot negotiate again. The transceivers
of its offer are the only place for a subscribed track. #4474 turned off
transceiver re-use for Safari, and the check ran before the one shot
branch. The server then added a new transceiver for the subscribed
track, which the answer cannot carry. A WHIP client in desktop Safari
got a `recvonly` answer and never received the track.

The one shot branch now runs first.

Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-15 09:51:16 +01:00
Max HeimbrockandClaude Opus 5.5 0f229742cd treat UNITY_WEB like JS for browser client info (#5199)
Unity WebGL runs livekit-client in the browser. Parse its user agent for
browser/OS info, and apply the iOS WebKit limitations to it like JS.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-13 14:16:32 +01:00
sujan-talviewandClaude Opus 5 26b5d656aa rtc: keep the participant egress guard across a duplicate identity eviction (#5099)
* rtc: keep the participant egress guard across a duplicate identity eviction

Room.RemoveParticipant clears hasPublished[identity], which is the guard that
stops auto participant egress launching twice for the same identity. A duplicate
identity eviction calls RemoveParticipant with the outgoing participant's own ID,
so the "participant session has been replaced" early return does not apply and
the guard is dropped even though the identity stays in the room.

The replacement session then publishes, finds no guard and launches a second
participant egress. The first one does not stop: the egress SDK resolves its
source by identity, so it follows the new SID, re-subscribes to the republished
tracks and keeps recording. Both jobs then write the same media until the
participant leaves for good.

Keep the guard when the close reason is ParticipantCloseReasonDuplicateIdentity.
launchedTrackEgresses is left as is, since it is keyed per track ID and a
replacement session republishes with new track IDs.

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

* rtc: separate the participant egress launch guard from hasPublished

Review feedback on the first commit: hasPublished gates the publisher agent
dispatch as well as participant egress, so preserving it across a duplicate
identity eviction left the replacement session without its publisher jobs.

Track the participant egress launch in its own identity keyed map. hasPublished
is cleared on every removal as before, so agent dispatch is untouched, and only
the egress guard survives a duplicate identity eviction.

The preserved guard is also tied to a successful handoff: StartSession releases
it when the session that caused the eviction fails to join, so it cannot strand
an identity that is no longer in the room.

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

* rtc: only release a preserved egress guard while the identity is unoccupied

Sessions for one identity can race. A handoff fails with ErrAlreadyJoined
exactly when another session has already joined under that identity, and that
session now owns the preserved participant egress guard. Releasing it there let
the winner start a second egress on its next publication, alongside the job
still recording.

Release the guard only while the room holds no participant for the identity.

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

* rtc: drop the failed handoff release of the egress guard

Review feedback: the duplicate identity disconnect is filtered, so the running
participant egress keeps recording whether or not the replacement session ever
joins. Releasing the guard on a failed handoff only gives the next session for
that identity a way to launch a second job against the same tracks.

Remove ClearLaunchedParticipantEgress and its StartSession deferred call. The
guard is now released solely by RemoveParticipant on a non-duplicate removal or
a room close, which is where the identity genuinely leaves.

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

---------

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-11-12 10:43:14 -05:00
armaan4658 2ff5c83ec1 rtc: ignore track updates of the other kind on pending tracks (#5158)
* rtc: ignore track updates of the other kind on pending tracks

* rtc: don't mark a pending track of the other kind as found
2026-11-12 14:08:24 +05:30
Théo Monnom f45ae26679 Carry agent dispatch thread_id to jobs (#5160)
* agent dispatch: carry thread_id from dispatches to jobs

* agent dispatch: validate thread_id as an AT_ agent thread id on the API

* agent dispatch: validate thread_id with protocol agent.ValidateThreadID

* agent dispatch: report an invalid thread_id as a Twirp InvalidArgument on thread_id
2026-11-11 14:10:27 -08:00
Raja SubramanianandClaude Opus 5.5 cb45efc385 rtc: let callers wait for a participant's close callbacks (#5188)
A second Close returns at once while the first still runs the close
callbacks. CloseDone is closed after they have run, so a caller can act
only once the participant's final update went out.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 15:58:10 +05:30
Arunveer Sidhu 8f94fc2028 Fix data blob size accounting for replacements (#5183) 2026-11-10 21:31:38 +05:30
Sumit Kumar 401ddb1432 rtc: don't let the forwarded RPC timeout underflow (#5154)
* rtc: don't let the forwarded RPC timeout underflow

PerformRpc forwarded "responseTimeout - p.lastRTT" to the callee, both
unsigned. A caller timeout below the callee's round trip, such as 100 ms
against 150 ms, wrapped around to about 4.29 billion ms, so the callee
was told it had roughly 49 days to respond while the server's own timer
still used the real value. lastRTT was also read without p.lock, which
UpdateMediaRTT holds when it writes it.

Read lastRTT under the lock and keep the caller's timeout when the round
trip is not below it.

Fixes #5151

* rtc: compute the forwarded RPC timeout inline in PerformRpc

Drop the rpcRequestTimeoutMs helper and test the forwarded
ResponseTimeoutMs through PerformRpc instead.
2026-11-10 22:25:09 +08:00
Raja SubramanianandClaude Opus 5.5 8af97efcf8 rtc: do not send lk.rtc. attributes to clients (#5180)
* rtc: do not send lk.rtc. attributes to other participants

Older JS SDKs fire ParticipantAttributesChanged for each new remote
participant that carries a server-set lk.rtc. attribute, and some crash
on it. Drop those attributes from participant updates and the join
response for everyone except the receiver.

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

* rtc: strip lk.rtc. attributes for every receiver

Also drop them from the receiver's own info and from the room moved
response, so no client sees them.

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

* test: expect the join request time attribute to stay on the server

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

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-10 11:33:49 +05:30
Arunveer Sidhu 84aae1d100 fix: validate data track handle range in HandleUnpublishDataTrackRequest (#5163)
* fix: validate data track handle range in HandleUnpublishDataTrackRequest

HandlePublishDataTrackRequest rejects pub_handle 0 and values above 65535 with INVALID_HANDLE, but HandleUnpublishDataTrackRequest casts the wire uint32 to uint16 without the same check. A client sending pub_handle 65537 wraps to handle 1 and unpublishes its own valid data track instead of receiving an error. This adds the same range validation to the unpublish handler before the uint16 conversion, with the same INVALID_HANDLE reason and message as publish.
2026-11-09 11:37:30 -08:00
Raja SubramanianandClaude Opus 5.5 fc8104b412 rtc: skip a closing track when a republish reuses its client id (#5166)
* rtc: skip a closing track when a republish reuses its client id

A MediaTrack whose receiver closed stays in the published list until the
receiver close returns, and that close waits on the subscriber down track
flush. A republish of the same client id in that window was queued behind
the dying track and its media was matched to the dying track and dropped.

The client id lookups now skip a track that is not open, and the track
close handler re-sends TrackPublished only for a queued replacement.

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

* rtc: answer a queued replacement only once no open track holds its cid

Two tracks can hold the same client id while the older one finishes its
close. The older track's close callback answered a request queued behind
the open track, and the media of that request landed on the open track.

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

* rtc: release a replacement queued behind any cid of the closing track

AddTrack queues a request behind an open track that holds its cid by
signaling or SDP cid, but the close handler released only the entry under
the track's signaling cid. A request queued by SDP cid stayed queued.

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

---------

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-11-09 18:43:51 +05:30
Anunay Maheshwari 6087e6bef5 fix(rtc): don't miss publishing tracks on resume, and rewrite the opus answer fmtp by key (#5148)
* fix(rtc): look up pending before published tracks on resume so a moving track is not missed

* fix(rtc): rewrite the opus answer fmtp by key and drop the line when nothing remains

* chore(rtc): note why a track closed between the resume lookups reads as unknown

* test(rtc): keep the parked reader helper beside its only user in room_test

* fix(rtc): match the opus fmtp by exact payload type in the publisher answer
2026-11-06 15:41:27 +05:30
2d4bd8af55 rtc: disable transceiver reuse for all WebKit clients, incl. iOS (#5133)
* rtc: disable transceiver reuse for all WebKit clients, incl. iOS

#4474 turned off transceiver reuse on Safari because of an insertable
streams issue that can corrupt E2EE tracks. The check matched only a
browser name of exactly "Safari". The server's user agent parser reports
iPhone Safari as "Mobile Safari", WKWebView as "Mobile Safari
UI/WKWebView", and other iOS browsers as "Chrome Mobile iOS",
"Firefox iOS", "Edge Mobile" or an app name. All of these run on WebKit,
but they kept transceiver reuse.

Match any browser name that contains "safari", and any JS SDK client on
iOS. React Native, Swift and Flutter do not match. isSafari() and audio
RED are not changed.

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

* rtc: reuse isSafari() in isWebKit()

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

* rtc: use isWebKit() for audio RED support too

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

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: lukasIO <mail@lukasseiler.de>
2026-11-06 11:05:13 +01:00
Anunay Maheshwari beee7b0eaa fix(rtc): hold pendingTracksLock across both track lookups in mute and track updates (#5147)
* test(rtc): cover mute and track updates while a track moves to published

* fix(rtc): hold pendingTracksLock across both track lookups in mute and track updates

* fix(rtc): update queued replacements before the published track in mute and track updates
2026-11-06 12:55:44 +05:30
Anunay Maheshwari 0dd174b3ed fix(rtc): hold pendingTracksLock across both track lookups when configuring the publisher answer (#5146)
* test(rtc): cover the publisher answer while its track moves to published

* fix(rtc): hold pendingTracksLock across both track lookups when configuring the publisher answer
2026-11-06 03:23:26 +05:30
cnderrauber 22ba651703 Pick DTLS server role when ice-lite is enabled (#5143)
To speed up data channel and warp. Exclude sdks (unknown ||
esp32) that may have problem to support answer dtls server role.
2026-11-05 22:01:40 +08:00
cnderrauber e269e3e355 Update webrtc fork to dtls1.3 (#5142)
* Update webrtc fork to dtls1.3

* update dep

* Remove debug line

* Fix test
2026-11-05 18:20:18 +08:00
armaan4658 7da670eef7 rtc: read subscriber track settings under the lock in applySettings (#5126)
applySettings releases settingsLock before it computes the video layers,
then reads t.settings.Quality, Width, Height and Fps without the lock.
UpdateSubscriberSettings replaces t.settings under the lock, and the
debouncer and UpdateVideoLayer run applySettings on other goroutines, so
the reads race with the write. go test -race reports it on the pointer
and on the fields of the newly cloned settings.

Take the settings pointer while holding the lock and compute the layers
from that snapshot. UpdateSubscriberSettings always stores a fresh clone
and never mutates it, so the snapshot is safe to read after unlocking,
and all four values come from the same update.
2026-11-03 16:17:17 +05:30
lukasIOandClaude Opus 5.5 0d762b4e50 rtc: match publisher m-sections by mid, not by position (#5122)
* rtc: match publisher m-sections by mid, not by position

A client that stops a transceiver lets the next one recycle its m-line
(JSEP 5.2.2), so a new m-section can come before negotiated ones.
GetUnmatchMediaForOffer stopped at the last answered mid and missed it,
so its codec preferences were never applied.

Bump the protocol so clients know they can stop transceivers.

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

* Update protocol_version.go

* Remove comments from GetUnmatchMediaForOffer function

Removed comments explaining the GetUnmatchMediaForOffer function.

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-02 17:20:11 +01:00
armaan4658andClaude Opus 5.5 b7af480c2d rtc: reject AddTrack with a repeated video layer quality (#5115)
ValidVideoLayers checks that each layer's quality is in range but lets a
quality repeat. GetQualityForDimension uses the index into the sorted
layer sizes as the quality, so a list such as LOW, LOW, MEDIUM, HIGH maps
the largest size to index 3, which is OFF, and a subscriber asking for
that size receives no video.

Reject an AddTrack whose layer list repeats a quality. Each list (the
request's and each simulcast codec's) is checked on its own, so the same
qualities on the request and a codec are still accepted. With only three
qualities this also bounds a list to three layers.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-02 14:03:42 +05:30
Raja SubramanianandClaude Opus 5.5 94b5e9a4e5 rtc: stop TestPreferAudioCodecForRed from hanging on a stalled ICE write (#5119)
The test client pc gathered host candidates on every interface. On a
host with a network content filter, a STUN binding request can block
in sendto forever. The write runs inside the ICE agent taskloop, so
SetRemoteDescription and the next CreateOffer wait on that loop and
the package hits its timeout.

The test checks only SDP, so the client pc now gathers no host
candidates and neither agent sends a connectivity check.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-02 13:03:03 +05:30
Raja SubramanianandClaude Opus 5.5 8eb162f104 rtc: do not advertise a subscribed track the subscriber cannot decode (#5117)
* rtc: do not advertise a subscribed track the subscriber cannot decode

In single peer connection mode a subscriber offers a recvonly section with
its own codecs. If the published track uses a codec the subscriber did not
offer, DownTrack.Bind finds no match but returns nil, because returning an
error aborts the whole transport. pion then keeps the sender, so the answer
still carries the track msid and ssrc. The subscriber sees a short-lived
TrackSubscribed before the bind failure removes the track again.

Park such a sender before building the answer: drop its track so the
section answers inactive, then report the codec failure out of band so the
subscription manager unsubscribes without reentering negotiation.

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

* rtc: report codec mismatch via Handler, not the downtrack

Route the parked sender's failure through a new Handler method into the
participant, instead of reaching from transport into the downtrack. The
participant unsubscribes and reports the codec error. Keeps transport
free of the sfu package.

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

* rtc: use CodecsFromMediaDescription for the offered-codec check

Reuse the protocol sdp helper instead of hand-parsing rtpmap lines.

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

* rtc: reword codec-suppression comments

Describe it as a subscription, drop the stale prototype label.

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

* rtc: check every bindable codec before suppressing a sender

The check before the answer looked only at the primary codec. A subscriber
that offers a later upstream codec, for example Opus for a RED-first track,
lost a track that Bind can bind.

DownTrack.BindableCodecs returns the codecs Bind can pick, and both Bind and
the check use it. It also fixes the encrypted RED/Opus rule in Bind: the old
condition was never true, so an encrypted RED track could bind as Opus.

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

* rtc: keep published encrypted codecs bindable, record codec rejections

The encrypted RED/Opus rule cut every RED/Opus pair to the primary codec.
That also dropped a second codec the publisher sends on its own stream.
WrappedReceiver now decides which codecs bind: for an encrypted source,
only its published codecs, never the RED or Opus alternative it adds.

A sender parked before the answer now ends its subscription through the
same path as a bind error, so it records OnTrackSubscribeFailed.

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

---------

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
2026-11-02 12:32:28 +05:30
Raja SubramanianandClaude Fable 5.1 db2e810958 rtc: log the attributes of every data channel (#5116)
* rtc: log the attributes of every data channel

Both transports log "data channel open" at info with the channel's
label, id, ordered, maxRetransmits, maxPacketLifeTime, protocol and
negotiated, through one helper.

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

* paul feedback

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

---------

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-11-01 11:29:19 +05:30
Raja SubramanianandClaude Opus 5.5 9a26932591 Harden media and room handling against bad inputs and races (#5114)
* sfu: ignore a nil publisher sender report in the forwarder

A stream restart replaces the receiver stats between the sender report
callback and its read, so the report can be nil. SetRefSenderReport now
keeps the previous report instead of reading the nil one.

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

* dynacast: skip a codec regression when the target codec has no quality

HandleCodecRegression looked up the target codec after it released the
lock. If the manager closed in between, or the target mime type was
unknown, the lookup returned nil and RegressTo called Restart or Replace on
it. The target is now looked up with the source, and a missing one stops
the regression.

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

* service: create the internal record for a stored room that has none

RedisStore.LoadRoom returns a nil RoomInternal without an error when the
room exists but its internal field does not, for example after a delete
races a store. CreateRoom then wrote egress, agent, playout delay or sync
settings into the nil record. It now starts from an empty record, which
the store call writes back.

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

* sfu: drop a dependency descriptor whose chains do not match the structure

The parser takes a new structure from any packet, but DDForwarder keeps
the structure of the last packet it forwarded. When the publisher attached
a structure with fewer chains to a packet this downtrack dropped, the next
descriptor had fewer chain diffs than the forwarder's structure, and the
writer indexed past them. The forwarder now drops such a packet, and the
writer returns an error instead of indexing past the chain diffs.

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

* deps: bump mediatransportutil for the empty VP9 payload fix

A VP9 packet without a dependency descriptor and with a 1-byte payload such
as 0x08 parses to an empty VP9 payload, and IsVP9KeyFrame read its first
byte. mediatransportutil#106 returns false for an empty payload. This pins
the transport-v4 commit that carries it.

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

* sfu: keep the template test comment with its test

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

* dynacast: create the target quality only for a valid regression

A target quality starts a timer that notifies the publisher. Look it up
only after the source codec is found, so a rejected regression creates
nothing.

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

* service: restore the internal defaults for a room that lost them

A stored room without an internal record now gets the configured playout
delay and sync streams defaults. Its own settings, such as the empty
timeout and codecs, stay as stored.

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

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-31 19:29:11 +05:30
Raja SubramanianandClaude Fable 5.1 adb7cb4f29 rtc: hold unlabeled data for a participant whose reliable channel is opening (#5113)
An unlabeled data message sent to a participant without an unlabeled
channel is converted to a UserPacket and written to the reliable
channel. That write failed while the channel was still opening, and the
message was lost. The participant now builds the UserPacket and sends
it through SendDataMessage, which holds unsequenced reliable data until
the channel is writable. The transport keeps only the raw path.

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-31 16:16:57 +05:30
Raja SubramanianandClaude Fable 5.1 6b172bfb4a rtc: broadcast an unlabeled data message from a source identity (#5112)
* rtc: broadcast an unlabeled data message from a source identity

BroadcastDataMessageForRoomFrom takes the source ID and identity instead
of a LocalParticipant, so a caller can stamp the sender of a message
whose source is not on this node. BroadcastDataMessageForRoom keeps its
signature and calls it.

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

* rtc: say what sourceID does in the BroadcastDataMessageForRoomFrom comment

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

---------

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-31 15:33:34 +05:30
Raja SubramanianandClaude Opus 5.5 1681f36610 rtc: guard nil source in BroadcastDataMessageForRoom (#5110)
Relayed unlabeled data arrives with no local source participant, and
the sender identity lookup dereferenced it.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-31 13:16:19 +05:30
Raja SubramanianandClaude Opus 4.8 996b5bfb9a rtc: reject AddTrack with an out-of-range video layer mode (#5106)
A client sets SimulcastCodec.VideoLayerMode on AddTrack. Any value other
than MODE_UNUSED is used as-is, so a forged out-of-range value flows into
the forwarder. Reject it in ValidVideoLayers, alongside the quality check.

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
2026-10-30 20:37:35 +05:30
Raja Subramanian ebc71a6d11 rtc: reject AddTrack with an out-of-range video layer quality (#5102) 2026-10-30 02:16:04 +05:30
Paul Wells c3605dfa6c Sign refresh tokens with the join token's API key (#5088)
Refresh tokens were signed with the first configured key pair, which is
an arbitrary map entry when several keys are configured. Keep the join
token's API key on the participant and sign with it when its secret is
still configured, falling back to the first key pair otherwise.
2026-10-28 04:52:48 -07:00
Raja SubramanianandClaude Opus 5.5 2f7337b759 rtc: ignore server-owned video layer fields in AddTrack (#5087)
The server sets the spatial layer, rid, ssrc and repair ssrc of each
video layer from SDP and RTP. Clear these fields on AddTrack request
layers, including each simulcast codec's layers.

Clamp the layer in ReceiverBase.SetMaxExpectedSpatialLayer to
[InvalidLayerSpatial, DefaultMaxLayerSpatial].

Keep a client set video layer mode, but warn when it differs from the
server determined mode.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-28 16:23:52 +05:30
cnderrauber 37901309a3 Revert #5033 (#5077)
WHIP passthrough ingress has been failing DTLS
2026-10-27 21:04:38 +08:00
Raja SubramanianandClaude Opus 5.5 7c575a5c31 sfu: cap retransmissions per down track (#5054)
* sfu: cap retransmissions per down track (rtc.rtx config, off by default)

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

* sfu: rtx budget review fixes (sequencer undo, sent bytes, newest first, rtx_budget)

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

* sfu: rtx budget second review (order unchanged when off, keep NACK window, metric in down track)

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

* sfu: rtx budget sorts NACKs newest first by extended sequence number

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

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 11:05:54 +05:30
Raja SubramanianandClaude Opus 5.5 04f7cb71e3 rtc: fix flaky TestSetPermissionDataTrackSubscriptions (#5056)
* rtc: wait for the recorded data track subscription before revoking in test

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

* rtc: drop a subscription whose canSubscribe was revoked while it was in flight

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

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 11:05:33 +05:30
Raja SubramanianandClaude Opus 5.5 704c3280fe rtc: measure subscribe pacing delay in shadow (#5046)
* rtc: measure subscribe pacing delay in shadow

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

* prometheus: raise the subscribe pace shadow top bucket to 120 s

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

* rtc: pace video subscribes per node in shadow, record the wait only

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

* rtc: subscribe pacer doc wording, make the wiring test independent of timing

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

* rtc: sample shadow pacing at arrival, skip one-shot, keep sub-millisecond waits

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

* rtc: take the shadow pacing token before setup, in arrival order

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

* rtc: build shadow pacing buckets in one pass

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

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 16:17:12 +05:30
Raja Subramanian d8a4cdac11 Extend the TTL of data channel cache to 10s. (#5045)
To cover slow subscribers. Size still stays so that it does not grow
beyond a certain size.
2026-10-23 12:07:58 +05:30
6342d8fd1b Enable upstream FlexFEC03 (#4845)
* Add upstream FlexFEC recovery support

* Guard short TWCC extensions in FEC packets

* Release completed FlexFEC states

* Validate FlexFEC payload type range

* Invoke FEC callbacks after unlocking

* Reduce FlexFEC protection state allocations

* Avoid allocations for complete FlexFEC packets

* Optimize ordered FlexFEC packet insertion

* Reuse RTP packet storage for FlexFEC recovery

* Limit pending FlexFEC repair packets

* Lower FlexFEC repair window to two seconds

* Harden upstream FlexFEC handling

* Test FlexFEC with E2EE media

* Fix FlexFEC negotiation with libwebrtc publishers

* Enhance payload length validation in decoder

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

* remove the ability to configure payload type for FlexFEC

* moved some helpers into protocol

* Handle big gaps in media sequence numbers

Reset buffers when a big gap in media sequence numbers is detected.

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

* bump protocol & psrpc deps

* Handle FEC packet recovery failure

Increment FEC packets discarded counter and remove packet.

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

* do not NACK on fec recovered packet (#4896)

* do not NACK on fec recovered packet

* fix test race in CI

* Fix FEC write return after merging RTX feedback changes

* PR fixes for FlexFEC implementation (#4898)

* do not NACK on fec recovered packet

* refactor common code into unlockAndInvokeFECRecovery

* add FEC stats to RTPStats

* add log for when fecdecoder unavailable after creation

* rename markAsFECRepair to setFECRepairBufferLimit for clarity

* refactor packet generation for tests into util

* fix test race in CI

* move the unlocks back inline for readability

* update RTPstats

* Fix FEC write return after merging RTX feedback changes

* Use shared RTP packet helper in merged FEC NACK test

* Remove redundant return from FEC write handler

* packet post process (#5020)

* packet post process

* remove redundant writeRTX

* send out RTCP (NACK and RR) from packetPostProcess only

* handle FEC decoder on receiver restart (#5032)

* handle FEC decoder on receiver restart

* move onStreamRestartLocked into BufferBaseParams

---------

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Raja Subramanian <raja.gobi@tutanota.com>
2026-10-22 13:58:04 -07:00
Raja SubramanianandClaude Opus 4.8 22f91ce383 Align SFU RPC caller timeouts with client SDK (#5037)
Pick up protocol#1879 (round-trip 7s, default response 15s) so a
server-initiated PerformRpc tolerates the same ack and response windows
as the client SDK caller.

Also log an RPC response the v1 caller cannot decode (compressed_payload
or data-stream) instead of dropping it, which otherwise surfaces only as
a response timeout.

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
2026-10-21 12:55:11 +05:30
cnderrauber 19b6c60347 Pick dtls server role when ice-lite is enabled (#5033)
Speed up the connection with warp/negotiated data channel
2026-10-20 21:48:45 +08:00
Raja SubramanianandClaude Fable 5.1 65f0c01d15 Echo offered video payload types in single peer connection answers (#5031)
* Echo offered video payload types in single peer connection answers

restrictReceiverCodecsToPublishList pinned server payload types on a video
sender that had no media section yet. The later answer then ignored the
payload types the client offered, and Firefox never decoded the track.
Skip transceivers with an empty mid. Fixes #5030.

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

* Shorten the mid guard comment

Point at sendersPendingConfig, which already documents the rule.

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

---------

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-19 23:36:43 +05:30
cnderrauber 7f6224d823 Use constant data channel ids in proto (#5029)
Also don't create neogitated channels in migration case.
2026-10-19 19:41:05 +08:00