1459 Commits

Author SHA1 Message Date
Raja Subramanian
ee664e7adc Publish is always on publisher peer connection. (#4307) (#4308) 2026-02-10 14:15:16 +05:30
Raja Subramanian
f3e9b68854 Do not increase max expected layer on track info update. (#4285)
* Do not increase max expected layer on track info update.

When max expected layer increases, the corresponding trackers are reset
so that first packets from those layers can trigger a layer detected
change enabling quick detection of layer start.

A track info update changing max to what is in track info could set the
max expected to be higher without resetting the tracker. And that would
cause dynacast induced max layer change to miss tracker reset too.

Sequence
- dynacast sets max expected to 0
- track info update sets it to 2
- dynacast sets it to 1 --> this should have reset tracker on layer 1,
  but because it is less than current max (2), it is skipped.

* thank you CodeRabbit

* force update on start
2026-02-04 12:19:41 +05:30
Raja Subramanian
d2bae34d53 refresh telemetry guard on participant move (#4280) 2026-02-03 15:34:16 +05:30
Raja Subramanian
d1bab17b76 Add session duration and participant kind to closing log. (#4277)
To allow using "participant closing" log entry for calculating things
like session duration by paricipant kind or some other client SDK based
attribute.
2026-02-03 07:07:24 +05:30
Raja Subramanian
1e689e1a24 Reducing some info level logs. (#4274)
* Reducing some info level logs.

Also, relaxing the check for runaway RTCP receiver report to allow for
rollover to catch up if it is not too far away.

* set logger
2026-02-02 10:54:03 +05:30
Paul Wells
700e1788f2 require participant broadcast when metadata/attributes are set in token (#4266) 2026-01-26 14:22:30 -08:00
cnderrauber
b61799ecd8 Ignore parse addr error when add remote candidate (#4264) 2026-01-26 14:37:02 +08:00
Anunay Maheshwari
0c33b8c671 chore: move codecs/mime stuff to protocol (#4255) 2026-01-20 20:54:32 +05:30
Raja Subramanian
f867550716 Do not remove participant from cache on disconnect. (#4241)
Resuming participants need to know about participants disconnected
during resume.

Reverts https://github.com/livekit/livekit/pull/4234
2026-01-14 20:18:58 +05:30
Raja Subramanian
a35a6ae751 Add participant option for data track auto-subscribe. (#4240)
* Add participant option for data track auto-subscribe.

Default disabled.

* protocol update to use data track auto subscribe setting

* deps
2026-01-14 13:22:43 +05:30
Raja Subramanian
a05690d2b2 Changing field naming of data track packet (#4235)
S, F -> Start, Final of frame

changed from

F, L -> First, Last of frame as `F` could be interpreted as `Final`
also.
2026-01-13 09:42:53 +05:30
Raja Subramanian
c40150085a Clear participant version cache on disconnect (#4234)
* debug participant update

* more debug

* context logger

* log participant info

* more logging

* clear participant cache on disconnect

* clean up

* clean up
2026-01-13 09:36:09 +05:30
Raja Subramanian
ac20ccda53 Log timeout in API. (#4231)
* Log timeout in API.

* make a reset function
2026-01-12 11:22:39 +05:30
Raja Subramanian
541a7d6c5b Change some logs to debugw (#4229) 2026-01-09 16:11:54 +05:30
Raja Subramanian
dafdc36e3e Add option to force simuclast codec. (#4226) 2026-01-08 02:13:03 +05:30
Raja Subramanian
335f4c33fb Swap result sink atomically rather than closing and setting. (#4216)
To prevent WriteMessage after Close potentially.
2026-01-03 03:17:58 +05:30
Raja Subramanian
08ac4ecdc5 Support preserving external supplied time. (#4212)
In some paths, it is better to preserve pre-recorded time. So, make the
base implementations preserve the RTCP Sender Report receive time.

Also, add a method to enable forwarding packet arrival time. Could be
used across relay.
2025-12-31 14:41:59 +05:30
cnderrauber
f6efccce25 report video size from media data for whip (#4211) 2025-12-31 15:52:10 +08:00
Raja Subramanian
08793bea89 Use active at time to check for track not bound timeout. (#4206) 2025-12-29 20:32:08 +05:30
Raja Subramanian
3606ce542f Do not warn about track not bound if participant is not ready. (#4205)
Analysed half a dozen cases and all of them were due to participant is
not active yet.

Also, some misc logging changes.
2025-12-29 18:16:11 +05:30
Raja Subramanian
b8ddd0f98c Taking interface{} -> any modernize bits (#4204) 2025-12-28 05:22:12 +05:30
Raja Subramanian
bb00c86489 Restart API on receiver. (#4200)
Can be used when track moves forward/backward.
2025-12-27 03:42:23 +05:30
Raja Subramanian
2510b9462e Taking a bunch of go modernize suggestions. (#4194)
This is not all of it as it is not possible (or at least I do not know
of a way) to get all suggestions for a repo/project. Did this via loop
searching mainly and taking the modernize suggestions.
2025-12-25 16:55:58 +05:30
Raja Subramanian
ed8e6afcd7 Handle repair SSRC of simulcast tracks during migration. (#4193)
* Handle repair SSRC of simulcast tracks during migration.

* fix

* fix comment
2025-12-25 14:45:48 +05:30
Raja Subramanian
8b0efb8c89 Resolve RTX pair via OnTrack also. (#4190)
* Resolve RTX pair via OnTrack also.

In simulcast probing path, the interceptor chain is not invoked
for primary stream. Not sure if this is a recent change. Due to this,
the RTX pair does not get resolved.

Use the onTrack callback to resolve the pair.

* remove debug
2025-12-24 15:27:13 +05:30
Raja Subramanian
7c8ea11505 Refactor receiver and buffer into Base and higher layer. (#4185)
* Refactor receiver and buffer into Base and higher layer.

To be able to share code/functionality with relay.

* WIP

* WIP

* WIP

* WIP

* WIP

* WIP

* WIP

* WIP

* clean up

* deps

* fix test

* fix test
2025-12-23 21:35:48 +05:30
Raja Subramanian
1df1316b85 Move OnDataTrackMessage to participant listener to support replay. (#4178) 2025-12-19 13:08:44 +05:30
Raja Subramanian
e7601251bc Make data message naming a bit more consistent. (#4177)
* Make data message naming a bit more consistent.

OnDataPacket and OnDataMessage half-way in the chain made it confusing
(for me at least). Use same name throughout.
API still uses SendDataPacket, but that is not harder to read.

* test
2025-12-19 12:09:16 +05:30
Raja Subramanian
a04e566dbf Use published track for model access in data down track. (#4176)
* Use published track for model access in data down track.

No need to pass in the model.

* implementation type assertion

* remove redundant log key

* one more type

* Close interface method

* clean up redundant log key

* remove unused method

* some interface changes to support data tracks in replay

* correct mock signature
2025-12-19 11:00:18 +05:30
Raja Subramanian
cbb2c61787 Publish/Unpublish counter match. (#4173)
Published counter was bumped up only when not migrating in, but it was
decremented when a migrating participant leaves without expectation to
resume. That could have resulted in negative counts.

Always change counters irrespective of migration or expected to resume
on leave. Control events send based on migration/resume.
2025-12-18 10:16:27 +05:30
Raja Subramanian
5c841b8ea1 Some logging changes. (#4168)
* Some logging changes.

Trying to chase a case of large sequence number gap on subscriber side
where packets are sent after a long time.

* return values instead of logging
2025-12-17 18:05:29 +05:30
Raja Subramanian
5964efbba5 Ensure subscribe data track handles are unique (#4162) 2025-12-16 13:52:05 +05:30
Raja Subramanian
a26c48304a Add support for RTP stream restart. (#4161)
* Add support for RTP stream restart.

When an unhandled packet is encountered, try a restart sequence.
Restart happens when 5 packets with contiguous sequence numbers and same
or increasing time stamps are received. Note that this does not work for
B-frame type of scenarios, but that is true for receive path handling
even before this. As WebRTC does not use B-frames, it is fine. But,
needs to be looked at again if B-frames are necessary.

It is controlled by a config that is disabled by default.

* clean up

* debug log
2025-12-16 13:21:39 +05:30
Raja Subramanian
386f0b3822 fix typo in clearing index when removing track from room track manager (#4158) 2025-12-14 19:57:39 +05:30
Paul Wells
0abfb2515c deregister observability function when participant is closed (#4157)
* deregister observability function when participant is closed

* tidy
2025-12-14 04:21:07 -08:00
Raja Subramanian
2317c29531 Fix panic while removing track from room track manager. (#4153)
Cannot range and use `slices.Delete` in the loop.
2025-12-12 14:19:18 +05:30
Raja Subramanian
a0a28ac5e3 Avoid duplicate track add to room track manager. (#4152)
* Avoid duplicate track add to room track manager.

Don't have proof that this happens, but in the leak chase, this is
another component at room level and holds references to tracks. Guessing
this is not cleaning tracks till room is closed.

* add a report
2025-12-12 12:42:04 +05:30
changgesi
d7db7cb389 chore: fix a large number of spelling issues (#4147)
Signed-off-by: changgesi <changgesi@outlook.com>
2025-12-11 09:34:13 +05:30
Raja Subramanian
64f3d1e972 switch participant callbacks to room to listener interface (#4136)
* switch participant callbacks to room to listener interface

* mage generate

* clean up

* clear listener

* clean up

* use interface in up data track manager

* tweaks

* Paul feedback - should reduce the diff as this keeps the room handlers as is except making methods for a couple of anonymous handlers

* clean up
2025-12-08 15:59:45 +05:30
Raja Subramanian
8c241ecf12 Fix RTCP reader leak in DownTrack. (#4131)
When a participant is closing, RTCP readers should be cleaned up from
factory even if the participant is expected to resume. The resumed
participant will be a new participant session and peer connection(s) and
everything will be set up again.
2025-12-06 17:49:23 +05:30
Raja Subramanian
3eef869a68 Do not pause rid in SDP (#4129) 2025-12-05 15:57:31 +05:30
Raja Subramanian
7c1a0fab7c Fix concurrent map access. (#4127)
https://github.com/livekit/livekit/issues/4126
2025-12-05 10:48:10 +05:30
Raja Subramanian
14446b1cc1 Let participant close remove the published tracks. (#4125) 2025-12-04 22:37:08 +05:30
Raja Subramanian
7954748d7a Data tracks (#4089)
* WIP

* WIP

* Starting to add some signalling integration testing.

* Working tests.

* fix tests

* Forward data packets (#4096)

* WIP commit

* WIP

* WIP

* fix forwarding

* address PR comments

* move some methods from LocalParticipant to Participant interface

* handle subscription update

* add extensions and tests

* more packet tests

* add test for replace extension and fix a bug

* update protocol and add config
2025-12-04 10:44:34 +05:30
Raja Subramanian
0a2943bbc5 Clean up bits added to debug peer connection close hang. (#4114) 2025-11-28 10:30:39 +05:30
Raja Subramanian
bd5382daaa Splitting transport close timeout logs. (#4108)
After adding more fields in
https://github.com/livekit/livekit/pull/4105/files, it was not even
logging. Access to one of the added fields must have ended up waiting on
a lock and blocked.

Unfotunately, the deadlock fix in https://github.com/pion/ice/pull/840
did not address the peer connection close hang.

Splitting the logs so that the base log still happens. Ordering after
looking at the code and guessing what could still log to see if we get
more of the logs and learn more about the state and which lock ends up
the first blocking one.
2025-11-27 10:02:01 +05:30
Raja Subramanian
a6418ae219 Log more peer conenction state on close timeout. (#4105) 2025-11-26 19:58:31 +05:30
Raja Subramanian
06d999748f Check for cancel on unsubscription/source track going away. (#4104) 2025-11-25 21:32:21 +05:30
Raja Subramanian
7f10e18bac Record join/publish/subscribe cancellations. (#4102)
To get better picture of success/failure rate.
2025-11-25 14:06:02 +05:30
Raja Subramanian
402936324c Clear stereo=1 if stereo is not enabled. (#4101) 2025-11-24 21:31:56 +05:30