Commit Graph

37 Commits

Author SHA1 Message Date
Raja Subramanian cf627d8bbe Send adaptive stream param in join (#626) 2022-04-19 16:45:35 +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
Raja Subramanian 08c764c9bd Do not force an update on unmute. (#613)
Let the subs drive subscription quality update.
2022-04-14 15:35:17 +05:30
Raja Subramanian b695376086 Avoid locking in callback (#588) 2022-04-04 21:37:10 +05:30
David Colburn 0b8a180554 Code inspection (#581)
* Code inspection

* fix [4]int64 conversiong
2022-03-30 13:49:53 -07:00
cnderrauber 534cc01b85 refine dynacast pause delay (#558)
* refine dynacast pause delay

* fix test
2022-03-23 16:52:40 +08:00
cnderrauber b98b828618 throttle quality come down (#556) 2022-03-23 15:27:00 +08:00
cnderrauber 608da4ba4b stats for pli and bitrate (#487)
* stats for pli and bitrate

* solve comments

* return 0 if no pli sent
2022-03-07 14:59:01 +08:00
Raja Subramanian bfae13eaa6 Keep track of pending subscription close. (#478)
Introduce a pending close map and fire onNoSubscribers only
when there are not subscribed and no pending close.

There are a couple of paths for down track close
- RemoveSubscriber
- RemoveAllSubscriber
We remove the subscriber from `subscribedTracks` in these.
This is because `AddSubscriber` checks for existing subscription.
If there is a remove followed by an add, the add should not think
there is an existing susbcription if there is a delay in down track
close callback.

But, down track close is also called directly from places like
participant close. So, have to clean up both subscribedTrack
and pendingClose when the down track close fires.

Call onNoSubscribers only when both are empty. This will allow
relay up track to stop properly when all susbcribers have left.
2022-03-01 23:30:13 +05:30
shishirng c3a3fb569d add track publisher info in track subscribed event (#473)
* add track publisher info in track subscribed event

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

* update protocol ver

Signed-off-by: shishir gowda <shishir@livekit.io>
2022-02-28 13:48:02 -05: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 870190624e Fix no-video with adaptive streaming (#456)
* Fix no-video with adaptive streaming

With a recent change to initialize max quality for subscriber
synchronously, a subsequent update at the same quality was
getting ignored. So, there was no message back to publisher
to start up video layers. Reproducible every time the subscriber
joined after all the layers of publishers was turned off.

While not pretty, for now, disable the check for quality match
on subscriber update. That disabling itself is fine as there is
another check for consolidated quality match before sending
a message to the publisher, but in general this area has shown
some shakiness and needs some work.

* Use notify function to set initial quality also
2022-02-22 10:34:18 -08:00
Raja Subramanian 3f38172139 Types for ConnectionID, NodeID, ParticipantKey (#450)
* Types for ConnectionID, NodeID, ParticipantKey

* latest protocol version
2022-02-21 08:52:11 +05:30
David Zhao c20fb237d5 Initialize subscriber quality to default layer (#444) 2022-02-18 09:21:24 -08:00
Raja Subramanian 222b02aa73 RTT (#420)
* Consolidating PLI throttle

Use the throttler in `sfu.WebRTCReceiver`.

Does change shape of config object.

* Move PLIThrottleConfig to sfu.WebRTCReceiver

* fix test compile

* Cleaning up unused stuff

* improve readability

* RTT

- Calculate down track RTT using RTCP Receiver report
- Surface it back to the participant
- Participant updates all its published trackes
  (throttled to limit update to once in 5 seconds)
- That propagates to all the upstream sfu.Buffer and the nacker.
  So, we will have RTT throttled NACKs.

* rtt callback
2022-02-09 09:34:40 +05:30
Raja Subramanian d3ca4a37a8 Proper context for down track logger (#416)
It was having two participants (both publisher and subscriber).
Fix it by getting logger from susbcriber and adding track context.
2022-02-08 15:54:45 +05:30
David Colburn 7bbd238188 clean up logs and imports (#400) 2022-02-03 14:20:19 -07:00
Raja Subramanian 745939ec24 Smoother dynacast transition (#390) 2022-01-31 07:47:24 +05:30
Raja Subramanian a1f88faed1 Add a resync API to sfu.DownTrack (#389)
* Add a resync API to sfu.DownTrack

Also passing in logger with context into sfu package. More to do here
with proper logging context in all modules, but this is a start

* Remove debug code

* fix tests
2022-01-30 10:59:47 +05:30
Raja Subramanian 3bfdb2523e Catch some instances of traversing map outside lock (#388)
* one more place, do not range over map outside lock

* Catch one more location

* Catching a couple of more places
2022-01-29 20:14:36 +05:30
shishirng 26eea78b54 Telemetry connection scores (#377)
* octets - total bytes needs to be uint64

uint32 wraps at 4GB

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

* Cleanup stats handler to use connectionQuality stats

remove per packet rtcp handlers, buffer stats

* cleanup connection stats

* Update mediatrack to store rtcp stats in connection stats

* Update downstream handling of connection stats and telemetry

* Update telemetry tests

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

* Misc fixes

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

* Minor fix to avoid accessing buffer before its allocated

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

* start updateStats worker in AddReciever()

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

* Use previous score to calculate avg scores

* Restructure connectionStats

Signed-off-by: shishir gowda <shishir@livekit.io>
2022-01-27 11:24:54 -05:00
Raja Subramanian 45b07e2b3f Add trackID to logger context (#375) 2022-01-26 13:23:38 +05:30
Raja Subramanian 6a46958870 Some receiver clean up (#364) 2022-01-23 08:22:39 +05:30
Raja Subramanian 7f4ead9b25 Fire onNoSubscribers callback in only one place. (#360)
While reworking some cloud code, this is getting fired multiple times
(in RemoveAllSubscriber and in the callback). So, it causes some
errors in the logs. Fire it only from one place.
2022-01-21 11:16:54 +05:30
Raja Subramanian 4e4ad102f7 move stop timer in mediatracksubscriptions module where it belongs (#357)
* move stop timer in mediatracksubscriptions module where it belongs

* Correct my screw up
2022-01-21 00:50:48 +05:30
cnderrauber 0acb0a9d66 don't send black screen when Track be resumed (#352)
* don't send black screen when Track be resumed

* default flush
2022-01-19 18:14:38 +08:00
David Colburn 5bea9debb7 Code cleanup (#353) 2022-01-19 02:13:06 -08:00
Raja Subramanian 10714b3f6d Adjust interfaces to better work with cloud (#349)
* Adjust interfaces to better work with cloud

* force argument to quality update
2022-01-19 10:28:55 +05:30
cnderrauber 8a5f26b064 refine reuse transceiver (#348) 2022-01-19 10:24:29 +08:00
Artur Shellunts 5cdea4e15d Avoid per packet operation (#332) 2022-01-12 10:23:55 +01:00
Raja Subramanian e67db84b3b Remove stubs (#331)
* WIP commit

* Use LocalParticipant interface

* Remove no-op local participant

* Remove localparticipant

* Remove no-op stubs

* Consolidate PublishedTrack into MediaTrack
2022-01-12 00:11:48 +05:30
Raja Subramanian a9e0598210 uptrackmanager reuse (#318)
* WIP commit

* Remove the double lock

* Remove unused variable

* WIP commit

* Fix test

* WIP commit

* Split out MediaTrackReceiver

* Address comments from David
2022-01-09 10:45:49 +05:30
cnderrauber 8582ca4c9b Session migration (#319)
* migrate between nodes

* session migration

* bug fix

* use version instead of query parameter

* clean code

* clean

* merge master

* solve comments

* solve comment

* update go.mod

Co-authored-by: cnderrauber <zengjie9004@gmail.com>
2022-01-08 18:54:23 +08:00
Raja Subramanian ecf9590d56 More abstractions (#316) 2022-01-07 01:46:15 +05:30
Raja Subramanian 5064f35c29 Refactor media track subscriptions (#314)
* Refactor media track subscriptions

- To enable re-use of common bits
- Add max quality from other nodes

* Lock close handlers slice

* Reverting multiple on close handlers of downtrack, unclear if it is needed yet

* Make Logger a pointer

* audio level in MediaTrack like remote media track

* Cleanup

* Add a no subscribers callback

* Add method to update subscribed quality from another node

* loss proxying from remote node

* Address comments from David

* create subscriber node quality map
2022-01-06 09:02:11 +05:30
boks1971 973420faf5 Revert "Refactor media track subscriptions"
This reverts commit 9ca85454ed.
2022-01-04 16:57:49 +05:30
boks1971 9ca85454ed Refactor media track subscriptions
- To enable re-use of common bits
- Add max quality from other nodes
2022-01-04 16:40:47 +05:30