Commit Graph

987 Commits

Author SHA1 Message Date
Raja Subramanian 91728fa59b More defensive checks for mime. (#3394) 2025-02-03 12:07:12 +05:30
Raja Subramanian 92e3f2e3d0 Starting on padding for RTX stream is accepted. (#3390) 2025-02-02 20:26:30 +05:30
Raja Subramanian 20b400faef Use signed check on rollback. (#3389) 2025-02-01 14:16:53 +05:30
Raja Subramanian adc2246353 Move sequence number adjustment to when out-of-order is detected (#3387)
initially.

Out-of-order reception is detected and dropped before this change. By
moving the adjustment to that point, potentially more reports can be
processed.
2025-01-31 11:56:48 +05:30
Raja Subramanian a4ccc7cc7f Run bandwidth estimation when congestion is relieved also (#3380) 2025-01-30 11:57:58 +05:30
Raja Subramanian 1b86b485a9 Fix (hopefully) state transition. (#3375)
My previous PR was trying to fix a premature transition from CONGESTED -> NONE state.
But, that introduced a bug which accelerated the transition from EARLY_WARNING -> CONGESTED state due to holding the `queuingRegion` state variable.

Fix by not holding `queuingRegion` in state and take result of
processing runs.

NOTE: This can still use some work to make the state machine cleaner.
Initially, I was passing around a bunch of variables which was uncouth.
Then moved things to state which made code easier to read and also log
different things, but it causes problems like the ones above. Will take
another look and think more about making it more robust.
2025-01-29 01:00:53 +05:30
Raja Subramanian 59be7c601b Declare congestion none only if both methods are in DQR. (#3372)
* Declare congestion none only if both emthods are in DQR.

* do not change congestion reason unless queuing region changes
2025-01-28 14:10:23 +05:30
Raja Subramanian 2b5ee12f9b Reduce chances of metadata cache overflow. (#3369) 2025-01-27 18:14:57 +05:30
Raja Subramanian 0c28e432a3 Log RTT as seen by congestion controller (#3354) 2025-01-22 00:08:11 +05:30
Raja Subramanian 7a7e312424 Log probes. (#3352) 2025-01-21 20:51:03 +05:30
Raja Subramanian bea907b3a0 Request key frame on subscription change. (#3349)
To assist the path where the requested layer is higher than current seen
maximum and there is no congestion.
2025-01-20 18:45:05 +05:30
Raja Subramanian 35bb36e5fb Request key frame if subscribed is higher than max seen and not (#3348)
congested.
2025-01-20 16:40:52 +05:30
Raja Subramanian fe94a18bc2 Do not seed if stream is already writable. (#3347)
* Do not seed if stream is already writable.

It is possible that in migration case, when the forwarder state is
fetched from migrating out node and used to seed downtrack, it has
already started due to the time it takes to get the state. Seeding in
that state will reset things and cause large sequence number gaps
potentially.

* do not take lock
2025-01-20 11:08:59 +05:30
Raja Subramanian e2162f704a Do not send DD extension if ID is 0. (#3339)
* disable temporal layer scaling

* remove dummy start

* do not add 0 id

* remove tests

* clean up
2025-01-17 01:08:12 +05:30
Raja Subramanian 043464828a Correct off-by-one lost count on a restart. (#3337)
* Correct off-by-one lost count on a restart.

* log sender snap shot ID

* metadata cache overflow count per snapshot
2025-01-16 23:41:41 +05:30
cnderrauber e2735f3bd1 remove dd debug logs (#3334) 2025-01-15 13:27:21 +08:00
Raja Subramanian ae8c8bc941 Turn off TWCC for Firefox (#3333)
* Debug FF TWCC

* - TURN off TWCC for Firefox. Seems to fail with VP9 send, i.e. there are
  no TWCC feedback packets when sending VP9.
- Relax thresholds for congestion as staging data is showing
  oscillations.
- Clean up some logging.

* debug log a few more signal messages

* revert config

* revert config

* clean up
2025-01-15 10:32:59 +05:30
Raja Subramanian 8e90ae03f5 Log min sequence number changes. (#3331)
Seeing some negative loss count (seems to be when interacting with
Firefox, but don't have definitive proof it does not happen with
others). Debug logging a bit to understand what could cause it.

Also, consolidating some common code to process packet feedback.
2025-01-14 15:30:11 +05:30
Raja Subramanian 7c58fdf329 move unrolled mime type check for broader use (#3326)
* move unrolled mime type check for broader use

* Use in IsSvcCodec and make MimeType exported

* test

* tidy branches

* tidy

---------

Co-authored-by: Paul Wells <paulwe@gmail.com>
2025-01-13 10:24:03 +05:30
Raja Subramanian 53d300ba71 Use nano time for easier (and hopefully) faster checks/calculations. (#3323) 2025-01-12 00:56:46 +05:30
Raja Subramanian 0d9bad489c Remove duplicate SSRC get. (#3318)
The duplicate was not checking for `nil`. The SSRC is already loaded
with proper nil check before.
2025-01-08 22:50:34 +05:30
Raja Subramanian 0dde347615 Use contiguous groups to determine queuing region. (#3308) 2025-01-07 04:00:39 +05:30
Raja Subramanian bfbc4fa81f Remove alloc in packet forwarding path. (#3305)
* Remove alloc in packet forwarding path.

Unlikely logger creation was doing allocs. Replace it with a function
like in rtpstats_receiver.go so that allocations do not happen
unnecessarily.

* variable rename

* one more place
2025-01-06 11:48:27 +05:30
cnderrauber 384e21abc0 vp8 temporal layer selection with dependency descriptor (#3302)
* vp8 with dd

* make temporal layer selection work with DD

* fix test

---------

Co-authored-by: boks1971 <raja.gobi@tutanota.com>
2025-01-03 21:26:03 +08:00
Raja Subramanian 238333985b BWE reset for probing. (#3295) 2024-12-31 23:22:47 +05:30
Artur Melanchyk 2eaf84ad66 Reduce memory allocation in WritePaddingRTP / WriteProbePackets (#3288)
* allocate memory once in WriteProbePackets

Signed-off-by: Artur Melanchyk <artur.melanchyk@gmail.com>

* allocate memory once in WritePaddingRTP

Signed-off-by: Artur Melanchyk <artur.melanchyk@gmail.com>

---------

Signed-off-by: Artur Melanchyk <artur.melanchyk@gmail.com>
2024-12-25 21:01:21 -06:00
Raja Subramanian 6e9964e80b TWCC tweaks (#3282)
* SSBWE experimentation

* dqr hysteresis

* fixes

* fmt

* more relaxed DQR

* pps proportional to duration

* clean up

* clean up

* don't need gratuitous up allocation
2024-12-21 23:08:38 +05:30
cnderrauber 8fa1127724 Disable data channel throttle by default (#3281)
* Disable data channel throttle by default

* data race

* err type
2024-12-21 12:08:54 +08:00
Raja Subramanian 92ae45cf07 Keep more state for easier logging/debuggability (#3280) 2024-12-21 09:33:04 +05:30
Raja Subramanian c8b644934f Update deque and friends. (#3276) 2024-12-20 07:16:14 +05:30
cnderrauber 99364f39d0 Keep negotiated codec parameters in Downtrack.Bind (#3271)
the context's codec parameters will be set to the binded codec after Bind
2024-12-19 16:16:09 +08:00
Raja Subramanian 02117a4d46 Panic fixes (#3270)
Also, do negotiated down track extensions after bind.
2024-12-19 11:52:43 +05:30
Raja Subramanian 2088870d95 check of 0 RTX payload in probe and use padding if 0 (#3269) 2024-12-19 09:18:32 +05:30
Raja Subramanian edb426bba4 Log payload RTX. (#3268)
Seeing some instances where RTX is not getting set up.
2024-12-19 02:03:26 +05:30
Raja Subramanian 86628de6e9 Lower down trend threshold (revert change in previous PR) and fix typos. (#3267)
* fix typo

* lower CTR threshold
2024-12-19 00:03:56 +05:30
Raja Subramanian b6e99e249b Better naming/logging for send side bwe (#3264)
* Better naming/logging for send side bwe

* Check BWE congestion state before doing optimal allocation.

It is possible that BWE declares congestion, but the estimated bandwidth
may still be enough to accommodate all tracks. So, stream allocator
would still not in DEFICIENT state. On a new track allocation, it will
get optimal allocation although BWE is in congested state.

Take BWE congestion state into consideration before doing any track
allocation.

* get congestion state from BWE rather than caching it in stream allocator

* get states from update

* log contributing groups only when they are small in number

* get oldest group always

* notify only when estimate is dropping

* require stronger CTR down trend

* maintain min/max group

* relax thresholds to declare congestion a bit
2024-12-18 21:38:13 +05:30
Raja Subramanian 45b0b0312f Remove spammy log (#3263) 2024-12-18 13:34:20 +05:30
cnderrauber 713e67cd52 Thottle the publisher data channel sending when subscriber is slow (#3255)
* Thottle the publisher data channel sending when subscriber is slow

Avoid the publisher overwhelm the sfu data channel buffer when
the subscriber has lower receive bitrates. It will drop message
if the subscriber is considered too slow to block the entire room.

* Enable nack in mediaengine and disable it in transceiver as need

pion doesn't support per transciver codec configuration, so the nack of this session will be disabled
forever once it is first disabled by a transceiver.
https://github.com/pion/webrtc/pull/2972
2024-12-18 10:51:34 +08:00
cnderrauber b684da380e log frame number jump on dd structure updating (#3261) 2024-12-17 17:31:05 +08:00
Raja Subramanian b3efdfcfe5 Up allocate to available headroom. (#3259)
There are cases where the probe result has enough headroom to up
allocate all deficient tracks. Mainly happens after a loss scenario
where the estimate is actually still high.

After boosting once, there was a check for the track to hit the desired
layer before boosting again. But, that is not really necessary. Can
boost target and forwarder should resolve to the latest target.
Removing that check in the forwarder.

Also, adding a gratuitous boost check in stream allocator periodic ping
when deficient to look for opportunities to boost.
2024-12-17 10:49:14 +05:30
Raja Subramanian aef80d92d0 Handle REMB on RTX RTCP (#3257) 2024-12-16 17:37:03 +05:30
Raja Subramanian 192ecbfc88 Dampen oscillations in loss based congestion detection when using TWCC. (#3256)
* Rework congestion detection state machine

* WIP

* fmt

* clean up

* revert config
2024-12-16 15:26:23 +05:30
Raja Subramanian 699cd9c26c BWE minor tweaks (#3254)
- Clear probe id in downtracks when aborting probe
- a bit of clean up
2024-12-16 08:04:24 +05:30
Raja Subramanian be65d24333 Add method to check for probe goal reached (#3253)
* Check for early probe end

* use old packets for probing

* fmt
2024-12-15 23:34:07 +05:30
Raja Subramanian cfe3178542 Reconcile RTP stats with RTX data. (#3252)
* RTX RTPStats

* WIP

* RTCP RTX handler

* reconcile rtx

* cache size

* clean up

* test

* clean up
2024-12-15 14:33:02 +05:30
Raja Subramanian 34ccc2a578 Remote BWE tweaks (#3251) 2024-12-14 15:39:19 +05:30
Raja Subramanian 8cfea87ad0 Use RTX channel for bandwidth probing (#3250) 2024-12-14 11:51:58 +05:30
cnderrauber 5dd6858acf Don't wait rtp packet to fire track (#3246)
* Don't wait rtp packet to fire track

Create track from sdp instead of first rtp packet,
it is consistent with the browser behavior and
will accelerate the track publication.

* fix test
2024-12-13 15:06:14 +08:00
Raja Subramanian 789d0484e2 Add RTX to downstream (#3247)
* Add RTX to downstream

* test
2024-12-13 09:57:03 +05:30
Raja Subramanian 79eda6b72b Send side BWE: tighter contributing groups (#3245)
* WIP

* clean up

* debug

* epm log

* debug

* fmt

* clean up

* default no SSBWE

* clean up
2024-12-12 14:22:31 +05:30