Commit Graph

182 Commits

Author SHA1 Message Date
Raja Subramanian
dd995899bf Handle extreme case of sender report lagging. (#1892) 2023-07-19 12:50:03 +05:30
Raja Subramanian
66de9ff4a0 Add debug log for RTCP sender report. (#1890)
* Add debug log for RTCP sender report.

Temporary to collect more data. Hitting scenarios under congestion
where the sender report gets off sync. Need some data to pore through
and understand and implement changes.

* Debugw
2023-07-18 23:21:06 +05:30
Raja Subramanian
f41b93657e Log a bit more in sender report warp report. (#1888) 2023-07-18 09:14:41 +05:30
Raja Subramanian
4c02a6d717 Time stamp adjustments v2 (I think) (#1875)
* WIP commit

* WIP commit

* WIP commit

* Some clean up
- Removed a chatty debug log
- some spelling, punctuation correction in comments
- missed an `Abs` in check, add it.
2023-07-14 11:47:07 +05:30
Raja Subramanian
bf3732b898 Remove noisy debug logs. (#1858) 2023-07-08 11:58:56 +05:30
Raja Subramanian
cea41e4189 Discount out-of-order packets in downstream score. (#1831)
* Discount out-of-order packets in downstream score.

More notes inline.

* correct comment

* clean up comment
2023-06-27 17:44:53 +05:30
cnderrauber
5b975af55f Refine dependency descriptor based selection forwarder (#1808)
* Don't update dependency info if unordered packet received

* Trace all active svc chains for downtrack

* Try to keep lower decode target decodable

* remove comments

* Test case

* clean code

* solve comments
2023-06-27 15:11:06 +08:00
Raja Subramanian
908b7a9bb1 Promote some migration logs to Infow (#1798) 2023-06-16 19:00:17 +05:30
Raja Subramanian
9809b8bc3a Use nack queue params. (#1789)
* Use nack queue params.

* fix test
2023-06-12 13:01:02 +05:30
cnderrauber
c91889edfd Add dependency descriptor stream tracker for svc codecs (#1788)
* Add dependency descriptor stream tracker for svc codecs

* Solve comments
2023-06-12 15:07:47 +08:00
Raja Subramanian
f518f5d743 Log head SN when packet cannot be fetched (#1780) 2023-06-09 12:13:06 +05:30
Raja Subramanian
b591140d66 Ignore receiver report till initialized (#1773) 2023-06-06 21:43:49 +05:30
Raja Subramanian
7ed3af193a No proof that this helps (#1772) 2023-06-06 11:28:13 +05:30
Raja Subramanian
f5c5d4e079 Wait for a more stable measurement of sample rate. (#1764) 2023-06-03 14:26:26 +05:30
Raja Subramanian
c2ae34151c Enable some debug logs to debug freeze (#1761)
* Enable some debug logs to debug freeze

* log receiver sender report also
2023-06-02 16:31:19 +05:30
Raja Subramanian
13d599d2d9 Comment out noisy log. (#1757) 2023-05-31 06:35:25 +05:30
Raja Subramanian
ea57e4f2c1 Ignore receiver reports that have a sequence number before first packet. (#1745) 2023-05-28 10:05:35 +05:30
Raja Subramanian
9dd2ebc960 Change too many packets log to error to get back trace. (#1744) 2023-05-27 12:19:30 +05:30
Raja Subramanian
0354626bfc Adjust sender report time stamp for slow publishers. (#1740)
It is possible that publisher paces the media.
So, RTCP sender report from publisher could be ahead of
what is being fowarded by a good amount (have seen up to 2 seconds
ahead). Using the forwarded time stamp for RTCP sender report
in the down stream leads to jumps back and forth in the down track
RTCP sender report.

So, look at the publisher's RTCP sender report to check for it being
ahead and use the publisher rate as a guide.
2023-05-25 21:55:54 +05:30
Raja Subramanian
11c5737e04 Filter another expected error. (#1738)
Actually, was not filtering the not last sender report error before.
Previous PR did that. This PR restores the old no last sender report
filter. Both are filterable errors.
2023-05-24 12:41:47 +05:30
Raja Subramanian
07252b7ce3 Filter not last SR error (#1737) 2023-05-24 12:32:12 +05:30
Raja Subramanian
0bb89575eb Fix min TS before first sender report (#1724) 2023-05-19 12:43:19 +05:30
Raja Subramanian
1d3faefc5e More scoring tweaks (#1719)
1. Completely removing RTT and jitter from score calculation.
   Need to do more work there.
   a. Jitter is slow moving (RFC 3550 formula is designed that way).
      But, we still get high values at times. Ideally, that should
      penalise the score, but due to jitter buffer, effect may not be
      too bad.
   b. Need to smooth RTT. It is based on receiver report and if one
      sample causes a high number, score could be penalised
      (this was being used in down track direction only). One option
      is to smooth it like the jitter formula above and try using it.
      But, for now, disabling that also.

2. When receiving lesser number of packets (for example DTX), reduce the
   weight of packet loss with a quadratic relationship to packet loss
   ratio. Previously using a square root and it was potentially
   weighting it too high. For example, if only 5 packets were received
   due to DTX instead of 50, we were still giving 30% weight
   (sqrt(0.1)). Now, it gets 1% weight. So, if one of those 5 packets
   were lost (20% packet loss ratio), it still does not get much weight
   as the number of packets is low.,

3. Slightly slower decrease in score (in EWMA)

4. When using RED, increase packet loss weight thresholds to be able to
   take more loss before penalizing score.
2023-05-18 20:16:43 +05:30
Raja Subramanian
9395f0b1fb More time stamp dance. (#1712)
Two things
- Somehow the publisher RTCP sender report time stamp goes back some
  times. Log it differently. Also, use signed type for logging so
  that negative is easy to see.
- On down track, because of silence frame injection on mute, the RTCP
  sender report time stamp might be ahead of timestamp we will use
  on unmute. If so, ensure that next timestamp is also not before
  what was sent in RTCP sender report.
2023-05-16 21:48:10 +05:30
Raja Subramanian
61102533ae Monitor and log RTP time stmap drifts (#1710)
The PID controller seems to be working well. But, it is unclear where
it can be applied as some of the data shows significant jumps
(either caused by BT devices or possibly noise cancellation/cpu
constraint) and although PID controller is slowly pulling things
to expected sample rate, it could be a bit slow.
Unfortunately, cannot munge too much in a middle box.
However leaving the controller in there as it is doing its job
for cases where things slip slowly.

Changing things to log significant jumps (more than 200 ms away
from expected) at Infow level.

Also, recording drift and sample rate in RTP stats proto and string
representation.
2023-05-13 18:41:09 +05:30
Raja Subramanian
4419cd56b8 Switch to rate since first time. (#1704)
With short term measurements, the adjustment itself was causing
some oscillations and drift tend to settle at some small value
and oscillated around it due to push/pull affecting small window
measurement.
2023-05-10 11:01:51 +05:30
Raja Subramanian
f543e3f8d0 Send left over RTCP packets. (#1699) 2023-05-09 18:46:30 +05:30
Raja Subramanian
0e582ec82a fix the negative sign scope (#1696) 2023-05-09 00:13:01 +05:30
Raja Subramanian
153f02091c Use measurement in window instead of since start. (#1695)
This captues chnages within a measurement window.
2023-05-08 19:51:23 +05:30
Raja Subramanian
ddcb8342ef Fix Dervivative equation wrong brackets (#1693) 2023-05-07 18:36:26 +05:30
Raja Subramanian
3fb93135f5 Experimental flag to try time stamp adjustment to control drift. (#1687)
* Experimental flag to try time stamp adjustment to control drift.

There is a config to enable this.

Using a PID controller to try and keep the sample rate at expected
value. Need to be seen if this works well. Adjustment are limited
to 25 ms max at a time to ensure there are no large jumps.
And it is applied when doing RTCP sender report which happens
once in 5 seconds currently for both audio and video tracks.

A nice introduction to PID controllers - https://alphaville.github.io/qub/pid-101/#/
Implementation borrowed from - https://github.com/pms67/PID

A few things TODO
1. PID controller tuning is a process. Have picked values from test from
   that implementation above. May not be the best. Need to try.
2. Can potentially run this more often. Rather than running it only when
   running RTCP sender report (which is once in 5 seconds now), can
   potentially run it every second and limit the amount of change to
   something like 10 ms max.

* remove unused variable

* debug log a bit more
2023-05-06 11:52:57 +05:30
Raja Subramanian
25d6fd751f Cleaning up smoothed OWD calculation for sender report. (#1684)
* Keep track of expected RTP time stamp and control drift.

- Use monotonic clock in RTCP Sender Report and packet times
- Keep the time stamp close to expected time stamp on layer/SSRC
  switches

* clean up

* fix test compile

* more test compile failures

* anticipatory clean up

* further clean up

* add received sender report logging
2023-05-05 13:14:12 +05:30
Raja Subramanian
15078eb9f4 Keep track of expected RTP time stamp and control drift. (#1681)
* Keep track of expected RTP time stamp and control drift.

- Use monotonic clock in RTCP Sender Report and packet times
- Keep the time stamp close to expected time stamp on layer/SSRC
  switches

* clean up

* fix test compile

* more test compile failures
2023-05-04 13:00:57 +05:30
Raja Subramanian
00217c7af1 Logging delta of receiver report (#1676) 2023-05-02 22:43:37 +05:30
Raja Subramanian
3070e976c3 Log received sender report of audio for debugging (#1673)
* Log received sender report of audio for debugging

* log OWD also

* add some more bits
2023-05-02 00:22:33 +05:30
Raja Subramanian
7dbd086c3e Calculating feed drift and log them for more clues. (#1671) 2023-05-01 11:55:27 +05:30
Raja Subramanian
08fd068511 logging feed side last report for clues (#1670) 2023-05-01 11:39:37 +05:30
Raja Subramanian
dfa3d77945 Misc changes (#1669) 2023-04-30 15:42:39 +05:30
Raja Subramanian
50ab72a5f8 DownTrack scoring when RR is not received. (#1664) 2023-04-28 14:50:06 +05:30
Raja Subramanian
09c0b25787 Ensure that RR is not received for a while before running scorer on nil (#1653)
data.

Without the check, it was getting tripped by publisher not publishing
any data. Both conditions returned nil, but in one case, the receiver
report should have been received, but no movement in number of packets.
2023-04-24 23:39:30 +05:30
Raja Subramanian
69fb5e51a2 Fix stutter in forwarding path when using dependency descriptor (#1600)
* Decode chains

* clean up

* clean up

* decode targets only on publisher side

* comment out supported codecs

* fix test compile

* fix another test compile

* Adding TODO notes

* chainID -> chainIdx

* do not need to check for switch up point when using chains, as long as chain integrity is good, can switch

* more comments

* address comments
2023-04-12 17:30:54 +05:30
Raja Subramanian
c56e37f3fe Fix VP9 stutter in non-DD and some other misc changes (#1595)
* WIP commit

* WIP commit

* clean up

* remove todo

* fix test
2023-04-10 12:31:07 +05:30
Raja Subramanian
4969b57c09 Chaging VideoLayers -> VideoLayer (#1591)
There was mixed used. It is a struct. So, it is a singular.
Change all the places I could find. There may be more, but can be
changed when spotted.
2023-04-08 12:39:02 +05:30
Raja Subramanian
e32eaa451f Refactor video layer selector (#1588)
* WIP commit

* WIP commit

* fix test

* FPS for VP9

* WIP commit

* test changes

* WIP commit

* h264

* codec munger

* forwarder state

* clean up a bit

* dd interface

* WIP commit

* WIP commit

* WIP commit

* WIP commit

* more TODO notes

* overshoot interface

* clean up

* clean up isTemporalSupported

* wait for key frame to resume

* clean up VP8 payload descriptor stuff

* temporal layer selector

* comment out vp9 and av1

* space

* fix test compile

* append bytes

* fix tests

* fix test
2023-04-08 10:57:57 +05:30
cnderrauber
fb301e6e75 Add vp9 svc support by Dependency Descriptor (#1586)
* Add VP9 SVC support

* Fix preferred fps does not work

* Fix forwarder test
2023-04-06 21:51:33 +08:00
Paul Wells
1b09fc9721 fix panic in rtpstats (#1570) 2023-04-01 12:39:13 -07:00
Raja Subramanian
59961c1992 Aggregate method for RTPDeltaInfo (#1562) 2023-03-30 13:34:52 +05:30
Raja Subramanian
de80f521de Increase sequence number cache to handle higb rate tracks. (#1560)
Hopefully temporary while we can find a better solution.
Adds 36 KB per SSRC. So, if a node can handle 10K SSRCs (roughly 10K
tracks), that will be 360 MB of extra memory.
2023-03-29 22:32:39 +05:30
Raja Subramanian
f63962c2cc Pure code movement (#1552) 2023-03-26 23:13:17 +05:30
renovate[bot]
2fce780ce8 Update go deps (#1402)
* Update go deps

Generated by renovateBot

* use generics with Deque

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: David Zhao <dz@livekit.io>
2023-03-25 23:17:04 -07:00