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>
This commit is contained in:
Raja Subramanian
2021-11-26 09:11:04 +05:30
committed by GitHub
co-authored by David Colburn David Zhao
parent 9aff9af690
commit 98695cdd22
11 changed files with 470 additions and 318 deletions
+10 -2
View File
@@ -32,6 +32,7 @@ type StreamTracker struct {
CyclesRequired uint64
CycleDuration time.Duration
OnStatusChanged func(StreamStatus)
initialized atomicBool
paused atomicBool
status atomicInt32 // stores StreamStatus
countSinceLast uint32 // number of packets received since last check
@@ -50,7 +51,7 @@ func NewStreamTracker() *StreamTracker {
CyclesRequired: 60, // 30s of continuous stream
CycleDuration: 500 * time.Millisecond,
}
s.status.set(int32(StreamStatusActive))
s.status.set(int32(StreamStatusStopped))
return s
}
@@ -103,6 +104,13 @@ func (s *StreamTracker) Observe(sn uint16) {
if s.paused.get() {
return
}
if !s.initialized.get() {
s.initialized.set(true)
// first packet
go s.setStatus(StreamStatusActive)
}
// ignore out-of-order SNs
if (sn - s.lastSN) > uint16(1<<15) {
return
@@ -125,7 +133,7 @@ func (s *StreamTracker) detectWorker() {
}
func (s *StreamTracker) detectChanges() {
if s.paused.get() {
if s.paused.get() || !s.initialized.get() {
return
}