Commit Graph

1155 Commits

Author SHA1 Message Date
Mathew Kamkar 7c970da974 add memory used and total to node stats (#1293)
* add memory used and total to node stats

* raja review: consistency

* update protocol
2023-01-10 12:32:04 -08:00
Raja Subramanian 69d879706d Use getBuffer consistently. (#1290)
* Use `getBuffer` consistently.

With SVC, it is possible that layer <-> buffer mapping is not 1:1.
So, use `getBuffer` method.

* fix recursive lock
2023-01-07 16:16:17 +05:30
Raja Subramanian 878887b624 Reset state if requested even if config is same (#1287) 2023-01-06 21:39:45 +05:30
Raja Subramanian 2b89c821ab An attempt to use publisher side RTCP sender report while forwarding (#1286)
* WIP commit

* comment

* clean up

* remove unused stuff

* cleaner comment

* remove unused stuff

* remove unused stuff

* more comments

* TrackSender method to handle RTCP sender report data

* fix test

* push rtcp sender report data to down tracks

* Need payload type for codec id mapping in relay protocol

* rename variable a  bit
2023-01-06 14:07:18 +05:30
Raja Subramanian 56424985df Do not get tripped by default values. (#1284)
* Do not get tripped by default values.

The following scenario declared the second message a dupe incorrectly
- UpdateSubscription{subscribe: true}: This message initialized quality
  to default which is livekit.VideoQuality_LOW
- UpdateTrackSettings{quality: livekit.VideoQuality_LOW} - this one got
  tripped as duplicate because the previous message initialized quality
  to LOW.

Fix it by recording whether track settings have been seen.

no auto subscribe + quality setting to LOW test failed before this
change and passes with this change.

* patch all track setting fields
2023-01-04 23:06:50 +05:30
shishirng dceb624b83 Send participant object in telemetry on Active event (#1282)
Signed-off-by: shishir gowda <shishir@livekit.io>
2023-01-04 08:55:49 -05:00
cnderrauber fe4da84ee9 send padding packets of muted uptrack for go sdk (#1283) 2023-01-04 16:01:04 +08:00
Raja Subramanian cbc7d43ba4 Minor tweaks to frame based stream tracker. (#1281) 2023-01-03 18:16:55 +05:30
David Colburn 24664b1284 egress participants don't count towards max (#1279) 2023-01-03 09:38:58 +08:00
Raja Subramanian 4ba7e57683 Make an IsDisconnected interface and use it (#1278) 2022-12-31 12:53:02 +05:30
Raja Subramanian 9b8311ffcb No JoinResponse during migration (#1277)
* No JoinResponse during migration

* Change  to take migration into account
2022-12-31 11:43:48 +05:30
Raja Subramanian a87574da31 FPS based stream tracker tweaks (#1275)
* FPS based stream tracker tweaks

- Cleaning up code
- Two tweaks
  o A layer is declared active on receiving first packet (when starting fresh).
    But, if there are no frames after that (no packets after girst packet or
    there is only one frame), layer would not have been declared stopped as
    the previous version waited for second frame. Now, if there are no more
    frames in eval interval, declare the layer stopped.
  o When frame rate goes to 0, reset FPS calculator. Otherwise, layer starting
    after a long time will have frames spaced apart too far which would result
    in very low frame rate. Reset the calculator and let it pick up after the
    the layer restarts
- Also changing from lowest FPS -> estimated FPS and update up slowly and down fast.
  There are cases where frames are to far apart result in really low FPS. Seems to
  happen with NLC kind of cases where bandwidth is changed rapidly and the estimator
  on browser probably gets a bit confused and starts/stops layers a bit erratically.
  So, update estimate periodically to ensure eval interval is tracking current rate.

* fix factor

* spelling fix
2022-12-30 19:49:16 +05:30
Raja Subramanian 5532dfa75c A couple of logging tweaks (#1276) 2022-12-30 19:47:25 +05:30
cnderrauber c393a5f8dd Add interface and ipfilter to udpmux option (#1270)
* Add interface and ipfilter to udpmux option

* validate external ip is accessable by client

* add context

* use external ip only for firefox

* fix mapping error

* Update pion/ice and use external ip only for firefox

* Use single external ip for NAT1To1Ips if validate failed

* update pion/ice
2022-12-30 16:01:12 +08:00
David Zhao 112d6fc18b Reduced log verbosity for pieces that are stable (#1274) 2022-12-29 23:47:36 -08:00
David Zhao fe6234329d Improve robustness of JoinResponse and ParticipantUpdate race handling (#1272) 2022-12-29 21:52:55 -08:00
Benjamin Pracht 86bf5cb62e Ensure we create en Egress ID with PsRPC (#1273) 2022-12-30 13:46:45 +13:00
Benjamin Pracht 7778cdf2cd Do not use the egress version stored in redis to decide whether to enable PsRPC. Use a conf entry instead (#1262) 2022-12-30 09:32:55 +13:00
David Zhao 1cffa98311 Guard against ParticipantUpdate sent before JoinResponse (#1271)
* Guard against ParticipantUpdate sent before JoinResponse
2022-12-29 01:08:08 -08:00
lukasIO 12931f20fd Include encryption field in TrackInfo, update protocol (#1265)
* Include e2ee in TrackInfo

* update protocol, rename field
2022-12-28 13:48:49 +01:00
Raja Subramanian 41a906ce92 Using tracker type per source type which allows diffferent impl for different sources (#1269) 2022-12-28 14:07:53 +05:30
Raja Subramanian 2b031a5112 Introducing frame based stream tracker. (#1267)
* Split stream tracker impl from base

* slight re-arrangement of code

* fps based stream tracker

* MinFPS config

* switch back to packet based tracker

* use video config by default to handle sources without type
2022-12-28 13:00:21 +05:30
David Colburn 5d3f644667 update psrpc (#1266) 2022-12-27 13:43:32 -08:00
David Zhao 988858a98a Update dependencies to generic versions (#1259) 2022-12-26 22:29:13 -08:00
David Colburn 976d4ea9db Update psrpc, egressStore interface (#1256)
* Update psrpc, egressStore interface

* psrpc v0.2.0
2022-12-24 00:49:31 -08:00
Raja Subramanian 94564f9f93 Introduce a safety note for dupe detection. (#1257)
If the last non-dupe was more than a while ago, just let one through
even if it is dupe.

Clean up code.
2022-12-24 12:53:18 +05:30
Raja Subramanian 1a48cc6a8b Track subscription operations per source track. (#1248) 2022-12-23 12:23:26 +05:30
David Colburn 6719a3c714 Updated egress rpc (#1252)
* updated egress rpc

* check if egress exists on stop

* fix static check

* remove old migration code

* rename

* regenerate, update test

* latest staticcheck

* update to psrpc 0.1.0

* fix tests

* dual write rpcs on running egress

* remove unused field

* fix race, change service for egress impl

* return nil if bus is nil

* id -> ids

* add affinityFunc to StartEgress
2022-12-22 21:03:27 -08:00
cnderrauber 05132799a5 config for streamtracker (#1255) 2022-12-23 09:48:56 +08:00
Raja Subramanian 4fbb89e99c Check for not nil ICECandidatePair (#1253)
GetSelectedICECandidatePair can return nil for the candidate pair if not
available even if the error is not nil. Protect against the nil
de-reference panic.
2022-12-22 11:28:04 +05:30
Raja Subramanian d05d26cc04 Do not patch subscription setting when processing UpdateSubscription (#1247)
message.

There are is a sequence where a dupe could be detected due to patching
which could lead to issues.

The sequence is
- UpdataTrackSettings with some values
- UpdateSubscription with Subcribe: false - this will patch from above
  track settings
- UpdateSubscription with Subscribe: true - this will continue patching
- UpdateTrackSettings with the same settings as in the first step - this
  will be declared a dupe because the track is enabled and the patched
  settings will declare no change in settings.

This is okay in the current code as subscription settings are cached at
participant level and applied when somebody re-subscribes. But, that
down stream processing can change any time.

So, when processing `UpdateSubscription` message, just do not patch.
If a later `UpdateTrackSettings` comes along, let it pass even if it
is not changing anything.
2022-12-21 11:12:40 +05:30
Raja Subramanian f24c1b95c2 Initial commit of signal deduper. (#1243)
* Initial commit of signal deduper.

Idea is protect against signal storm from misbehaving clients.

Design:
- SignalDeduper interface with one method to handle a SignalRequest and
  return if dupe or not.
- Signal specific deduper. Could have made a single de-duper which could
  handle all signal message types, but making it per type so that the
  code is cleaner.
- Some module (like the router) can instantiate whatever signal types
  it wants to de-dupe. When a signal message is received, that module
  can run the signal message through the list of de-dupers and
  potentially drop the message if any of the de-dupers declare that the
  message is a dupe. Making it a list makes things a little bit
  inefficient, but keeps things cleaner. Hopefully, not many de-dupers
  will be needed so that the inefficiency is not pronounced.

* re-arrange comments

* helper function

* add ParticipantClosed
2022-12-21 09:29:56 +05:30
David Zhao c1d7dbd4fc Tweaks to prometheus participant counter (#1240)
* Tweaks to prometheus participant counter

Ensure that we don't miss adding a count in migration scenarios

* avoid nil ICEConfig
2022-12-19 14:30:14 -08:00
Raja Subramanian 50e39b9985 Check participant SID also while removing a participant. (#1237) 2022-12-19 22:53:11 +05:30
Raja Subramanian e6bbf07089 Comment out memstats worker. (#1239) 2022-12-19 22:37:34 +05:30
David Zhao 120335da00 Allow skipping of sending ParticipantJoined analytics event (#1236)
In certain scenarios such as migration, we do not want a duplicate event
to be sent when the participant is reconnecting. The Prometheus metric
should still be updated though.
2022-12-18 22:09:20 -08:00
Raja Subramanian 241a7120f5 ICE config using protocol model (#1233)
* ICE config using protocol model

* use pointers consistently

* protocol pointer

* mage generate
2022-12-19 10:25:08 +05:30
David Zhao 33902a9f2a Do not send ParticipantLeft webhook event unless connected successfully. (#1234)
Fixes #1130
2022-12-18 17:37:55 -08:00
Haibo Chen 8a6c6de1db update name of participant (#1213) 2022-12-15 22:03:59 -08:00
Raja Subramanian c9cc45c8b0 Move log to debug as warn does not show anything bad (#1230) 2022-12-16 10:32:50 +05:30
Raja Subramanian dfc0411908 Reverting some dynacast logs to Debugw (#1229) 2022-12-15 12:32:07 +05:30
cnderrauber 090c35ddfd change no response sink to info and not return (#1228) 2022-12-14 11:22:23 +08:00
cnderrauber da829fcf8e diable prflx over relay for firefox (#1226)
* Disable prflx over relay for firefox

* remove ice lite change

* solve comment

* disable prflx for publisher too
2022-12-13 14:32:05 +08:00
Raja Subramanian 80a4dc574a Fallback to participant key if base62 is not available (#1223) 2022-12-13 05:01:23 +05:30
David Zhao 5af442ac10 Enable item sampler for Room logger (#1222) 2022-12-10 20:07:16 -08:00
Raja Subramanian b2df257ac6 base62 encode user provided name/identity. (#1220) 2022-12-10 13:02:31 +05:30
David Zhao 7a1273151f Update to new logging library, using sampling participant logger (#1219) 2022-12-09 00:09:03 -08:00
David Zhao b1ba917a01 Validate keys to ensure sufficient security. (#1217)
JWT tokens are signed with HS256, and they must be 256 bits or longer to
guarantee security.
2022-12-07 22:25:28 -08:00
cnderrauber eb134dc535 Close migration muted track which is not fired (#1215) 2022-12-07 13:53:37 +08:00
Raja Subramanian 6bd5504bff Add option to issue full reconnect on a publication error. (#1214)
* Add option to issue full reconnect on a publication error.

Leaving the publication error timeout at 30 seconds as there
are some publications taking long. Also, there are cases
where the peer connection fails after 30 seconds. The peer
connection failure happens after publication error is detected.
But, 30 seconds is a good amount of time for publication to establish.

* prevent recursive lock
2022-12-06 14:46:59 +05:30