Commit Graph

3164 Commits

Author SHA1 Message Date
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
ac8082fffb Use older SDP module to accommodate bad SDP. (#3578) 2025-04-05 12:55:39 +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
Raja Subramanian
13417c01c6 Send mute event only on change (#3537) 2025-03-19 19:22:49 +05:30
Denys Smirnov
7f4c4597f1 Stubs for SIP update API. (#3533) 2025-03-19 14:58:40 +02:00
Raja Subramanian
fe673bb257 Send regressed codec upstream stats to analytics. (#3532)
* Send regressed codec upstream stats to analytics.

There is more work to do for analytics for simulcast codec, i. e. when
both codecs are published. Shorter term, ensure that analytics are sent
for regressed codec if active.

* lock access to regressed codec received
2025-03-18 12:46:24 +05:30
Raja Subramanian
8eb81388e6 Use a generation to counter to stop key frame seeder on codec change (#3531) 2025-03-18 07:41:30 +05:30
Raja Subramanian
188470a24b Do not accept unsupported track type in AddTrack (#3530) 2025-03-17 12:28:00 +05:30
Raja Subramanian
507fc9cf76 Do not instantiate 0 sized sequencer. (#3529)
This happens due to improper track type.

One possible option is to check the mime type of the track and calculate
the size, but there are other places in the code which work off provided
track type. So, just doing a defensive fix. Have to review code for all
uses of type and how it affects things if client provides incorrect
type.
2025-03-17 10:31:32 +05:30
Raja Subramanian
20bddfea1e Clean up published track on participant removal. (#3527)
Clean up the tracks in the synchronous path and remove track from track
manager. This is not strictly required in a single node case. But,
multi-node needs this. So, doing this here for consistency.
2025-03-14 16:09:22 +05:30
Raja Subramanian
65d8aa2847 Handle subscribe race with track close better. (#3526)
There are two very very edge case scenarios this is triyng to address.

Scenario 1:
-----------
- both pA and pB migrating
- pA migrates first and subscribes to pB via remote track of pB
- while the above subscribe is happening, pB also migrates and
  closes the remote track
- by the time the subscribe set up completes, it realises that
  the remote track is not open any more and removes itself as
  subscriber
- but that removal is using the wrong `isExpectedToResume` as clearing
  all receivers has not run yet which is what caches the
  `isExpectedToResume`.
- That meant, the down track transceiver is not cached and hence not
  re-used when re-subscribing via pB's local track
- Fix it by caching the expected to resume when changing receiver state
  to `closing`.

Scenario 2:
-----------
- both pA and pB migrating
- pA migrates first and subscribes to pB via remote track of pB
- while the above subscribe is happening, pB also migrates and
  closes the remote track
- pB's local track is published before the remote track can be fully
  closed and all the subscribers removed. That local track gets added
  to track manager.
- While the remote track is cleaning, subscription manager triggers
  again to for pA to subscribe to pB's track. The track manager now
  resolves to the local track.
- Local track subscription progresses. As the remote track clean up is
  not finished, the transceiver is not cached. So, the local track based
  subscription creates a new transceiver and that ends up causing
  duplicate tracks in the SDP offer.
- Fix it by creating a FIFO in track manager and only resolve using the
  first one. So, in the above case, till the remote track is fully
  cleaned up, the track manager will resolve to that. Yes, the
  subscriptions itself will fail as the track is not in open state (i. e.
  it might be in `closing` state), but that is fine as subscription
  manager will eventually resolve to the local track and proper
  transceiver re-use can happen.
2025-03-14 14:37:37 +05:30
Raja Subramanian
a6cb00b31e Reduce seeder duration to 30s and also do not force send PLI. (#3525)
Can use the normal PLI throttle cadence.
2025-03-13 10:41:42 +05:30
Raja Subramanian
c823320528 Add a key frame seeder in up track. (#3524) 2025-03-12 22:11:27 +05:30
Raja Subramanian
0f61ff3a2f Remove redundant log (#3523) 2025-03-12 15:31:08 +05:30
Raja Subramanian
7685cd25fd Log ParticipantInit on signal start to get a picture of join params (#3522) 2025-03-12 14:55:16 +05:30
Paul Wells
ac9e62ef05 add server agent load threshold config (#3520)
* remove agent worker load threshold

* cleanup
2025-03-11 21:07:01 -07:00
Raja Subramanian
cd5d32f005 Add pID and connID to log context to make it easier to search using pID. (#3518) 2025-03-11 22:33:08 +05:30
shishirng
2d9aa6dde4 Update api call info method (#3515)
* register RequestRouted handler for updating method

Signed-off-by: shishir gowda <shishir@livekit.io>

* pass room to telemetry in DeleteRoom api to extract roomID

Signed-off-by: shishir gowda <shishir@livekit.io>

---------

Signed-off-by: shishir gowda <shishir@livekit.io>
2025-03-11 05:56:30 -04:00
Raja Subramanian
b3779a9086 WebHookConfig (#3517)
* default webhook config

* WebHookConfig

* fix test

* protocol with yaml tags
2025-03-11 13:49:29 +05:30
cnderrauber
6121b9af5e Check ForwardParticipant room name (#3514) 2025-03-11 10:07:05 +08:00
Raja Subramanian
9a7c944252 mediatransportutil update (#3511) 2025-03-10 21:28:03 +05:30
Raja Subramanian
50ab47c11b Log packet drops/forward. (#3510)
Seeing an error in an e2e test, after migration, no packets are
forwarded. The only reason seems to be payload type mismatch (assuming
there are no errors in the forwarding loop pulling packets from buffer).

So, logging some packet stats in forwarding loop.
2025-03-10 16:36:25 +05:30
cnderrauber
139d1b139c Add ForwardParticipant method to room service (#3507)
It returns unimplemented error now.
2025-03-10 14:08:38 +08:00
Raja Subramanian
6c04909f88 Use atomic to store codec. (#3505)
* Use atomic to store codec.

It can change on up stream codec change, but not seeing any racy
behaviour with atomic access.

Reverting the previous change to mute with this change.

* no mime arg
2025-03-09 11:51:48 +05:30
Raja Subramanian
7f6afe05ad Prevent bind lock deadlock on muted. (#3504)
Need to re-visit the bind lock scope and maybe make the codec/mime
atomic and access them without bind lock. But, doing a whack-a-mole a
bit first to move things forward. Will look at making them atomics.
2025-03-09 11:21:09 +05:30
Paul Wells
48063df5b8 load mime type before calling writeBlankFrameRTP (#3502) 2025-03-07 23:12:20 -08:00
Raja Subramanian
d2e6cd150e Do not bind lock across flush which could take time (#3501) 2025-03-08 11:13:35 +05:30
Denys Smirnov
47896f50e3 Update protocol and IO service. (#3499) 2025-03-08 01:19:42 +05:30
dependabot[bot]
1dc42eef9c Bump github.com/go-jose/go-jose/v3 from 3.0.3 to 3.0.4 (#3497)
Bumps [github.com/go-jose/go-jose/v3](https://github.com/go-jose/go-jose) from 3.0.3 to 3.0.4.
- [Release notes](https://github.com/go-jose/go-jose/releases)
- [Changelog](https://github.com/go-jose/go-jose/blob/main/CHANGELOG.md)
- [Commits](https://github.com/go-jose/go-jose/compare/v3.0.3...v3.0.4)

---
updated-dependencies:
- dependency-name: github.com/go-jose/go-jose/v3
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-03-07 19:33:03 +05:30
Raja Subramanian
3a35cbc401 Log migration complete only when coming from sync (#3496) 2025-03-07 19:02:39 +05:30