Commit Graph

75 Commits

Author SHA1 Message Date
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
6ad1e1598d move signal server start to server start (#1894)
* move signal server start to server start

* fix test
2023-07-20 19:13:27 -07:00
Juan Navarro
2668073c29 Honor bind address passed as --bind also for RTC ports (#1815)
* Use net.JoinHostPort to build "host:port" strings for `net.Listen`

net.JoinHostPort provides a unified way of building strings of the form
"Host:Port", abstracting the particular syntax requirements of some
methods in the `net` package (namely, that IPv4 addresses can be given
as-is to `net.Listen`, but IPv6 addresses must be given enclosed in
square brackets).

This change makes sense because an address such as `[::1]` is *not* a
valid IPv6 address; the square brackets are just a detail particular to
the Go `net` library. As such, this syntax shouldn't be exposed to the
user, and configuration should just accept valid IPv6 addresses and
convert them as needed for usage within the code.

* Use '--bind' CLI flag to also filter RTC bind address

The local address passed to a command such as

    livekit-server --dev --bind 127.0.0.1

was being used as binding address for the TCP WebSocket port, but was
being ignored for RTC connections.

With `--dev`, the conf.RTC.UDPPort config is set to 7882, which enables
"UDP muxing" mechanism. Without interface or address filtering, Pion
would try to bind to port 7882 on *all* interfaces.

This was failing on a system with IPv6 enabled, when trying to bind to
an IPv6 address of the `docker0` interface. It seems to make sense that
the user-passed bind addresses are also honored for the RTC port
bindings.
2023-06-28 16:52:43 -07:00
David Zhao
956735ae05 Fix node stats updates on Windows (#1748)
Because we aren't able to get CPU count/load info on Windows, they are
stubbed out to return placeholders. This restores compatibility to run
on Windows.
2023-05-29 10:53:08 -07:00
Paul Wells
e22de045ba add signal psrpc service (#1485)
* add signal psrpc service

* update protocol dep

* refactor for cloud

* update psrpc

* pr feedback
2023-03-03 15:49:46 -08:00
Benjamin Pracht
17ae1506f5 Chain twirpLogger and twirpRequestStatusHook properly for the Egress server (#1470) 2023-02-25 15:15:50 -07:00
Benjamin Pracht
edc39da0b1 Add TwirpRequestStatusReporter twirp server hook to count requests (#1309) 2023-01-18 11:53:20 -08:00
David Colburn
a87107a0f3 IOInfo service (#1305)
* IOInfo service

* only start if not nil

* use ctx in updateEgressInfo

* updates

* fix merge
2023-01-16 16:26:03 -08:00
David Zhao
988858a98a Update dependencies to generic versions (#1259) 2022-12-26 22:29:13 -08:00
David Zhao
7a1273151f Update to new logging library, using sampling participant logger (#1219) 2022-12-09 00:09:03 -08:00
David Zhao
e5d21cb1d9 CreateRoom API to actually create the room on an RTC node (#1155)
Previously, CreateRoom only created the room in storage, but did not
hydrate it on an RTC node. This has caused strange behaviors such as
emptyTimeout not working correctly (#1109).

Also reduced room reap worker to consistently reap rooms. Fixes #241
2022-11-09 23:35:35 -08:00
David Zhao
4161768530 Log Service API requests (#1091) 2022-10-17 00:16:54 -07:00
Samuel Humeau
00ec859dd1 Add default handler to 404 (#1088) 2022-10-16 10:30:34 -07:00
David Zhao
feb47812e7 Allow CORS responses to be cached to allow faster initial connection (#1027) 2022-09-20 23:56:24 -07:00
cnderrauber
0b42a8f2c6 loop variable captured (#945) 2022-08-23 14:27:21 +08:00
Benjamin Pracht
c333b7a026 Add support for Ingress service (#868)
Also check for Join permission on ingress API calls
2022-08-04 09:48:53 -07:00
David Colburn
7aa5888338 Keep egress info for 24h (#856)
* Keep egress info for 24h

* updates

* better version comparison

* fix test

* duplicated if
2022-07-28 20:27:59 -05:00
David Zhao
a2bf32797b Allow binding HTTP server to specific address (#831)
Improves security when running with placeholder keys. Only allowing
access from loopback by default.
2022-07-13 23:58:33 -07:00
David Colburn
fbbcbe77df Remove recording (#811)
* remove recorder service

* update protocol
2022-07-05 18:39:32 -07:00
David Zhao
a933f1513f Add pprof endpoint when running in dev mode (#708) 2022-05-23 00:34:16 -07:00
Raja Subramanian
92009b6428 Consistently stop tickers (#593) 2022-04-05 20:42:06 +05:30
David Colburn
0b8a180554 Code inspection (#581)
* Code inspection

* fix [4]int64 conversiong
2022-03-30 13:49:53 -07:00
David Zhao
130decbf1d CI step for static check (#467)
* CI step for static check

* fix staticcheck
2022-02-24 23:07:15 -08:00
Raja Subramanian
778d1aa141 utils.AtomicFlag -> atomic.Bool (#466)
* Replacing hand rolled ion-sfu atomic with uber/atomic

* Remove another hand rolled atomic

* utils.AtomicFlag -> atomic.Bool
2022-02-25 12:19:49 +05:30
Raja Subramanian
0170cc1cb6 Staticcheck (#464)
Using `go get -u honnef.co/go/tools/cmd/staticcheck`
Uneaarthed a couple of real bugs
2022-02-25 12:04:08 +05:30
David Colburn
20f21cce2b Egress (#455)
* egress updates

* pass egressInfo to delete

* update typefakes

* export StartEgress

* update protocol

* new rpc, rename stores

* add json tag

* update tests

* update protocol
2022-02-24 14:57:14 -08:00
David Zhao
cd9c125414 Also allow headers with CORS (#339) 2022-01-14 10:13:11 -08:00
David Zhao
f9b2af0cf9 Use CORS middleware to allow RoomService use (#335) 2022-01-13 09:29:48 -08:00
David Zhao
c08d1e9d72 Improve test CI (#262)
* minimal change

* Better test format for GH CI

* Give server a bit longer to startup, to improve GH test
2021-12-14 17:15:08 -08:00
Raja Subramanian
e54ce4f674 Stream Allocator Try 3 (#257)
* Stream Allocator Try 3

Making an intermediate PR to do
- Special treatment for screen share tracks
- When allocating all tracks,
  o try to stream all tracks by starting with the lowest layer
  o multi-pass across tracks to get a more even distribution

Not yet done:
-------------
In deficient state,
o Allocate a specific track on a change
o Steal from other tracks

* Correct sense of managed track

* have to range to copy

* generate

* fix VideoLayers compare

* Use t.simulcasted
2021-12-14 12:48:09 +05:30
David Zhao
2d93ccd668 Updated protocol from protocol/proto -> protocol/livekit (#242)
* Updated protocol from protocol/proto -> protocol/livekit

* separate MediaTrack from PublishedTrack
2021-12-08 13:58:38 -08:00
David Colburn
95e29d3766 Interface updates (#194)
* update interfaces, a bit of cleaning

* regenerate

* return interface for RoomService

* export packetBufferSize

* update router interface

* move participant key into router

* change locks back

* read only room store

* fix server rm locks

* update SendJoinResponse

* clean up imports

* update room messaging

* regenerate
2021-11-15 15:25:50 -06:00
Mathew Kamkar
9336a0dab5 health check depends on updated stats (#183) 2021-11-10 14:11:44 -08:00
David Colburn
0c8fe361b2 Small refactor (#148)
* small refactor

* extra line

* fix room allocator test

* selector fakes not used

* keep decisions out of router

* put nodeId logic back

* fix room allocator test
2021-10-18 21:49:16 -05:00
David Zhao
4149c4a314 removed duplicate region log 2021-10-10 22:52:51 -07:00
David Zhao
575b99840a Fixed handling of multiple nodes in region-aware routing 2021-10-10 22:25:29 -07:00
Brint E. Kriebel
822f8c3944 Region Aware node selection fixes and enhancements (#141)
* cli: Allow setting the current node region with flag or env variable

Also add region to "starting LiveKit server" log.

* routing: Add region to node registration

Register the node's region on the selected router so it can be used for
region aware node selection.

Also add the region to the list-nodes output.

* regionaware: Set minDist to zero for the current node

If you don't set the minDist when leaving the loop early for a node that
matches the current region, the minDist value with still be at max. This
causes the the wrong node to be selected if the current node is the
first one the loop passes through.

Add a test that validates this change. The new test fails if this new
change is not in place.
2021-10-10 22:21:37 -07:00
David Colburn
347bf0345a Recording webhooks (#125)
* dump

* update protocol

* const

* regenerate wire

* message bus nil check

* nil message bus if no redis

* start and stop rec service
2021-09-21 23:46:25 -05:00
Mathew Kamkar
700a879c0b Redis Router graceful stop (#116)
* prestop and hasparticipants in interface

* add prestop function to existing routers

* fakerouter prestop

* update protocol version

* read lock

* redis router graceful stop

* test fix

* force stop
2021-09-15 13:07:44 -07:00
David Colburn
2a3fb5f0e7 move logging to protocol (#109) 2021-09-09 00:45:42 -07:00
David Colburn
0bfd05c3b8 move router room manager link (#103) 2021-08-30 17:18:18 -05:00
David Colburn
69c1d4c295 Interfaces (#97)
* create interface

* move room manager to interface

* interfaces

* updates

* fix loop

* fix fakes

* remove node types
2021-08-28 18:28:08 -05:00
David Colburn
8a44fad307 protocol 0.8 (#95)
* protocol 0.8

* merge new selector
2021-08-27 13:16:33 -05:00
David Colburn
6111b2d4f8 Recording apis (#78)
* apis with auth

* recording service

* record permission

* protocol 0.6.5

* bump version
2021-08-04 22:44:06 -05:00
hn8
87dfb2b117 log: consistent log key (#60) 2021-07-19 10:28:51 -07:00
David Colburn
53bc65285c connection validation 2021-07-15 14:23:17 -07:00
David Colburn
5fdb6361cd Dev debug info (#50) 2021-07-13 14:05:25 -05:00
David Zhao
a80e8cf69f Enable passing in local IP, refactored IP detection (#48)
* Enable passing in local IP, refactored IP detection

* update docker server instructions
2021-07-11 08:42:11 -07:00
hn8
dcfe7eaf4f Enhancement: audio speakers (#44)
* refactor: active speakers

1. Observe the loudest adjusted with active ratio instead of linear average of decibel values
2. Follow RFC6465 to convert audio level from decibel to linear value.
3. Quantize audio level for stable slice comparison
4. Switch moving average algorithm from MMA to EMA to have the same center of mass with SMA
5. Minor: remove seenSids map allocation
6. Minor: minimize division arithmetic

* Update pkg/rtc/audiolevel.go

Co-authored-by: David Zhao <david@davidzhao.com>
2021-07-09 09:46:24 -07:00