Commit Graph

65 Commits

Author SHA1 Message Date
Raja Subramanian
fd27a70fe2 stream allocator <-> down track misc changes/clean up (#1512) 2023-03-13 07:45:59 +05:30
Raja Subramanian
c70aa616a9 Expected vs actual Layer based connection quality. (#1509)
* Expected vs actual Layer based connection quality.

With VBR streams (like screen share), bit rate is not a good indicator
of whether desired layer (spatial/temporal) is achieved due to high
variance.

Using expected vs actual layer (i. e. distance to desired) can capture
any short fall and include it in quality scoring.

This PR uses distance to desired, i. e. how many steps it would take to
go from actual spatial/temporal -> desired spatial/temporal and that
distance is propotionally used (currently it is just linear) to decrease
score.

* wire up layer transitions for screen share tracks
2023-03-10 13:08:36 +05:30
Raja Subramanian
15232560bc Send stream start on initial start (#1456)
A couple of other bits
1. Use request layer for sending PLI on bind and connected.
2. When adjusting for overshoot, do not adjust target unless current is
   at max. If not, it could get stuck in a lower layer in the following
   scenario
      a. Overshoot to layer 2
      b. Max layer is 1, start sending PLI
      c. Get key frame for layer 0, adjust for overshoot as we have
         something at a layer lower than max.
      d. Adjust for overshoot.
      e. Setting target to max means that current and target are equal
         and no further adjustment happens.
2023-02-23 09:35:12 +05:30
Raja Subramanian
c51d083016 Handle edge case of no published layer (#1446)
* WIP commit

* set max published layer

* split target and request layer
2023-02-20 14:16:46 +05:30
Raja Subramanian
8a7478fd0e Send stream state paused only when it is paused due to bandwidth limitation. (#1391)
* WIP commit

* Send stream state paused only when it is paused due to bandwidth limitation.

When stream is resumed after a stream is paused, an active update is
sent. Note that this means if there are intervening events like
mute/unmute between pause and resume, resume will be sent.
2023-02-08 20:03:32 +05:30
cnderrauber
fe4da84ee9 send padding packets of muted uptrack for go sdk (#1283) 2023-01-04 16:01:04 +08:00
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