Commit Graph

155 Commits

Author SHA1 Message Date
Raja Subramanian
49b75e94a6 Consolidate operations on LocalNode. (#3140) 2024-10-25 18:57:23 +05:30
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
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
1436a1f186 driveby cleanup (#3017)
* driveby cleanup

* test
2024-09-18 00:45:55 -07:00
David Zhao
50576b503e Handle trailing slashes in URL (#2988)
When a user includes a trailing slash in LIVEKIT_URL, it would produce
double slashes in the path, i.e. `https://myhost.livekit.cloud//twirp/RoomService.ListRooms`

Currently the server will send a 302 MOVED response, causing Twirp requests to fail.

We now remove the double slash in front within the middleware.
2024-09-07 11:30:24 -07:00
David Zhao
91cb4369ef Standardize twirp hooks during server init (#2959) 2024-08-26 00:53:13 -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
Raja Subramanian
bd616d6074 Split ICE candidate queue. (#2885)
Shared ICE candidate queue meant only one of PUBLISHER/SUBSCRIBER pc got
final candidate notification. Split the queue.
2024-07-20 10:25:06 +05:30
Paul Wells
c905336fec mark final ice candidate (#2871)
* add IsFinal flag to last ice candidate

* deps
2024-07-16 09:50:55 -07:00
Benjamin Pracht
a9aa65fdc6 Remove unused fields from RegisterWorkerRequest (#2866) 2024-07-15 15:22:20 -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
fb7eb3450e Update agents service to updated protocol (#2837)
- Deprecate namespace field
- Restore former semantic of starting a job for each registered namespace, for a given Agent Name
- Add agentName field
- Use "dispatcher" naming convention
2024-07-08 17:09:11 -07:00
Benjamin Pracht
32a4d03c9e Implement Agents protocol addition (#2786) 2024-06-27 19:20:52 -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
f1886ece42 update protocol (#2760)
* update protocol

* deps
2024-06-05 19:46:34 -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
Théo Monnom
dc67f505a5 agent service: new protocol & namespaces (#2545)
* initial worker impl

* fix test

* fix build

* TestAgentNamespaces

* log err

* nit cmt

* TestAgentMultiNode

* Update pkg/agent/worker.go

Co-authored-by: David Zhao <dz@livekit.io>

* retry on worker selection & fix review comments

* Update roommanager.go

* license

* use testutils.WIthTimeout

* abstract namespace/enabled logic into agent.Client, incrementally dispatch

* typos and dates

* lock

* timeout is now optional

* pass in topics instead of fixed

* handler handles connections

* onIdle, numConnections

* fix WithGrants

* update protocol

* check agent client

* broadcast after unlock

* fix data race

* remove ReadChan, fix dispatcher

---------

Co-authored-by: David Zhao <dz@livekit.io>
Co-authored-by: David Colburn <xero73@gmail.com>
2024-04-03 15:25:42 -07:00
Denys Smirnov
1d920ae488 Support SIP DTMF data messages. (#2559) 2024-03-14 17:23:43 +02:00
David Zhao
8371848747 Version 1.5.3 (#2489)
* Version 1.5.3

* add missing copyright notices

* update protocol for redis.tls YAML keys
2024-02-17 12:37:15 -08:00
Raja Subramanian
c8b7d486b9 Do not synthesise DISCONNECT on session change. (#2412)
* Do not synthesise DISCONNECT on session change.

v12 clients can handle session change based on identity.

* change for testf

* Squelch participant update if close reason is DUPLICATE_IDENTITY.

* fix test

* comment

* Clean up participant close reason a bit

* fix test

* test
2024-01-31 11:36:50 +05:30
Paul Wells
0be241eed8 refactor transport callbacks as interface (#2423)
* refactor transport callbacks as interface

* test
2024-01-28 21:35:25 -08:00
Raja Subramanian
d3da94c45e Augment LeaveRequest with alternate regions to connect. (#2408)
* Augment LeaveRequest with alternate regions to connect.

* update protocol and issue resume action on close if expected to resume

* use current protocol in tests

* address feedback
2024-01-25 22:22:46 +05:30
Paul Wells
3f2f850bdb clean up legacy rpc (#2384)
* clean up legacy rpc

* cleanup

* cleanup

* cleanup

* tidy

* cleanup

* cleanup
2024-01-14 01:49:26 -08:00
Paul Wells
5dda31d42d register one job per test agent worker (#2232) 2023-11-09 01:31:00 -08:00
David Colburn
57643a42ed Agents enabled check (#2227)
* agents enabled check

* participant -> publisher

* nil check client

* add NumConnections

* add lock around agent check

* do not launch agents against other agents

* regen

* don't need atomic anymore

* update protocol
2023-11-07 19:19:07 -08:00
David Colburn
60374c6402 Agents (#2203)
* agents

* add test

* undo name changes

* remove debug logs

* fixes

* fix data race in test
2023-11-03 11:43:35 -07:00
cnderrauber
9b9298b927 Add batch i/o to improve throughput (#2033)
* Add batch i/o to improve throughput

* remove empty line

* Solve comments

* Change rtcconfig.UDPPort to PortRange

* Fix test
2023-09-06 10:18:20 +08:00
David Zhao
debd75fa15 Integrate logger components (#1933)
* Integrate logger components

Dividing into the following components
* pub - publisher
* pub.sfu
* sub - subscriber
* transport
* transport.pion
* transport.cc
* api
* webhook

* update go modules
2023-08-03 13:31:17 -07:00
David Zhao
981fb7cac7 Adding license notices (#1913)
* Adding license notices

* remove from config
2023-07-27 16:43:19 -07:00
Paul Wells
6c20c7eb15 add test for removing disconnected participants on signal close (#1896)
* add test for removing disconnected participants on signal close

* cleanup
2023-07-20 21:21:40 -07:00
Raja Subramanian
5459bd2931 Push track quality to poor on a bandwidth constrained pause. (#1867)
* Push track quality to poor on a bandwidth constrained pause.

* add tests

* scale distance by divisor

* fix test distance to desired

* wait longer for subscription manager to reconcile
2023-07-11 15:29:35 +05:30
Raja Subramanian
06f9b574cb Delete down track from receiver in close always. (#1842)
* Delete down track from receiver in close always.

I think with the parallel close in goroutines, it so happens that
peer connection can get closed first and unbind the track.

The delete down track and RTCP reader close was inside if `bound` block.
So, they were not running leaving a dangling down track in the receiver.

* fix tests

* fix test
2023-06-30 20:44:57 +05:30
cnderrauber
c1842cb54f Avoid reconnect loop for unsupported downtrack (#1754)
* Avoid reconnect loop for unsupported downtrack

If the client subscribes to a track which codec is unsupported by the
client, sfu will trigger negotiation failed and issue a full reconnect
after received client answer. If the client try to subscribe that track
then it will got full reconnect again. That will cause a infinite
reconnect loop until the client don't subscribe that track. This PR
will unsubscribe the error track for the client and send a
SubscriptionResponse that contain the reason to indicates the track's
codec is not supported to avoid the reconnect loop.
2023-05-31 11:41:22 +08:00
David Zhao
12c6f1e12c Added Xiaomi 2201117TI to devices that does not support H.264 (#1728) 2023-05-22 21:38:56 -07:00
Paul Wells
e03b7ef8de start signal relay sessions with the correct node (#1721)
* start signal relay sessions with the correct node

* enable signal relay in multiregion integration test
2023-05-18 12:39:02 -07:00
Benjamin Pracht
4244542840 Adopt WebRTCConfig from mediatransportutil (#1707)
This also adds support for inline fields in ToCLIFlagNames
2023-05-10 20:00:34 -07:00
Benjamin Pracht
a08cd23b6d Adopt pion logging initialization moving to protocol (#1667) 2023-04-28 10:51:41 -07:00
David Colburn
191a9e8014 update core to 0.0.5 (#1540)
* update core

* sort imports

* fix typos

* redundant types
2023-03-22 16:53:23 -07:00
Dan McFaul
1848a21eda add configurable environment value (#1421)
* add configurable prometheus env label

* Update pkg/config/config.go

Co-authored-by: Mathew Kamkar <578302+matkam@users.noreply.github.com>

* Update cmd/server/main.go

Co-authored-by: Mathew Kamkar <578302+matkam@users.noreply.github.com>

* Update config-sample.yaml

Co-authored-by: Mathew Kamkar <578302+matkam@users.noreply.github.com>

* set config.Environment value to dev when in dev mode

* be more precise for config-sample

---------

Co-authored-by: Mathew Kamkar <578302+matkam@users.noreply.github.com>
2023-02-15 14:41:44 -07:00
David Zhao
ea12e1477f Update to go-redis v9. Fixed Redis cluster support (#1415)
* Update to go-redis v9. Fixed Redis cluster support
2023-02-12 22:22:21 -08:00
cnderrauber
3c907ed460 Add stats for data channel and signal (#1198)
* Add stats for data channel and signal

* Solve comment
2022-11-30 14:53:19 +08:00
Mathew Kamkar
caae389717 node type prometheus metric labels (#1197) 2022-11-29 20:36:35 -08:00
Mathew Kamkar
26fe910e88 Generated CLI Flags (#1112) 2022-10-25 22:24:08 -07:00
cnderrauber
8fd3e8fe2d Support track level stereo and red setting (#1086)
* Support track level stereo and red setting

* fix test client
2022-10-17 10:48:11 +08:00
Raja Subramanian
33f5dbc501 Make strict mode a param (#1054)
So, a wrapping config (like cloud) can skip the strict mode check.
2022-09-29 13:07:32 +05:30
cnderrauber
48588d7c3d code clean & fix h264 test fail (#1028) 2022-09-21 16:59:18 +08:00
Mathew Kamkar
767d660809 Use LocalNode ID in Prometheus metrics (#959) 2022-08-25 22:16:20 -07:00
Raja Subramanian
06a46d5de0 Replace Target with params to indicate direction (#955)
* Replace Target with params to indicate direction

* Add missed send answer call
2022-08-25 08:33:06 +05:30
Raja Subramanian
00b131da50 Wait for fully established to ensure data channel is ready (#949) 2022-08-24 16:51:43 +05:30
Raja Subramanian
aaa3a5b46e Transport restructure (#944)
* WIP commit

* WIP commit

* fix copy pasta

* setting PC with previous answer has to happen synchronously

* static check

* WIP commit

* WIP commit

* fixing transport tests

* fix tests and clean up

* minor renaming

* FIx test race

* log event when channel is full
2022-08-24 14:31:45 +05:30