Commit Graph

497 Commits

Author SHA1 Message Date
Raja Subramanian
9032db857c Connection quality clean up (#766)
* WIP commit

* WIP commit

* Remove debug

* Revert to reduce diff

* Fix tests

* Determine spatial layer from track info quality if non-simulcast

* Adjust for invalid layer on no rid, previously that function was returning 0 for no rid case

* Fall back to top level width/height if there are no layers

* Use duration from RTPDeltaInfo
2022-06-18 21:58:47 +05:30
cnderrauber
651d2aee4d fix datachannel to same postion as previous negotiate (#765) 2022-06-17 18:28:57 +08:00
cnderrauber
d15725c662 publish new codec when subscriber needed (#762)
* publish new codec as needed
2022-06-16 18:16:34 +08:00
cnderrauber
15da445fd7 fix subscription update on codec change (#757) 2022-06-10 12:31:34 +08:00
cnderrauber
15e91344be add disabled_codecs to client conf, and disable it at server side (#755)
* add disabled_codecs to client conf, and disable it at server side

* update go mod
2022-06-08 15:55:48 +08:00
cnderrauber
90ae3892b3 add simulate switch candidate (#754)
* add simulate switch candidate

* update go mod
2022-06-07 17:56:41 +08:00
David Zhao
c62def3fdf Use stable TrackID after unpublishing & republishing (#751)
Multiple parts of the system relies on a Track's ID (egress, telemetry, etc).
Track ID changes when a track was unpublished, then republished with the
exact same attributes. This PR would allow us to re-use a previously
unpublished Track ID
2022-06-05 23:31:51 -07:00
shishirng
2927521b8b Send publisher max layer change info to telemetry (#748)
Signed-off-by: shishir gowda <shishir@livekit.io>
2022-06-02 14:15:23 -04:00
cnderrauber
6ba034feae shorten the time cost for subscriber get media tracks (#747)
* set DownTrack's initial codec to first codec of potential codecs

* faststart on subscribe
2022-06-02 10:00:42 +08:00
shishirng
46301d7d6f Send layer dimensions when max subscribed layers change (#746)
Signed-off-by: shishir gowda <shishir@livekit.io>
2022-05-31 11:46:08 -04:00
David Zhao
73808a1623 Remove TrackSender.ParticipantIdentity since it's unused (#738)
Just introduced this in #736 and realized the interface change comes
with a bunch of unintended consequences, so reverting this addition.
2022-05-29 23:22:03 -07:00
David Zhao
7ad51f49f1 Fixed unclean DownTrack close when removed before bound. (#736)
* Fixed unclean DownTrack close when removed before bound.

When a DownTrack is closed before it had a chance to be bound to a
transceiver, we'd skip close and leave it hanging. This is unlikely in
normal operations. However, it can be seen with permissions and
subscription APIs.

* remove remaining peerID references
2022-05-29 22:09:02 -07:00
Raja Subramanian
80f8bc6c62 Re-introduce quantization of audio level to dampen small changes (#732) 2022-05-28 22:45:21 +05:30
David Zhao
1166d27a89 Fix duplicate subscriber connected (#729)
* Fix duplicate participant not being cleared out

* handle data race
2022-05-27 22:02:24 -07:00
David Zhao
a4882b9866 Improve thread safety with participant callbacks (#728) 2022-05-27 12:26:07 -07:00
shishirng
cb9f0d37c2 Use rtcscore-go to calculate audio/video score (#689)
* Use rtcscore-go to calculate audio/video score

Signed-off-by: shishir gowda <shishir@livekit.io>

* Get max expected layer and find max actual layer from stream

Signed-off-by: shishir gowda <shishir@livekit.io>

* Cleanup unused methods

Signed-off-by: shishir gowda <shishir@livekit.io>

* Cleanup code - address review comments

Signed-off-by: shishir gowda <shishir@livekit.io>

* get expected layer info instead of just quality

Signed-off-by: shishir gowda <shishir@livekit.io>

* Move SpatialLayerForQuality to utils/helpers

method is required in rtc,sfu and connectionstats pkg
Moved to utils/helpers.go to remove cyclic deps

Signed-off-by: shishir gowda <shishir@livekit.io>

* update tests

Signed-off-by: shishir gowda <shishir@livekit.io>

* Pick stream stats with max layer

Signed-off-by: shishir gowda <shishir@livekit.io>

* Update rtcscore-go pkg to make rtt/jitter optional

when passing 0, rtcscore-go was setting default values

Signed-off-by: shishir gowda <shishir@livekit.io>

* update score to rating

Signed-off-by: shishir gowda <shishir@livekit.io>

* Update rtcscore-go pkg to use simulcast layer info for score

Signed-off-by: shishir gowda <shishir@livekit.io>

* Update score ratings to reflect rtcscore range

Signed-off-by: shishir gowda <shishir@livekit.io>

* update test params for new rtcscore

Signed-off-by: shishir gowda <shishir@livekit.io>

* Delay sending scores to connections only till full data is available

first interval can have partial data leading to lower scores

Signed-off-by: shishir gowda <shishir@livekit.io>

* Check for inf values in quality params

Signed-off-by: shishir gowda <shishir@livekit.io>

* Clean up initial score calculation. Default to 5

Signed-off-by: shishir gowda <shishir@livekit.io>

Co-authored-by: David Zhao <dz@livekit.io>
2022-05-27 14:58:26 -04:00
shishirng
20681abcdc handle data race between updateState and OnStateChange (#727)
Signed-off-by: shishir gowda <shishir@livekit.io>
2022-05-27 12:54:19 -04:00
Raja Subramanian
a1c7332943 Use a shadow for receivers for safe range (#725)
* Use a shadow for receivers for safe range

* RLock layerSSRCs

* access max subscribed quality inside lock

* Fix go vet errors

* use defer
2022-05-27 22:11:34 +05:30
cnderrauber
f958fbcc1c simulcast codecs support (#720)
simulcast codecs support 

Co-authored-by: David Zhao <dz@livekit.io>
2022-05-27 19:55:50 +08:00
Raja Subramanian
3054f3eea3 Protect TrackInfo (#724)
* Protext TrackInfo

Also making a copy rather than changing params.

* prevent recursive lock

* Remove double lock

* Rework early return a little bit
2022-05-27 13:32:45 +05:30
cnderrauber
5f9cdfbd90 fix repeated AddSubscriber of MediaTrackSubscription (#723) 2022-05-27 15:42:17 +08:00
Raja Subramanian
73db950ea4 Use grants clone (#716) 2022-05-25 15:29:23 +05:30
Raja Subramanian
08f047c157 Fix test race in grants (#715) 2022-05-25 12:31:31 +05:30
Raja Subramanian
11fb079a4f Catching a few more races reported by go test -race ./... (#713)
* Fix a few more races

* Make sure room store on leave has correct count

* Revert logger change to reduce diff
2022-05-25 07:32:25 +05:30
Raja Subramanian
33032f6c4b Fix some test races and other things found with go test -race (#711) 2022-05-24 10:16:36 +05:30
Raja Subramanian
96b095504b Fix some races reported by go -race (#706)
* Fix some races reported by go -race

* Avoid copy
2022-05-23 11:51:13 +05:30
David Zhao
cdf1724d80 Batch subscriber updates to reduce noise (#703)
Improve scalability by batching subscriber updates on an interval.
When lots of subscribers join, the server ends up spending 20% CPU
sending each state change to everyone. There's a non-trivial amount of
overhead with each send operation.

For publishers, updates are sent right away.
2022-05-20 22:54:02 -07:00
cnderrauber
fa53da18e7 update pion, export vp8munger header (#684)
* update pion, export vp8munger header

* fix test
2022-05-13 17:20:52 +08:00
David Zhao
a1caeeb8de Update WebRTC and DTLS with security fixes (#678)
* Update WebRTC and DTLS with security fixes.

* remove aggressive nomination settings (now default)

* fixed TURN issue
2022-05-10 18:27:16 -07:00
Raja Subramanian
9f37239af3 Send active speaker update on subscription. (#676)
Newly joining participant does not get information about
currently active speaker till there is a speaker state change.
This addresses it by sending a speaker update on subscription
if the subscribed to participant is actively speaking.
2022-05-10 12:31:26 +05:30
David Zhao
bd7e3beda4 Improve frequency of stats update (#673)
* Improve frequency of stats update

Prometheus stats are updated as the data becomes available, instead of
aggregated along with telemetry batches. Node availability decisions can
now react much faster to these stats.

* use the same intervals for connection quality updates
2022-05-09 08:55:06 -07:00
Raja Subramanian
16407ea180 Change state to JOINED before sending JoinResponse (#674)
* Send room metadata as long as participant is not disconnected

* Change state to JOINED before sending join response
2022-05-09 13:28:56 +05:30
cnderrauber
07b93e2e5b add support for av1 svc (#669)
* add support for av1 svc
2022-05-06 18:24:29 +08:00
Raja Subramanian
fe8c355a32 Support participant identity in permissions (#663)
* Support participant identity in permissions

It is harder for clients to update permissions by SID as remote
reconnecting means a new SID for that participant. Using participant
identity is a better option.

For now, participant SID is also supported. Internally, it will
get mapped to identity. Server code uses identity throughout after
doing any necessary conversion from SID -> Identity.

* Address comments
2022-05-02 12:35:20 +05:30
David Zhao
289d63ac53 Fix node ip parameter not being used (#661)
* Use node-ip if provided

* formatting
2022-04-29 15:26:37 -07:00
Raja Subramanian
2f902a3edc Remove callbacks queue from sfu/DownTrack (#655)
* Remove callbacks queue from sfu/DownTrack

- Connection stats callback was happening in connection stats go routine
- RTT update launches a goroutine on the receive side as it affects the
  subscriber. So, no need to queue it.
- Changed two things
  o Move close handler to goroutine. It is better that way as it touches
the subscriber as well
  o Move max layer handling into a goroutine also so that the callback
does minimal work.

With this all the send side callback queues are removed.

* small clean up
2022-04-25 13:28:24 +05:30
David Zhao
57e2321a18 Expose Participant.IsPublisher to differentiate pubs from subs (#643) 2022-04-21 22:15:01 -07:00
cnderrauber
8bb46637bb enable accept aggressive nomination by default (#644) 2022-04-22 12:41:43 +08:00
cnderrauber
124d628c0a add config to accept aggressive nomination (#642) 2022-04-21 18:32:18 +08:00
Raja Subramanian
2b6a304b27 Increase size of RTCP channel just to be safe. (#641)
Also, using select to log warnings when queue is full.
2022-04-21 12:21:21 +05:30
David Zhao
59112b9200 Increase default message channel from 200 -> 10k (#638) 2022-04-20 16:34:00 -07:00
Raja Subramanian
43d0573693 Moving smoothing into the audio level module. (#636) 2022-04-20 23:59:51 +05:30
Raja Subramanian
6a53891f9f Process header extensions in line (#635)
* WIP commit

* Pass audio config

* Fix test compile
2022-04-20 18:20:28 +05:30
David Zhao
1cfc483d8f Do not pass STUN servers when using ICE Lite (#634) 2022-04-20 00:29:57 -07:00
David Zhao
b821a0997d Use common logging init functions (#633)
* Use common logging init functions

* update protocol commit

* fix tests
2022-04-20 00:15:11 -07:00
David Zhao
282e2aed49 Increase frequency of status updates and longer availability threshold (#628)
* Increase frequency of status updates and longer avail. threshold.

* better fix.

* fix room close test failure due to slow peer connection Close

* Perform avg computation more frequently if data has changed
2022-04-19 22:18:00 -07:00
David Zhao
7a60278f64 Improve docker connectivity by using srflx candidates (#624)
When deployed via Docker and without using host networking, we'll be
assigned an IP behind NAT. By giving it STUN servers, it should be
connectable even without passing in `--node-ip` explicitly
2022-04-19 09:53:17 -07:00
Raja Subramanian
cf627d8bbe Send adaptive stream param in join (#626) 2022-04-19 16:45:35 +05:30
Raja Subramanian
75ec31f237 Support starting off with not forwarding video (#623) 2022-04-19 12:37:53 +05:30
Raja Subramanian
50bd08e551 ICE restart - dynacast settings were lost (#620)
* Prevent stats update if the deltas are empty

* increase force interval

* static check

* Change max delay to 30 seconds

* Restart the max subscribed quality timer on ICE restart.

Force an update after a restart to let clients apply dynacast settings.
Also, set the max expected layer to HIGH on restart so that stream
tracker starts up fast on a restart.

* fix test
2022-04-18 22:58:11 +05:30