230 Commits

Author SHA1 Message Date
cnderrauber
1f1eeb6832 Fallback to servicestore if rpc is unavailable (#4391)
* Fallback to servicestore if rpc is unavailable

compatibility mode for #4387

* conf
2026-03-25 11:09:52 +08:00
cnderrauber
e963953817 Refine ipv6 support (#4352)
* Refine ipv6 support

* go mod

* check ipv4 is set in turn
2026-03-09 20:43:00 +08:00
cnderrauber
76a41a7a8c Generate config flags (#4268)
Fix #4262
2026-01-29 15:04:01 +08:00
Anunay Maheshwari
0c33b8c671 chore: move codecs/mime stuff to protocol (#4255) 2026-01-20 20:54:32 +05:30
Denys Smirnov
4ec0f8f4ce Support OpenTelemetry tracing. Add Jaeger support. (#4222) 2026-01-06 17:22:21 +02:00
Raja Subramanian
b8ddd0f98c Taking interface{} -> any modernize bits (#4204) 2025-12-28 05:22:12 +05:30
Jade Ellis
47c86be1df Add support for TURN static auth secret credentials (#3796)
Closes https://github.com/livekit/livekit/issues/2245
2025-12-18 14:16:38 +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
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
cnderrauber
54cf7d46c8 Control latency of lossy data channel (#4088)
* Control latency of lossy data channel

* remove log

* test
2025-11-18 16:30:16 +08:00
Alan Willard
a8d4df66f4 "Power of Two Random Choices" option for node selection (#3785)
* Added optional "Power of Two Random Choices" algorithm for the node selector sort_by feature. The current, default behavior of picking the lowest-valued node remains.
2025-10-08 15:31:01 -07:00
Paul Wells
060719d17d add config for user data recording (#3966)
* add config for user data recording

* missing file

* wire

* deps
2025-09-29 14:01:39 -07:00
Raja Subramanian
890fd94249 Single peer connection mode (#3873)
* WIP

* check using protocol version

* revert

* clean up

* sdp cid argument

* WIP

* WIP

* test

* clean up

* clean up

* fixes

* clean up

* clean up

* clean up

* conditional checks

* tests for both dual and single peer connection

* test

* test

* test

* type check

* test

* todo

* munges

* combined config

* populate mid

* limit to receive only

* clean up

* clean up

* clean up

* older test

* clean up

* alternative audio codec

* dtx

* don't need to copy

* Anunay feedback

* use the available peer connection

* publisher check

* WIP

* WIP

* WIP

* no mid

* media sections requirement

* mage generate

* WIP

* WIP

* set data channel receive size for test

* handle early media better

* WIP

* do not do ICERestart if no subscriber

* WIP

* WIP

* WIP

* WIP

* WIP

* WIP

* start up subscriber RTCP worker

* WIP

* WIP

* clean up

* clean up

* flag to indicate use of single peer connection

* remove unused interface method

* clean up

* clean up

* Jie feedback #1

* deps

* do not access subscriber in one shot mode

* more places for one shot mode

* more one shot fixes

* deps

* deps

* test
2025-08-28 12:16:18 +05:30
Paul Wells
8d270e2a0f chunk room updates (#3880)
* chunk room updates

* move to config

* typo

* default
2025-08-26 09:16:00 -07:00
Raja Subramanian
a370bb2054 Support G.711 A-law and U-law (#3849)
* More codecs

* clean up

* clean up

* add to unprocessed for nil mime type

* enhance tests to check for audio codec preferences also
2025-08-13 14:49:07 +05:30
cnderrauber
8c033ce9fe Enable H265 by default (#3773) 2025-07-01 14:58:09 +08:00
Anunay Maheshwari
3783ebb320 feat(cli): update to urfave/cli/v3 (#3745)
* feat(cli): update to urfave/cli/v3

* fix(cli/v3): int/uint handling with reflection

* fix(cli/v3): better type convertion handling
2025-06-20 16:58:44 +05:30
Raja Subramanian
a72ce30f50 Small changes to add/use helper functions for length checks. (#3704) 2025-06-06 18:00:10 -07:00
Paul Wells
13b55a80ad move agent token (#3669) 2025-05-15 10:30:14 -07:00
Paul Wells
c9385edd1e handle agent worker jwt (#3668)
* handle agent worker jwt

* test

* tidy

* tidy

* deps
2025-05-15 08:23:10 -07:00
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
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
b3779a9086 WebHookConfig (#3517)
* default webhook config

* WebHookConfig

* fix test

* protocol with yaml tags
2025-03-11 13:49:29 +05:30
Raja Subramanian
9551c52c85 Try 2 to consolidate mime type (#3407)
* Normalize mime type and add utilities.

An attempt to normalize mime type and avoid string compares remembering
to do case insensitive search.

Not the best solution. Open to ideas. But, define our own mime types
(just in case Pion changes things and Pion also does not have red mime
type defined which should be easy to add though) and tried to use it everywhere.
But, as we get a bunch of callbacks and info from Pion, needed conversion in
more places than I anticipated. And also makes it necessary to carry
that cognitive load of what comes from Pion and needing to process it
properly.

* more locations

* test

* Paul feedback

* MimeType type

* more consolidation

* Remove unused

* test

* test

* mime type as int

* use string method

* Pass error details and timeouts. (#3402)

* go mod tidy (#3408)

* Rename CHANGELOG to CHANGELOG.md (#3391)

Enables markdown features in this otherwise already markdown'ish formatted document

* Update config.go to properly process bool env vars (#3382)

Fixes issue https://github.com/livekit/livekit/issues/3381

* fix(deps): update go deps (#3341)

Generated by renovateBot

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Use a Twirp server hook to send API call details to telemetry. (#3401)

* Use a Twirp server hook to send API call details to telemetry.

* mage generate and clean up

* Add project_id

* deps

* - Redact requests
- Do not store responses
- Extract top level fields room_name, room_id, participant_identity,
  participant_id, track_id as appropriate
- Store status as int

* deps

* Update pkg/sfu/mime/mimetype.go

* Fix prefer codec test

* handle down track mime changes

---------

Co-authored-by: Denys Smirnov <dennwc@pm.me>
Co-authored-by: Philzen <Philzen@users.noreply.github.com>
Co-authored-by: Pablo Fuente Pérez <pablofuenteperez@gmail.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Paul Wells <paulwe@gmail.com>
Co-authored-by: cnderrauber <zengjie9004@gmail.com>
2025-02-10 10:44:15 +05:30
Pablo Fuente Pérez
b88de555bf Update config.go to properly process bool env vars (#3382)
Fixes issue https://github.com/livekit/livekit/issues/3381
2025-02-06 18:02:21 -06:00
cnderrauber
8fa1127724 Disable data channel throttle by default (#3281)
* Disable data channel throttle by default

* data race

* err type
2024-12-21 12:08:54 +08:00
cnderrauber
713e67cd52 Thottle the publisher data channel sending when subscriber is slow (#3255)
* Thottle the publisher data channel sending when subscriber is slow

Avoid the publisher overwhelm the sfu data channel buffer when
the subscriber has lower receive bitrates. It will drop message
if the subscriber is considered too slow to block the entire room.

* Enable nack in mediaengine and disable it in transceiver as need

pion doesn't support per transciver codec configuration, so the nack of this session will be disabled
forever once it is first disabled by a transceiver.
https://github.com/pion/webrtc/pull/2972
2024-12-18 10:51:34 +08:00
Raja Subramanian
789d0484e2 Add RTX to downstream (#3247)
* Add RTX to downstream

* test
2024-12-13 09:57:03 +05:30
cnderrauber
54f9f7de51 upgrade to pion/webrtc v4 (#3213) 2024-11-28 16:05:38 +08:00
Raja Subramanian
6509cdb5ea StreamAllocator (congestion controller) refactor (#3180)
* refactor WIP

* WIP

* compiling

* runlock

* fixes

* fmt

* stringer and unlikely logger

* clean up
2024-11-16 03:06:37 +05:30
Raja Subramanian
a3f2ca56f9 TWCC based congestion control - v0 (#3165)
* file output

* wake under lock

* keep track of RTX bytes separately

* packet group

* Packet group of 50ms

* Minor refactoring

* rate calculator

* send bit rate

* WIP

* comment

* reduce packet infos size

* extended twcc seq num

* fix packet info

* WIP

* queuing delay

* refactor

* config

* callbacks

* fixes

* clean up

* remove debug file, fix rate calculation

* fmt

* fix probes

* format

* notes

* check loss

* tweak detection settings

* 24-bit wrap

* clean up a bit

* limit symbol list to number of packets

* fmt

* clean up

* lost

* fixes

* fmt

* rename

* fixes

* fmt

* use min/max

* hold on early warning of congestion

* make note about need for all optimal allocation on hold release

* estimate trend in congested state

* tweaks

* quantized

* fmt

* TrendDetector generics

* CTR trend

* tweaks

* config

* config

* comments

* clean up

* consistent naming

* pariticpant level setting

* log usage mode

* feedback
2024-11-11 10:24:47 +05:30
Raja Subramanian
653857e42b Split out audio level config. (#3163)
* Split out audio level config.

Inline it in yaml as it is exposed/documented config.

* test

* default congestion control enable
2024-11-08 21:36:38 +05:30
Raja Subramanian
86383b2271 De-centralize some configs to where they are used. (#3162)
* De-centralize some configs to where they are used.

And make default variables.

Renaming a bit, but these are all internal config and have not been
added to documented config.

* Keep documented config as is.

* test

* typo
2024-11-08 12:47:30 +05:30
Paul Wells
24f3c93204 ignore unexported fields in yaml lint (#3145) 2024-10-29 12:16:21 -07:00
David Zhao
dd7cd7eafc Handle room configuration that's set in the grant itself (#3120)
* Handle room configuration that's set in the grant itself

* ensure refresh token contains updates

* deps

* dep

---------

Co-authored-by: Paul Wells <paulwe@gmail.com>
2024-10-21 23:31:12 -07:00
Paul Wells
10631e2de6 enable room creator service by default (#3043) 2024-09-25 19:08:17 -07:00
Raja Subramanian
7df6f86693 Initial plumbing for metrics. (#2950)
* Initial plumbing for metrics.

This implements
- metrics received from participant.
- callback to room.
- room distributes it to all other participants (excluding the sending
  participant).
- other participants forward to client.
- counting metrics bytes in data channel stats

TODO:
  - recording/processing/batching
  - should recording/processing/batching happen on publisher side or
    subscriber side?
  - should metrics be echoed back to publisher?
  - grants to publish/subscribe metrics.

* mage generate

* clear OnMetrics on close

* - CanSubscribeMetrics permission.
- Echo back to sender.

* update deps

* No destination identities for metrics

* WIP

* use normalized timestamp for server injected timestamps

* compile

* debug log metrics batch

* correct comment

* add baseTime to wire

* protocol dep

* Scope metrics forwarding to only participants that a participant is
subscribed to.

Also remove the participant_metrics.go file as it was not doing anything
useful.

* update comment

* utils.ErrorIsOneOf

* couple of more utils.CloneProto
2024-09-19 11:42:31 +05:30
Paul Wells
b63192a376 add config for signal retry (#2989) 2024-09-08 19:53:19 -07:00
Paul Wells
c371929535 add roommanager service (#2931)
* add roommanager service

* cleanup

* deps

* timeout

* cleanup

* cleanup

* config

* cleanup
2024-08-13 11:00:41 -07:00
Benjamin Pracht
73b3a91a5c Use RoomConfiguration message from protocol (#2882) 2024-07-19 13:54:33 -07:00
Raja Subramanian
09e3aef859 Check size limits on metadata and name set from client. (#2850)
* Send error response when update metadata fails.

Keeping it simple for the first implementation.
- Send error response only if request_id != 0
- Two kinds of errors notified
  o does not have permissions - NOT_ALLOWED
  o attributes exceeds size limits -  INVALID_ARGUMENT

* Check size limits on metadata and name set from client.

Added a name length limit also.

* check name length in service update participant path also

* limit check in limit config

* update protocol

* longer keys
2024-07-12 09:57:17 +05:30
Benjamin Pracht
32a4d03c9e Implement Agents protocol addition (#2786) 2024-06-27 19:20:52 -07:00
holzgeist
6523c9c099 Feat add prometheus auth (#2252)
* feat: add support for basic auth on prometheus

* fix: properly name middleware generator

* refactor: move all prometheus configs into common object

* chore: add suggestions from review

add back old config switch and print warning if it is used

* fix: undo accidental change

* fix: rebase/merge issue
2024-06-27 02:13:51 -07:00
David Zhao
7a774cc82a Support for participant attributes (#2806)
* Support for participant attributes

* move metadata setters to LocalParticipant

* address feedback

* forward error

* update go mod

* update attributes first
2024-06-19 23:14:19 -07:00
Paul Wells
58e365847b add test helper for config yaml tags (#2791)
* add test helper for config yaml tags

* deps

* cleanup

* cleanup
2024-06-13 23:22:39 -07:00
cnderrauber
e6aa36fdd6 Add forward stats (#2725)
* Add forward metrics

* ignore packets was not forwarded

* rename
2024-05-24 17:43:28 +08:00
Paul Wells
9a5db132eb add room/participant name limit (#2704)
* add room/participant name limit

* defaults

* simplify

* omitempty

* handle 0 config

* fix race

* unlock

* tidy
2024-05-06 17:25:18 -07:00
Mathew Kamkar
10c8582a6b get cpu stats from cgroup, remove env (#2636)
* get cpu stats from cgroup, remove env

* undo rand seed removal

* tests
2024-04-08 21:15:17 -07:00
Raja Subramanian
8852d71a8a Disable audio loss proxying. (#2629)
* Disable audio loss proxying.

Added a config which is off by default.
With audio NACKs, that is the preferred repair mechanism.
With RED, repair is built in via packet redundancy to recover from
isolated losses.
So, proxying is not required. But, leaving it in there with a config
that is disabled by default.

* fix test
2024-04-06 11:28:04 +05:30