Commit Graph

2615 Commits

Author SHA1 Message Date
Raja Subramanian
2f002388b6 Use participant close reason in remove. (#3639) 2025-05-05 11:50:53 +05:30
Raja Subramanian
58822c26ab Include clientInfo in connectivity logs. (#3638)
Makes it easier for log based filtering.
2025-05-05 10:44:17 +05:30
Raja Subramanian
6d6393a6e0 Take AudioFeatures from AddTrack. (#3635)
* Take AudioFeatures from AddTrack.

* use slices.Compact

* feedback

* remove early bail
2025-05-01 13:53:09 +05:30
Raja Subramanian
086704128c Limit buffer queue before Bind. (#3634)
* Limit buffer queue before Bind.

* more generic
2025-05-01 13:49:06 +05:30
Raja Subramanian
9f5bc9b9b5 Avoid synthesising duplicate feature. (#3632) 2025-04-30 17:52:26 +05:30
cnderrauber
847239c3f2 Disable vp9 for safari 18.4 (#3631)
* Disable vp9 for safari 18.4

safari 18.4's svc encoding is broken

* more flex on test timeout
2025-04-29 13:17:39 +08:00
Raja Subramanian
f69ab68045 Populate the sender identity when translating to user packet. (#3628) 2025-04-25 23:44:43 +05:30
Raja Subramanian
e14905581c Forward data between WHIP client and non-WHIP client (#3627)
* Forward data between WHIP client and non-WHIP client

* fix test
2025-04-25 23:20:08 +05:30
Raja Subramanian
6739e7bcc8 Broadcast inside lock (#3626) 2025-04-25 12:21:30 +05:30
Raja Subramanian
f24152b4c0 Call Broadcast in lock scope. (#3625)
* Call Broadcast in lock scope.

Seems like there is a possible window where things can hang forever
if a goroutine enters the Wait) after the lock is released but before
Broadcast gets called, it will never see that broadcast and will hang forever.

* RLock
2025-04-25 12:12:10 +05:30
Raja Subramanian
b760918a0d Use logger from request context. (#3623)
That will have projectID and can potentially be used for project level
logging if we are able to pass around the project logger more.
2025-04-24 11:34:16 +05:30
Raja Subramanian
34a2e2c107 Check for multiple layers for managed track. (#3622)
The previous check was checking only for simulcast and would have made a
screen share track published with multiple layers using SVC as
unmanaged.
2025-04-24 10:02:38 +05:30
Andrea Lovicu
4955ebe423 Forward transfer headers to internal request (#3615)
This patch ensures that SIP headers provided in TransferSIPParticipantRequest requested by an agent are correctly forwarded to the internal SIP transfer request.

Previously, req.Headers was accepted but never passed along, causing headers from the initiating agent to be dropped.

This change adds a single line to include req.Headers in the internal request.
2025-04-22 11:43:23 -07:00
Raja Subramanian
d9ee921445 Set up RTX for WHIP publish (#3619)
* Set up RTX for WHIP publish

* bail early on error
2025-04-22 23:12:41 +05:30
Raja Subramanian
d8cf54399f Determine TURN connection type and no fallback for TURN/TLS. (#3612) 2025-04-22 11:42:05 +05:30
Raja Subramanian
d0d212fd13 Fix WHIP ICE restart. (#3616)
* Fix WHIP ICE restart.

Need to wait for candidates to be gathered.

Also, resettig ICE connection details on ice restart.

* deps
2025-04-18 01:31:56 +05:30
Benjamin Pracht
28dfac14e0 Use exported GetEgressNotifyOptions (#3604) 2025-04-11 09:45:27 -07:00
Raja Subramanian
2130980d17 Add basic video support to WHIP. (#3602)
Tested with eyevinn client.

There are a few issues to figure out still
1. Simulcast - how?
2. For simulcast, how to know width, height so that adaptive stream can
   work.
3. The layer added is dummy. It works, but connection quality scoring
   would be incorrect (will always say excellent) without bitrate.

Will need some dynamic update of `TrackInfo` based on actual stream for
all of this to fit well into our system, but the simple video support
works for now.
2025-04-11 13:07:47 +05:30
Benjamin Pracht
e5cbb22777 Allow specifying extra webhooks with egress requests (#3597) 2025-04-09 16:20:21 -07:00
Raja Subramanian
7e16106a0e Add OnSubscirberReady callback on LocalParticipant. (#3600)
Was setting the state to ACTIVE prematurely to enable the subscription
inter-lock in one shot signalling mode. But, that is incorrectly
changing state.

Use a callback to indicate subscriber ready and let the participant
ACTIVE happen when the connection actually establishes.
2025-04-09 15:02:27 +05:30
cnderrauber
5c2d96b9d3 Check DestinationRoom of VideoGrant for participant forwarding (#3599) 2025-04-09 15:13:29 +08:00
Raja Subramanian
2e236a193e Revert participant state ACTIVE change. (#3598)
Had made the change to align `participant active` to after the ICE
connection is done and that log could list all candidates.

But, with one shot signalling, the state change has to be early to wait
on (auto) subscriptions of track of other participant. So, state has to
be changed early.
2025-04-09 12:12:56 +05:30
Raja Subramanian
35ac5f561a Add support for WHIP ICE Trickle/Restart. (#3596)
* Add support for WHIP ICE Trickle/Restart.

Tested a bit using the WHIP client at https://github.com/Eyevinn/whip,
but needs a lot more testing. ICERestart is not tested yet.

* comment

* clean up
2025-04-09 00:20:58 +05:30
Denys Smirnov
ec2dff96a3 Fix SIP updates when replacing slices. (#3592) 2025-04-08 17:39:16 +03:00
Raja Subramanian
e24fe77bc7 map PEER_CONNECTION_DISCONNECTED -> CONNECTION_TIMEOUT (#3591) 2025-04-08 00:00:10 +05:30
Raja Subramanian
6ee6eb43fc Do not drop audio codecs (#3590) 2025-04-07 22:29:43 +05:30
Raja Subramanian
68357ba60a List audio codecs after video codecs. (#3589) 2025-04-07 21:38:56 +05:30
Raja Subramanian
05a891ffdb Fix rule (had an extra bracket) (#3588)
Also, add Opus
2025-04-07 19:07:52 +05:30
Raja Subramanian
d7c410910f Exclude RED from enabled codecs for Flutter + 2.4.2 + Android. (#3587)
* Exclude RED from enabled codecs for Flutter + 2.4.2 + Android.

That causes client to get confused and generate invalid SDP.

Also make SDK version rule check based on semantic versioning compare.

* deps
2025-04-07 14:47:03 +05:30
Paul Wells
ee08aede5b skip out of order participant state updates (#3583)
* skip out of order participant state updates

* avoid nil last active pointer

* cleanup

* protect state change callbacks

* gen

* test
2025-04-06 06:44:50 -07:00
Raja Subramanian
15a8d9a266 Break track published fuse when there are no tracks (#3581)
* Break track published fuse when there are no tracks

* use a goroutine to break the fuse

* safety net

* comment
2025-04-05 22:47:23 +05:30
Raja Subramanian
35f83c515b Replace Promise with Fuse. (#3580) 2025-04-05 16:27:13 +05:30
Raja Subramanian
07fe9b7241 Prevent migration race. (#3579)
* Prevent migration race.

Comments in code. Briefly, due to race, the remote participant/track
could be closed early leading to missing subscription post-migration.

* fixes
2025-04-05 16:12:25 +05:30
Raja Subramanian
1c8307c72c Use cgroup for memstats. (#3573)
* Use cgroup for memstats.

* deps
2025-04-05 11:54:36 +05:30
Raja Subramanian
e9be0fca54 log SDP offer on error (#3577)
* log SDP offer on error

* use util
2025-04-05 02:07:00 +05:30
Raja Subramanian
3238ab8d77 Calculate rates for memory used and total. (#3570)
Calculating rate for total does seem odd, but keeping it consitent/lined
up with used memory calculation.
2025-04-02 10:23:38 +05:30
Raja Subramanian
d08487bf83 Unlabeled (pass through) data channels. (#3567)
* Unlabeled (pass through) data channels.

Support data channels than can pass through raw data without any LK
protocol marshaling/unmarshaling.

* statischeck

* test

* error -> warn

* reset data message callback
2025-04-01 21:59:31 +05:30
Anunay Maheshwari
52ce18d56e fix: revert recent changes to determine simulcast from sdp (#3565)
* Revert "Audio uses signal SignalCid and SdpCid. (#3564)"

This reverts commit cdfbb106d1.

* Revert "Keep simulcast information tied to receiver. (#3563)"

This reverts commit ed5e2f16b2.

* Revert "chore(logs): log VLS type for VP9/AV1 (#3561)"

This reverts commit ad010cfc43.

* Revert "fix(video): determine svc/simulcast from SDP for advanced codecs (#3549)"

This reverts commit 15f565510c.

* chore(deps): update protocol
2025-03-31 23:15:44 +05:30
Raja Subramanian
cdfbb106d1 Audio uses signal SignalCid and SdpCid. (#3564)
This is a bit annoying and painful. Audio does not have the information
in the track info (because it does not use Codecs, it should probably at
some point to make it consistent).
2025-03-31 21:16:11 +05:30
Raja Subramanian
ed5e2f16b2 Keep simulcast information tied to receiver. (#3563)
* Keep simulcast information tied to receiver.

`simulcast` flag in `TrackInfo` is at track lavel. With codec simulcast,
the primary codec (in most cases) is SVC and the backup codec is
simulcast. Back up codec publish changing the track info setting to true
meant that the primary receiver was treated as simulcast if a subscriber
for primary codec joined after the backup codec was published.

Keep track of simulcast flag in receiver.

Also, TrackInfo Cids are from signal. So, keep track of SDP cids
separately. The `simulcastTrackIds` map uses SDP cid. Clean up by all
the SDP cids of a track

* clean up

* clean up

* clean up

* clean up

* test

* Store SdpCid and IsSimulcast in Trackinfo

* clean up

* mock
2025-03-31 19:25:57 +05:30
Anunay Maheshwari
ad010cfc43 chore(logs): log VLS type for VP9/AV1 (#3561) 2025-03-31 12:11:08 +05:30
Raja Subramanian
8cc17f8f8b Rework node stats a bit. (#3555)
* Rework node stats a bit.

Related protocol PR - https://github.com/livekit/protocol/pull/1023

- Make a config for node stats measurements. Wanted to put the config in
  `routing` package, but a circular dependency forced me to put in
   config.go
- Make rate calculations explicit, i. e. requested via config.
  Previously, it had some odd checks to decide when to calculate rate
  and it would have been calculating over different windows.
- Report signal/data channel bytes every 5 seconds to stats collection
  module. Previously, it was doing it every 30 seconds and that meant
  some windows could have had a large spike
  NOTE: Still need to think about this for load calculations as a large
  number of participants leaving could flush in a small window and that
  could report a large spike in bytes/packets. Maybe need to ignore
  signal bytes for load calculation?

* deps

* use default node stats config if given config is nil

* split out node stats into a struct for re-use

* update config
2025-03-27 12:42:19 +05:30
Anunay Maheshwari
15f565510c fix(video): determine svc/simulcast from SDP for advanced codecs (#3549)
* fix(video): determine svc/simulcast from SDP for advanced codecs

* fix(explicit-svc): cleanup

* fix(explicit-svc): remove from list on close/remove

* fix(explicit-svc): reorder VLS selection, cleanup

* fix(explicit-svc): todo comments for temporal layer selector

* fix(explicit-svc): remove from simulcastTrackIds even if client does not support unpublish
2025-03-26 16:22:32 +05:30
cnderrauber
2b6a46f402 Handle prefer_regression for backup codec (#3554) 2025-03-26 16:27:50 +08:00
Raja Subramanian
b0abb0ae6e Add option to use different pacer with send side bwe. (#3552)
Seeing a lot of queuing delay based back offs. Trying a couple of things
1. Accept a bit more queuing.
2. An option to try a different pacer. Would like to try with pass
   through. That will produce some out-of-order packets. Remains to be
   seen if it will have a negative impact.
2025-03-25 12:57:42 +05:30
Raja Subramanian
26822b6b49 ParseUsername utility for TURN user name. (#3547)
* ParseUsername utility for TURN user name.

NOTE: There is no state, so no need for struct method, but just doing it
similar to CreateUsername which also does not have state, but uses
struct method.

* missed base62 decode
2025-03-22 13:16:13 +05:30
Raja Subramanian
55909ed7c4 log the initial join response (#3546) 2025-03-22 11:06:05 +05:30
Soungmin Son (Eddy)
97fcb82a77 Fix: Return NotFoundErr instead of Unavailable when the participant does not exist in UpdateParticipant. (#3543)
* Check if Participant exists when update metadata

* Change Test cases

* type smuggle oss participant check into roomstore

* tidy

---------

Co-authored-by: Paul Wells <paulwe@gmail.com>
2025-03-20 23:56:34 -07:00
Denys Smirnov
75d0e18e4a Implement SIP update API. (#3141) 2025-03-20 18:37:33 +02:00
cnderrauber
e118aff125 Fire track subscribed when the subscriber connected (#3540) 2025-03-20 17:47:21 +08:00