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
75ec31f237 Support starting off with not forwarding video (#623) 2022-04-19 12:37:53 +05:30
David Colburn
0b8a180554 Code inspection (#581)
* Code inspection

* fix [4]int64 conversiong
2022-03-30 13:49:53 -07: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
745939ec24 Smoother dynacast transition (#390) 2022-01-31 07:47:24 +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
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
Raja Subramanian
995c1e8676 type aliases -> type definitions (#312)
* type alias -> type definition

* participantSid -> participantID in a comment

* Update protocol
2022-01-03 12:43:58 +05:30
Raja Subramanian
03000f88cb Adaptive publishing improvements (#295)
* Adaptive publishing improvements

* fix tests

* proper comment sentence

* Address comments from David

* proper locking

* fix crash

* Do not start quality timer if not video
2021-12-30 09:50:53 +05:30
Raja Subramanian
9d78619ca3 Catching a few more files with types (#299)
* Use types in mediatrack.go

* A bunch more files get types

* One more file
2021-12-29 23:51:06 +05:30
Raja Subramanian
42a9b6657d Scoped speaker update (#280)
* Scoped speaker update

Include only participants a participant is subscribed to.

NOTE: Not doing this for active speaker changes for Protocol < 3.

* correct comment spelling
2021-12-23 09:13:49 +05:30
David Zhao
b32ab0e54f Fix incorrect order of parameters passed to NewSubscribedTrack (#272)
* Fix incorrect order of parameters passed to NewSubscribedTrack

Switched to explicit values via a params struct
2021-12-20 14:02:33 -08:00
shishirng
0f728b0b72 Connection quality v1 (#260)
* audio connection quality mos for publisher stats

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

* Update tests

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

* Change ratings range, increase default rtt to 80

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

* Use stats worker to get total packets to find %lost in window

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

* Update go dep

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

* Increase interval of score cal to 5 seconds

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

* use lastSequenceNumber in reports to find total packets

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

* Account for delay while calculating scores

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

* Fix minor typo

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

* Add connection stats/score to subscribed audio tracks

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

* Cleanup

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

* Ignore duplicate LastSequenceNumbers in rtcp reports

Ignore if sequence number is less than what was recieved

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

* Move video track score calc to media/downtracks

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

* Deprecate SubscribeLossPercentage() as score calc is now handled downstream

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

* Initialize connection  score to excellent

score is calc at 5sec interval. Client fetches score before first
score is computed

* Update test cases for connection quality

Signed-off-by: shishir gowda <shishir@livekit.io>
2021-12-20 07:54:14 -05:00
Raja Subramanian
1dcc62b569 SubscribedQualityUpdate message (#270)
* WIP commit

* SubscribedQualityUpdate message to send list of currently subscribed
qualities for a simulcast video publisher

* Correct subscriberID

* goimports

* Do quality update on add/remove of subscribed track

* do not update quality when admin mute is active

* update quality on admin unmute

* Update protocol version

* Simplify max subscribed quality loop per David's suggestion
2021-12-19 12:41:40 +05:30
David Colburn
faa870de3d Move callbacks out of messageRouter (#269)
* move callbacks out of messageRouter

* OCD

* more OCD

* fix forwarder test

* even more OCD

* maximum OCD

* package name collision, copy lock by value
2021-12-17 13:19:23 -08:00
Raja Subramanian
e504b6678c Deficient state handling when a track needs a change (#261)
* WIP commit

* deficient handling

* Add missing ProvisionalAllocatePrepare

* adjust state on track removal

* Increase test timeout

* - Add comments about cooperative routines
- Take down transition if available in cooperative scheme
- Use layer comparison when taking down transition. Because of when the
  bitrate is measured, it is not always guaranteed bandwidthDelta is -ve
  when moving down.
- Do not add track to stream allocator till bind.

* make comment better

* a bit more clear comments

* Use OnBind on subscribed track
2021-12-16 10:58:34 +05:30
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 Zhao
318bee4f1e Improve video quality selection by using publisher feedback (#238) 2021-12-06 12:12:08 -08:00
Raja Subramanian
98695cdd22 downstream allocator (#155)
* WIP branch to hash out down stream allocator.

* Plug more bits of stream allocator

* update protocol

* remove SignalRequest_Simulcast (#154)

* Plug more bits of stream allocator

* Handle simulcast track available layers change

* WIP branch to hash out down stream allocator.

* Plug more bits of stream allocator

* Handle simulcast track available layers change

* Adopt signature of call to AdjustAllocation

* Move StreamAllocator to PCTransport and allocate only for subscriber.

* Move streamallocator to ion-sfu

* Start/Stop of streamallocator

* Use StreamAllocator for subscriber bandwidth management.

* Do not allocate in ADD_TRACK

* Set payload in constructor

* - Add some logging
- Protocol message to notify clients of paused/resumed streams

* named return

* oops correct sense of isPausing

* Update pkg/sfu/streamallocator.go

Committing David's suggestion.

Co-authored-by: David Zhao <david@davidzhao.com>

* - Log estimate changes/commits.
- Catch more than epsilon change oscillating for long time.

Co-authored-by: David Colburn <xero73@gmail.com>
Co-authored-by: David Zhao <david@davidzhao.com>
2021-11-26 09:11:04 +05:30
Raja Subramanian
391e2f8b31 Separate out max layer setting (#201)
Small step on the way to making StreamAllocator prioritization of tracks.
With the new callback into StreamAllocator, the idea is to use the
max layer information to do track prioritization.

Testing:
--------
Sanity check that sample app works
2021-11-22 14:01:25 +05:30
cnderrauber
1e1aaeb86b Separate from ion-sfu (#171)
* Separate from ion-sfu

changes:
1. extract pkg/buffer, twcc, sfu, relay, stats, logger

2. to solve cycle import, move ion-sfu/pkg/logger to pkg/sfu/logger

3. replace pion/ion-sfu => ./
reason: will change import pion/ion-sfu/pkg/* to livekit-server/pkg/*
after this pr merged. Just not change any code in this pr, because it
will confused with the separate code from ion-sfu in review.

* Move code from ion-sfu to pkg/sfu

* fix build error for resovle conflict

Co-authored-by: cnderrauber <zengjie9004@gmail.com>
2021-11-09 12:03:16 +08:00
David Zhao
8344466629 Delete unused code 2021-11-07 21:10:40 -08:00
David Zhao
aa9534b7fb Server-driven connection quality detection (#167) 2021-11-03 21:05:20 -07:00
David Zhao
0898c17e8a Select video quality using provided dimensions (#158) 2021-10-28 21:01:05 -07:00
David Colburn
8a44fad307 protocol 0.8 (#95)
* protocol 0.8

* merge new selector
2021-08-27 13:16:33 -05:00
David Zhao
55eb654a1b When adaptive-simulcast is used, allow subscribers to switch to the next available layer (#55) 2021-07-16 14:24:00 -07:00
David Zhao
c0c38f2e1d Fixed deadlocks with updated simulcast logic 2021-06-25 17:12:22 -07:00
David Zhao
0c75924c73 increase subscription debounce interval 2021-06-23 12:44:40 -07:00
David Zhao
3b2b3a4929 debounce track settings API to match client usage pattern 2021-06-22 14:13:24 -07:00
David Zhao
38c81e5645 Support for video dimensions in publications (#36)
* send back video dimensions

* Store video dimensions in MediaTrack and forward in TrackInfo

* use committed protocol
2021-06-18 21:05:56 -07:00
David Zhao
7d02c01fd8 refactor - moved common code to livekit/protocol 2021-03-13 22:01:51 -08:00
David Zhao
e402d0d0af subscriber control of tracks (unsubscribe/mute/quality), support simulcast (#23)
* subscription control & simulcast RTC APIs

* don't remove tracks for simulcast
2021-02-16 13:52:50 -08:00
David Zhao
f1f5b8dafe use proper fix for using shared bufferFactory, remove resync hack 2021-02-07 23:06:16 -08:00
David Zhao
ae203c27e3 send resync to ensure keyframes have been requested 2021-02-06 23:02:21 -08:00