Commit Graph

736 Commits

Author SHA1 Message Date
Raja Subramanian
03ada9ba76 Proper RTCP report past mute. (#2588)
- When audio is muted, server injects silence frames which moves the
  time stamp forward and adjusts offset. That cannot be used against
  publisher side sender report. Use a pinned version.
- Ignore small changes to propagation delay even while checking for
  sharp increase. That is spamming a lot for small changes, i.e.
  existing delta is 100 micro seconds or so and the new one is 300 micro
  seconds. Also rename to `longTerm` from `smoothed` as it is a slow
  varying long term estimate of propagation delay delta. And slow down
  that adaptation more.
2024-03-19 11:59:24 +05:30
Raja Subramanian
14321f21bf Make OpsQueueParams to make it easier to understand args. (#2578) 2024-03-14 10:27:24 +05:30
Raja Subramanian
e376625a13 Do not need to flush stream allocator events. (#2577) 2024-03-14 04:36:19 +05:30
Raja Subramanian
4e96ad2e5b Missed clean up in the last PR (#2576)
* Missed clean up in the last PR

* Infow -> Debugw
2024-03-13 23:01:19 +05:30
Raja Subramanian
3e43f75143 Forward publisher sender report. (#2572)
* Forward publisher sender report.

Publisher side RTCP sernfer report is rebased to SFU time base
and used to send sender rerport to subscriber.

Will wait to merge till previous versions are out as this will require a
bunch of testing.

* - Add rebased report drift
- update protocol dep
- fix path change check, it has to check against delta of propagation
  delay and not propagation delay as the two side clocks could be way
  off.
2024-03-13 14:31:39 +05:30
Raja Subramanian
610d68a409 Clean up using publisher side clock rate. (#2568)
It is not used any more.
2024-03-11 12:25:07 +05:30
Raja Subramanian
50c48ff29d Ignore out-of-order receiver side sender reports. (#2567) 2024-03-11 11:30:01 +05:30
Raja Subramanian
93c7d1f4fb Adjust first packet time on down track resume. (#2566)
Allows subscriber sender report to line up better quicker.
2024-03-11 00:40:16 +05:30
Raja Subramanian
bdbc9dcbc7 Use start time stamp to calculate down stream sender report. (#2564)
* Use start time stamp to calculate down stream sender report.

With first packet time adjustment, using the first time stamp is more
accurate.

This still suffers if the up stream clock rate changes (happens in cases
like noise suppression which is not well understood). Will be looking at
pass through of sender report from publisher to subscriber.

* similar log strings

* avoid early sender reports

* log messages

* Reduce first packet adjustment threshold to 15 seconds
2024-03-10 23:18:54 +05:30
Raja Subramanian
a08b058abc Structured logging for sender report data. (#2563) 2024-03-10 01:29:37 +05:30
Raja Subramanian
0618cb39df Logging time and rtp diff for easier debugging (#2548) 2024-03-05 20:31:44 +05:30
cnderrauber
95001dfe54 remove warning log of unexpected rtcp fb (#2546)
* remove warning log of unexpected rtcp fb

* Add log for high playout delay

* don't create delay controller for audio
2024-03-05 10:35:28 +08:00
Raja Subramanian
46257c1d24 Skip large RR intervals. (#2544) 2024-03-04 19:12:53 +05:30
Raja Subramanian
fdd76c8734 Post a PLI check request on connected. (#2542)
Otherwise, it gets delayed by timer and could wait upto to interval
(which could be 200 ms when there is no RTT information yet).
2024-03-04 14:41:35 +05:30
cnderrauber
8c5d8730b1 Check ssrc for rtcp packets (#2541)
* Check ssrc for rtcp packets

* Add warn log if rtcp fb has unknown ssrc
2024-03-04 16:36:57 +08:00
cnderrauber
b58307f144 Support XR request/response for rtt calculation (#2536)
* Support XR request/response for rtt calculation

* Update pkg/sfu/downtrack.go

Co-authored-by: David Zhao <dz@livekit.io>

---------

Co-authored-by: David Zhao <dz@livekit.io>
2024-03-03 12:34:49 +08:00
Raja Subramanian
6a0b72c357 Use SubscriberID() is calls to DeleteDownTrack. (#2533)
Thank you @cnderrauber for catching this.
2024-03-01 15:21:00 +05:30
Raja Subramanian
9e334c7510 Refactoring channel handling (#2532)
* Refactoring channel handling

* Add a version to SubscriberID()
2024-03-01 15:08:07 +05:30
Raja Subramanian
95011d64f8 Annotate max subscribe layer change with events. (#2531)
Using events to understand what is causing max subscribed layer changes.
Seeing an edge case where all layers are disabled incorrectly.
2024-03-01 11:27:26 +05:30
Raja Subramanian
d40041d013 Use the correct snapshot id for PPS. (#2528)
* Use the correct snapshot id for PPS.

That caused connection quality to operate on small windows.

* remove debug
2024-02-29 22:48:36 +05:30
Raja Subramanian
ea66eae9f5 Start moving things to structured logging (#2527) 2024-02-29 14:35:19 +05:30
Raja Subramanian
af79224e30 Check on copy. (#2525)
Should not happen, but just being defensive.
2024-02-29 10:25:52 +05:30
cnderrauber
a435368278 use dynamic bucket size (#2524) 2024-02-28 16:24:23 +08:00
David Colburn
098b12981f fix pli throttle locking (#2521)
* fix pli throttle locking

* UpdatePliAndTime still used in cloud
2024-02-27 20:22:38 -08:00
Denys Smirnov
f5eb6c8a95 Update usage of core.Fuse. (#2519) 2024-02-28 03:48:58 +02:00
Raja Subramanian
fb5595880a Missed lock in codec translate (#2516) 2024-02-27 12:23:40 +05:30
Raja Subramanian
6696c1e63d Close published track always. (#2508)
Simplify and close published track always. Avoid the round about path of
unbind to close.
2024-02-25 13:46:55 +05:30
cnderrauber
90ab3fdf68 Reduce FrameIntegrityChecker's allocation (#2504) 2024-02-23 13:10:58 +08:00
Raja Subramanian
6895eff496 Buffer size config for video and audio. (#2498)
* Buffer size config for video and audio.

There was only one buffer size in config.
In upstream, config value was used for video.
Audio used a hard coded value of 200 packets.

But, in the down stream sequencer, the config value was used for both
video and audio. So, if video was set up for high bit rate (deep
buffers), audio sequencer ended up using a lot of memory too in
sequencer.

Split config to be able to control that and also not hard code audio.

Another optimisation here would be to not instantiate sequencer unkess
NACK is negotiated.

* deprecate packet_buffer_size
2024-02-21 22:58:56 +05:30
Raja Subramanian
bd7950f56c Cleaning up logs added for debugging (#2497) 2024-02-21 20:21:59 +05:30
Raja Subramanian
0088eef3c1 Reduce heap for dependency descriptor in forwarding path. (#2496)
* Reduce heap for dependency descriptor in forwarding path.

Marshaled dependency descriptor is held in sequencer adding heap objcts.
Store DD bytes in sequencer to avoid heap usage.

Also, accomodating over sized objects via storing in slice and using it
in case the bytes do not fit in the internal array.

NOTE: Marshal DD still does a make([]byte...), but I think it should be
on the stack given the short use of it. Have to verify.

* fix test and also add cases for oversized codec/dd bytes
2024-02-20 15:30:21 +05:30
Raja Subramanian
4404b6796b Some optimisations in the forwarding path. (#2035)
* WIP commit

* WIP

* Fix tests

* clean up

* Release pool in pacer

* fix tests

* fix tests

* remove debug

* fix test
2024-02-20 10:32:35 +05:30
cnderrauber
91c320770b Replace reflect.Equal with generic sliceEqual (#2494)
* Replace reflect.Equal with generic sliceEqual

* Use library function
2024-02-20 11:57:38 +08:00
David Zhao
8371848747 Version 1.5.3 (#2489)
* Version 1.5.3

* add missing copyright notices

* update protocol for redis.tls YAML keys
2024-02-17 12:37:15 -08:00
Raja Subramanian
d216f94ac1 Remove some logs. (#2484)
* Remove some logs.

Also, changing Errorw -> Warnw in a bunch of places.
Going to move towards using `Errorw` for cases where a functionally
unexpected condition happens, i.e by design a condition should not
happen yet it triggered kind of scenarios.

* log error
2024-02-15 18:05:50 +05:30
Raja Subramanian
f7b6e915cb Fix return on dropping a padding packet. (#2479)
Had deleted an extra line while cleaning up.
2024-02-13 14:24:31 +05:30
Raja Subramanian
0bcd9a2f8b Remove some noisy logs (#2477) 2024-02-13 12:01:20 +05:30
Raja Subramanian
07f64251b2 Delete spammy log (#2476)
* Move spammy log to  Debugw

* Actually, delete as log is not useful
2024-02-13 00:06:57 +05:30
Raja Subramanian
49fd332e91 Store first SR also as it can get reset (#2472) 2024-02-12 12:14:25 +05:30
Raja Subramanian
89a312d259 Ignore duplicate RID. (#2471)
Firefox on Windows 10 seems to be producing simulcast tracks with
duplicate RID. That causes a leak as only one buffer is processed.

Ignore duplicate rid.

NOTE: This is not perfect as the actual layer -> rid is indeterminable
at addition time. It would require looking at packets to determine the
video dimensions and match to rid/layer to figure out which one is
correct and which one is duplicate.

To simplify though, taking the first one and dropping later ones.
This could mean the correct resolution is not streamed, but that should
be okay. The leak is far more destructive.
2024-02-12 11:49:14 +05:30
cnderrauber
af0a8fbbbc add log for extpacket accumulated (#2454) 2024-02-06 21:38:36 +08:00
cnderrauber
be87a1b6f0 Support rtx for publisher (#2452)
* Support rtx for publisher

* remote log

* solve comment
2024-02-06 21:30:37 +08:00
Raja Subramanian
b7147efb87 Close published tracks on participant close (#2446) 2024-02-05 13:41:41 +05:30
Raja Subramanian
7c16ca6a0c Log feed Sender Report to better understand forwarded sender report (#2443)
anomalies.
2024-02-04 11:12:22 +05:30
Raja Subramanian
d0128b19cd Reset sender reports before measuring clock skew. (#2437) 2024-02-02 21:52:43 +05:30
Raja Subramanian
174e69c81d Restore min score to 30. (#2435)
Was at 20 when LOST was introduced, but was going to 20 even when under
not LOST conditions. When there are packets, want the min to be at 30.
Going down to 20 resulted in reporting LOST quality even when packets
were flowing (although they were experiencing heavy loss and quality
would have been very bad, yet they are not lost).

Also, sample warning about adding packet to bucket even more.
2024-02-02 08:52:52 +05:30
Raja Subramanian
ff69c2aa11 Add debug to understand VP9 freezes. (#2434)
* Add debug to understand VP9 freezes.

Have reports of VP9 freezing in some rooms.
Some data indicates that NACKs are received by SFU, but cannot get RTP
packet when that happens. It is possible that the NACKs are all from
dropped packets. Adding some debug to understand drops/NACKs better.

* enable DD debug

* comment out DD debug

* markers

* add back log about diff length mismatch

* add back key frame mismatch logging

* log skipped drops also
2024-01-31 15:33:39 +05:30
Raja Subramanian
b71d373f4a Use Deque in ops queue. (#2418)
* Use Seque in ops queue.

Standardizing some uses
- Change OpsQueue to use Deque so that it can grow/shrink as necessary and
  need not worry about channel getting full and dropping events.
- Change StreamAllocator and TelemetryService to use OpsQueue so that
  they also need not worry about channel size and overflows.

* Address feedback

* delete obvious comment

* clean up
2024-01-28 13:48:30 +05:30
cnderrauber
9b4ba2d41d use default max playout delay as chrome (#2411) 2024-01-26 13:32:54 +08:00
cnderrauber
995fddbaf9 Add dynamic playout delay if PlayoutDelay enabled in the room (#2403)
* Add dynamic playout delay

* type for state
2024-01-26 09:33:35 +08:00