Commit Graph

59 Commits

Author SHA1 Message Date
David Zhao
02537a121d Store initial track MimeType in TrackInfo (#1065) 2022-09-30 23:33:22 -07:00
Raja Subramanian
d70843bc5a Some logging tweaks (#1048) 2022-09-28 23:54:40 +05:30
Raja Subramanian
26e6024137 Log NACK information in stream allocator. (#1018) 2022-09-19 14:33:16 +05:30
Raja Subramanian
d8ae453fb9 Handle exempted layers (#983)
* WIP commit

* WIP commit

* Add tests

* remove debug
2022-09-05 18:42:59 +05:30
Raja Subramanian
aaa3a5b46e Transport restructure (#944)
* WIP commit

* WIP commit

* fix copy pasta

* setting PC with previous answer has to happen synchronously

* static check

* WIP commit

* WIP commit

* fixing transport tests

* fix tests and clean up

* minor renaming

* FIx test race

* log event when channel is full
2022-08-24 14:31:45 +05:30
Raja Subramanian
adf2d191b0 Re-use transceiver (via ReplaceTrack) if a down track is going to be resumed. (#785)
* WIP commit

* Clean up

* spelling mistake

* Run subscribed track onBind in a go routine

* Address comments and more safety net
2022-06-24 15:07:48 +05:30
Raja Subramanian
d77a8ad916 Use proper type cast (#719) 2022-05-26 13:58:46 +05:30
Raja Subramanian
547ab908f5 Coalesce track events into stream allocator. (#701) 2022-05-21 00:40:02 +05:30
Raja Subramanian
8d0998ed1d Bump up stream allocator event queue size (#700)
This probably needs more work
- Maybe some events should not be queued
- Reduce number of events

Bump up the size any way so that the queue does not overflow
when subscribing to a lot of tracks.
2022-05-20 09:54:10 +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
4d7950ec2f Do not send down track callbacks to streamallocator via queue (#651) 2022-04-24 21:41:58 +05:30
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
Raja Subramanian
ee7bb0a1ad Log both estimate and nack ratio when congestion detected (#608) 2022-04-10 12:09:11 +05:30
Raja Subramanian
92009b6428 Consistently stop tickers (#593) 2022-04-05 20:42:06 +05:30
David Colburn
0b8a180554 Code inspection (#581)
* Code inspection

* fix [4]int64 conversiong
2022-03-30 13:49:53 -07:00
Raja Subramanian
f694dad105 Reset available layers when removing all trackers (#575) 2022-03-29 08:16:18 +05:30
Raja Subramanian
757a59fbcd Use windowing for NACK monitoring (#557)
* Use windowing for NACK monitoring

* Fix test
2022-03-23 13:42:29 +05:30
Raja Subramanian
076eb1c8ae Dampen stream allocator (#551)
* WIP commit

* WIP commit

* WIP commit

* format

* NACK window

* Remove layer when it is expected to stop

* Remove debug
2022-03-22 22:23:22 +05:30
Raja Subramanian
0a88dee95e A minimum channel capacity config (#549) 2022-03-22 13:13:48 +05:30
Raja Subramanian
641858832a Address edge case stream allocation (#544)
* Handle an edge in layer lock.

A very edge case
- Available layer: [0, 1, 2], but bitrate is not yet available.
We set it to layer 2 awaiting measurement.
- Measurement for layers 0 and 1 come through.
- Still no key frame for layer 2.
- Finalize layers runs and sees that bitrate is available for 0 and 1.
It finalizes layer 1.
- Layer 1 key frame comes (because we asked key frame of layer 2,
publisher sends key frame for all layers). Locks to layer 1.
- No more events happen to switch to layer 2.

Changes
-------
- Move bit rate measurement to StreamTrackerManager. Allows re-use
in relay.
- Make bit rate availability (from zero -> non-zero) an event
and let it flow through the stream allocation flow so that we
always have an event when bit rate measurement becomes available.
This gets rid of finalization which I was unhappy with it anyway as
it was polling every second.
- Removing REMB stuff from buffer. We do not use it.
It is incorrect anyway. REMB should be ay peer connection level.

* Fix test

* fix test

* Simplify allocate

* Simplify/clean up
2022-03-21 14:53:31 +05:30
Raja Subramanian
d738424173 Catch a few edge cases in stream allocator. (#532)
* Catch a few edge cases in stream allocator.

- More useful logging

* fire probe cluster done callback only when there is an active cluster
2022-03-18 20:42:15 +05:30
Raja Subramanian
b6975bf7cd Track source based stream tracker config (#503)
* Track source based stream tracker config

* SCREEN_SHARE_AUDIO is an audio source
2022-03-11 12:15:12 +05:30
Raja Subramanian
13e21e7c45 Callback queue for a couple of modules (#468)
* callback queue for stream tracker

* Ops queue for down track

* fix test
2022-03-01 09:55:13 +05:30
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
f209e9319a Reset channel observer in resetState (#449)
* Reset channel observer in resetState

* Spelling fix
2022-02-20 20:52:17 +05:30
Raja Subramanian
1e459e91cc Stream priority (#448) 2022-02-19 13:17:55 +05:30
Raja Subramanian
dd4cec7724 Deleting unused code in stream allocator (#447) 2022-02-18 21:10:52 +05:30
Raja Subramanian
babbfb37aa Include NACK ratio in congestion control (#443)
* WIP commit

* WIP commit

* WIP commit

* WIP commit

* WIP commit

* WIP commit

* WIP commit

* WIP commit

* Clean up

* Remove debug

* Remove unneeded change

* fix test

* Remove incorrect comment

* WIP commit

* Reset probe after estimate trends down

* WIP commit

* variable name change

* WIP commit

* WIP commit

* out-of-order test

* WIP commit

* Clean up

* more strict probe NACKs
2022-02-18 14:21:30 +05:30
Raja Subramanian
d04f4d12d1 Throttle RTX under certain conditions to prevent RTX storm (#440)
* WIP commit

* WIP commit

* WIP commit

* WIP commit

* WIP commit

* WIP commit

* WIP commit

* WIP commit

* Clean up

* Remove debug

* Remove unneeded change

* fix test

* Remove incorrect comment

* WIP commit

* Reset probe after estimate trends down

* WIP commit

* variable name change

* Clean up

* Remove debug logs

* gofmt
2022-02-17 13:33:44 +05:30
Raja Subramanian
0bbed7f0bd Use padding for probing (#434)
* WIP commit

* WIP commit

* WIP commit

* WIP commit

* WIP commit

* WIP commit

* WIP commit

* WIP commit

* Clean up

* Remove debug

* Remove unneeded change

* fix test

* Remove incorrect comment

* Reset probe after estimate trends down
2022-02-17 11:03:23 +05:30
Raja Subramanian
f3a6f58006 Use correct publisher id in stream state update (#432) 2022-02-11 12:09:48 +05:30
Raja Subramanian
a6338992e8 Stop forwarding on congestion (#429)
* WIP commit

* comment out debug stuff
2022-02-11 09:17:53 +05:30
David Colburn
7bbd238188 clean up logs and imports (#400) 2022-02-03 14:20:19 -07:00
Raja Subramanian
247807b2cc Use an atomic flag to stop stream allocator (#395)
* Use an atomic flag to stop stream allocator

* use a mutex for event channel

* RLock while posting event

* lock isStopped flag to prevent posting to closed channel
2022-02-01 12:41:37 +05:30
Raja Subramanian
0178a004dd Compile in send-side bandwidth estimation. (#351)
Still not using it. But, now that Pion has merged the initial
version of GCC (Google Congestion Control) for send side bandwidth
estimation, we can integrate it.

We will enable once we have tested and feel comfortable.
2022-01-19 22:36:41 +05:30
David Colburn
5bea9debb7 Code cleanup (#353) 2022-01-19 02:13:06 -08:00
Raja Subramanian
017ed13338 Prevent multiple resume notifications on track (#334)
* Prevent multiple resume notifications on track

When returning previous allocation as is, reset change to none.
Ideally, would like to have change as a separate return and not in last
allocation. But, also prefer to have last allocation state. For now,
resetting change.

* log bandwidth estimate only on decrease
2022-01-12 23:19:56 +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
66a1ffe414 Allow cooperative allocation (#309) 2022-01-01 13:43:34 +05:30
Raja Subramanian
fc95757c7d Do not pause if pause is not allowed (#307) 2021-12-31 09:58:13 +05:30
Raja Subramanian
98586c2490 A simple configuration for congestion control. (#305) 2021-12-31 00:26:29 +05:30
Raja Subramanian
107e7bbb39 Configurable bandwidth estimation side (#298)
* Fix tests

Add back adding track to publishedTracks for testing purposes.

* WIP branch

* Don't know why merge from `master` did not catch this change.

* WIP commit

* Hook up all the bits for TWCC to work

* Fix typo

* WIP commit

* Catch up to latest API

* Move RTP/RTCP info config

* Instantiate GCC/TWCC interceptor only when in use

* comment SSBWE parts

* RTCP feedback in publisher config
2021-12-30 20:09:03 +05:30
Raja Subramanian
ee99a323d2 Publisher controlled flex permissions (#284)
* WIP commit

* Add some tests

* allowedSubscribers uses participant sid

* correct variable name

* correct another variable name

* Add ParticipantSid to SubscriptionPermissionUpdate message

* protocol v0.11.2

* WIP commit

* WIP commit

* fix tests

* Remove unused code

* Close uptrack manager

* Remove duplicate close

* move comment to the correct line where the loop could be long

* Fix disallowed list revocation, thank you Jie

* Remove unneeded interface method

* RemoveSubscriber in Participant

* Clean up disallowed subscriptions and handle permissions on new track addition

* add test for track addition after permission set

* Remove unnecessary check
2021-12-24 14:14:40 +05:30
David Colburn
0b71a46239 missed some typos 2021-12-17 13:25:41 -08:00
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
8abd734d16 Use participant and room specific loggers (#252) 2021-12-10 15:51:05 -08:00
Raja Subramanian
7948fabce0 StreamAllocator tweaks (#240)
* WIP commit

* test padding only with a gap scenario

* Debug

* Fix video corruption, need buffer to include payload and translated header size

* Revert incorrect change

* Fix VP8 translation to return buffer with proper length

* Restore 7-bit mode

* WIP commit

* Clean up

* More clean up and tests compiling again

* Fix tests
2021-12-08 21:56:07 +05:30
Raja Subramanian
5dc0a43b29 Unit tests for sfu.Forwarder (#239) 2021-12-07 02:51:08 +05:30