Commit Graph

357 Commits

Author SHA1 Message Date
Benjamin Pracht 932af81f34 Update strored version of an active ingress if no ingress server responds (#1031)
This allows deleting and updating an ingress even if the ingress server that was handling it died. It does however mean that if the ingress responds again later, its state will be inconsistent. To somewhat make this less likely, also keep trying contacting the ingress for 1 min in the background.

Also fixing a race where an active deleted Ingress would get recreated on delete because of the update triggered by the ingress session shutdown
2022-09-26 11:16:27 -07:00
David Zhao 5e1912e44c Enable TCP/TURN fallback by default (#1033) 2022-09-22 23:58:07 -07:00
David Colburn b97d59b8db consolidate room internal (#1030)
* consolidate room internal

* create room internal map

* pipelined room read

* check error

* fix pipelined reads

* clean up after test
2022-09-22 15:59:27 -07:00
David Colburn 803046b882 Auto egress (#1011)
* auto egress

* fix room service test

* reuse StartTrackEgress

* add timestamp

* update prefixed filename explicitly

* update protocol

* clean up telemetry

* fix telemetry tests

* separate room internal storage

* auto participant egress

* remove custom template url

* fix internal key

* use map for stats workers

* remove sync.Map

* remove participant composite
2022-09-21 12:04:19 -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
David Zhao 99cb021e85 Increase max wait for media node to respond. (#1026)
In extreme cases, media nodes could take more than 5s to spin up the
session. Increasing this timeout to 10s reduces the number of disconnections
due to edge cases.
2022-09-20 23:38:58 -07:00
Raja Subramanian 60297b24fd Use UnixMilli (#1009)
* Use UnixMilli

* enhance comment
2022-09-15 19:17:24 +05:30
Raja Subramanian 07c43e0972 Supervisor beginnings (#1005)
* Remove VP9 from media engine set up.

* Remove vp9 from config sample

* Supervisor beginnings

Eventual goal is to have a reconciler which moves state from
actual -> desired. First step along the way is to observe/monitor.
The first step even in that is an initial implementation to get
feedback on the direction.

This PR is a start in that direction
- Concept of a supervisor at local participant level
- This supervisor will be responsible for periodically monitor
  actual vs desired (this is the one which will eventually trigger
  other things to reconcile, but for now it just logs on error)
- A new interface `OperationMonitor` which requires two methods
  o Check() returns an error based on actual vs desired state.
  o IsIdle() returns bool. Returns true if the monitor is idle.
- The supervisor maintains a list of monitors and does periodic check.

In the above framework, starting with list of
subscriptions/unsubscriptions. There is a new module
`SubscriptionMonitor` which checks subscription transitions.
A subscription transition is queued on subscribe/unsubscribe.
The transition can be satisfied when a subscribedTrack is added OR
removed. Error condition is when a transition is not satisfied for
10 seconds. Idle is when the transition queue is empty and
subscribedTrack is nil, i. e. the last transition would have been
unsubscribe and subscribed track removed (unsubscribe satisfied).

The idea is individual monitors can check on different things.
Some more things that I am thinking about are
- PublishedTrackMonitor - started when an add track happens,
  satisfied when OnTrack happens, error if `OnTrack` does not
  fire for a while and track is not muted, idle when there is
  nothing pending.
- PublishedTrackStreamingMonitor - to ensure that a published track
  is receiving media at the server (accounting for dynacast, mute, etc)
- SubscribedTrackStreamingMonitor - to ensure down track is sending
  data unless muted.

* Remove debug

* Protect against early casting errors

* Adding PublicationMonitor
2022-09-15 11:16:37 +05:30
Benjamin Pracht b0eead22b5 Allow specifying a different RTMP url domain for each ingress (#994) 2022-09-12 14:03:15 -07:00
David Zhao 7e3155dcd6 ForceTCP only for supported clients (#997)
* ForceTCP only for supported clients

Revert back to standard if forceRelay with TLS fails
Don't force TLS unless it's configured

* fix lint
2022-09-09 18:14:36 -07:00
David Zhao 5cfd21c1ef Fix inaccurate participant count due to storing old data (#992) 2022-09-07 18:33:28 -07:00
cnderrauber 441053b7fa add participant id when client reconnect (#988) 2022-09-07 15:56:56 +08:00
Benjamin Pracht aaeba74402 Import ErrIngressOutOfDate from protocol (#987) 2022-09-06 16:05:17 -07:00
David Zhao da2525e973 for some reasons this wasn't generated before committed. (#974) 2022-08-31 21:35:51 -07:00
Benjamin Pracht d8edb9b2e7 Adopt Ingress RPC interface changes (#972) 2022-08-31 14:14:40 -07:00
cnderrauber c401ca58af turn packet and bytes stats used for telemetry and load control (#969)
* stats for turn

* add connections stats

* stats for standalone turn server only

* wire update
2022-08-31 11:00:27 +08:00
David Zhao aa4f713d1e Document tcp fallback (#961)
* Updated docs around TCP fallback

* changed allowFallback to a pointer
2022-08-27 14:59:01 -07:00
Raja Subramanian 781bd74098 443 for TLS (#956)
* Use 443 for TURN TLS

* Explicit disable when TLS is not set
2022-08-25 09:05:44 +05:30
cnderrauber 31d3d5e8b9 ignore udp turn when force tls (#952) 2022-08-24 20:45:48 +05:30
cnderrauber 1350400c3a fallback to turn over tls when tcp short connection happen (#950)
* fallback to tls when tcp failed

* go mod

* magefile
2022-08-24 20:42:56 +08:00
cnderrauber f365481dde unify resume/restart in single/multi node mode (#946) 2022-08-23 18:22:44 +08:00
cnderrauber 0b42a8f2c6 loop variable captured (#945) 2022-08-23 14:27:21 +08:00
cnderrauber a118d21af0 add red codec for opus (#938)
* opus/red codec

* panic

* forward red track to nonred subscriber

* config

* clean code

* solve comments
2022-08-22 12:32:27 +08:00
David Zhao b8bda3f14b Separate calls to Telemetry vs Prometheus room lifecycle (#935)
* Separate calls to Telemetry vs Prometheus room lifecycle

* remove unused import
2022-08-20 20:22:16 -07:00
cnderrauber 770076febf fix resume/restart with single node mode (#930)
* fix resume/restart with single node mode

* clean comment
2022-08-18 12:46:18 +08:00
David Zhao d9059f4f3b Do not accept websocket connection if response not received (#923)
When the instance handling the signal request did not respond to the
initial connection, we will fail the connection attempt instead of
having it hang forever.
2022-08-16 19:57:41 -07:00
David Zhao 1d199d1efa Populate network field when set by clients (#919) 2022-08-15 23:28:15 -07:00
David Zhao f09885825e Return ServerInfo to clients on join (#904)
* checkpoint

* Return ServerInfo in join response

* also include node information

* less verbose quality score

* update go modules
2022-08-10 17:04:17 -07:00
Raja Subramanian 49cf15cdca Fix filtering candidates (#901)
* Filter candidate after setting description

* comment

* Fix filtering candidates

- For offer/answer from remote, do filtering before setting remote
  description so that Pion does not see filtered candidates
- For offer/answer originating from server, do filtering after setting
  local description (comments in code) so that remote side does not
  see filtered candidates.
- Make logging a little consistent and use right context.

* Comment

* TCP fallback config and UT (broken now)

* log SDP only when preferring TCP

* Remove TCP fallback test attempt
2022-08-10 10:42:46 +05:30
Benjamin Pracht 67d3f21122 Only update an IngressInfo if the StartedAt field is newer or equal to the one currently in storage (#897)
This is meant to ensure that we will not overwrite the state of an ingress that already reconnected to a different server on failure or timeout
2022-08-09 19:07:56 -07:00
David Zhao ab1ccae0c7 Respond to signal ping / pong (#871)
* Respond to signal ping / pong

* Pass back 1 for pong for now, we don't need the timestamp

* update protocol
2022-08-05 09:24:47 -07:00
Raja Subramanian c75090a0fe Use a TTL of 1 hour for ICE config cache (#873) 2022-08-05 17:31:28 +05:30
Raja Subramanian 3f16018b62 Cache ICE config in room manager. (#872)
* Cache ICE config in room manager.

* mage generate

* Read ICE config within lock
2022-08-05 12:49:19 +05:30
Benjamin Pracht 0cffbe69e9 Fix ingress stream key lookup and avoid nil dereference when room in auth claims doesn't match (#869) 2022-08-04 16:22:55 -07: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
Benjamin Pracht 5558aa5228 Make sure CreateIngest populates the stream_key and URL fields (#861) 2022-08-01 11:35:30 -07:00
Raja Subramanian a393d64ccc Do not re-use transceiver when negotiation is pending. (#862) 2022-07-31 10:50:55 +05:30
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 Colburn 0ab4379c5c Separate egress/ingress storage (#855) 2022-07-28 17:01:33 -05:00
Benjamin Pracht 7a2eac8e86 Initial Ingress support in API (#852)
This adds support for the Ingress related endpoints to LiveKit server. This currently doesn't handle reconnections safely.
2022-07-28 09:49:54 -07:00
Benjamin Pracht 188f9c675e Add support for Ingress in store interface (#849) 2022-07-26 16:55:03 -07:00
Raja Subramanian e624604453 Revert "ListRooms using sid (#842)" (#845)
This reverts commit f2e1e67e58.
2022-07-21 14:49:41 +05:30
David Zhao 53f51c8cb0 Logging cleanup (#843)
* Logging cleanup

Changes log levels to better match significance

* fix lock
2022-07-21 00:39:49 -07:00
Raja Subramanian f2e1e67e58 ListRooms using sid (#842)
* ListRooms using `sid`

* correct field name

* Remove contains and latest protocol
2022-07-21 11:05:33 +05:30
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
Raja Subramanian 52aed86080 Add remote participant context to logger (#815) 2022-07-07 10:44:10 +05:30
David Colburn fbbcbe77df Remove recording (#811)
* remove recorder service

* update protocol
2022-07-05 18:39:32 -07:00
David Zhao e30046f537 Delay room manager close to ensure correct DisconnectReason is sent (#806) 2022-07-03 23:38:59 -07:00
David Zhao f1f62ddda5 Sends disconnect reason when server sends Leave request (#801)
* Sends disconnect reason when server sends Leave request

* update go.mod
2022-07-02 21:22:26 -07:00
David Colburn 407996702b update participant grants (#782) 2022-06-24 09:29:04 -07:00