Commit Graph

218 Commits

Author SHA1 Message Date
Raja Subramanian bc5b4d68af Do NACKs and reports always. (#2022)
* Do NACKs and reports always.

With padding packet drops, it is possible that a lot of packets
go by without RTCP RR.

Do NACKs and RTCP RR always.

* remove local variable
2023-08-31 12:41:25 +05:30
Raja Subramanian 790954bbe9 Use RTCP SR to resync. (#2021)
Remove packet debug code that was added temporarily.
2023-08-31 11:45:42 +05:30
Raja Subramanian 6e3a20ebf4 Temporary packet debug (#2018) 2023-08-31 00:33:00 +05:30
Raja Subramanian da52167cd9 Adjust extended sequence number to account for dropped packets (#2017) 2023-08-30 23:08:53 +05:30
Raja Subramanian f9b613be41 Log resync data (#2016) 2023-08-30 22:18:27 +05:30
Raja Subramanian 9afb0873ae Do not process packets not processed by RTPStats. (#2015)
Seeing the case of a stream starting with padding packets
on migration. As publisher in that case is always sending packets.
it is possible that the new node gets padding packets at the start.
Processing them in buffer leads to trying to drop that padding packet
and adding an exclusion range. That fails because the extended
sequence number is not available for unprocessed packets.

It is okay to drop them as they will be dropped anyway.
But, they are useful for bandwidth estimation. So, headers are processed
even if the packet is RTPStats unprocessed.
2023-08-30 19:43:24 +05:30
Raja Subramanian 126872047d Handle duplicate padding packet in the up stream. (#2012)
* Handle duplicate padding packet in the up stream.

The following sequence would have produce incorrect results
- Sequence number 39 - regular packet - offset = 0
- Sequence number 40 - padding only - drop - offset = 1
- Sequence number 40 - padding only duplicate - was not dropped (this is
  the bug) - apply offet - sequence number becomes 39 and clashes with
  previous packet
- Sequence number 41 - regular packet - apply offset - goes through as 40.
- Sequence number 40 again - does not get dropped - will pass through as 39.

* fix duplicate dropping

* fix tests

* accept repeat last value as padding injection could cause that

* use exclusion ranges

* more UT and more specific errors
2023-08-30 16:46:39 +05:30
Raja Subramanian 33b48d986f Fix typo, have to check against start (#2011) 2023-08-29 21:45:58 +05:30
Raja Subramanian fdba70dab7 Use correct variables (#2010) 2023-08-29 21:13:07 +05:30
Raja Subramanian 7dc8a7f80c Remove sender report warp logs. (#2007)
* Remove sender report warp logs.

They are not useful.
Also replacing drift report with proper protocol and reporting
both packet ad report drift.

Need to dig more into out-of-order sender report sending.
That requires some digging and understanding.

* record time of anachronous report

* more logging around out-of-order repair

* log time of out-of-order received sender report

* Update deps and place holder StartParticipantEgress
2023-08-29 00:30:24 +05:30
David Zhao 64bcef28aa Address comments from #1998 (#2006) 2023-08-27 22:50:36 -07:00
Raja Subramanian 35f5629910 fix typo (#2005) 2023-08-28 08:24:18 +05:30
David Zhao eed8e85008 Demote more logs to debug (#1998) 2023-08-27 19:17:38 -07:00
Raja Subramanian 73b87f04df Fix out-of-order check after move to 64-bit extended sequence number. (#2004)
Also, clean up the RTCP RR handling a bit by removing redundant check.
2023-08-28 07:38:44 +05:30
Raja Subramanian a48660fa77 Make extended sequence number 64-bit. (#2003) 2023-08-27 21:26:31 +05:30
Raja Subramanian 3b30f49ad5 Extended type for RTP timestamp. (#2001) 2023-08-27 17:28:44 +05:30
Raja Subramanian 55d5edcf73 Use range map in RTPMunger. (#2000)
* WIP commit

* Make lastSN 32-bit

* Remove unused TSCycles
2023-08-27 10:49:17 +05:30
Raja Subramanian 3c31ae5dc0 Use extended types for sequence number and time stamp in RTPStats. (#1999)
Reinstating this PR - https://github.com/livekit/livekit/pull/1548

Will use extended types in other places too over time.
2023-08-26 22:31:43 +05:30
Raja Subramanian 36dadbacb2 Drop padding only packets on publisher side. (#1990)
* Drop padding only packet on publisher side.

* add UT

* update deps

* remove debug

* add fast path short cut

* correct comment

* fix test

* fix for Linux
2023-08-24 09:09:42 +05:30
Raja Subramanian b1098cda41 Do not start RTPStats on a padding packet. (#1984) 2023-08-21 18:04:03 +05:30
Raja Subramanian 32af15dc80 Log RTP stream start time and more details when adjusting first packet time. (#1983)
Trying to understand first packet time jumps on migration.
2023-08-21 13:20:40 +05:30
Raja Subramanian 1078d96ff5 Fix log tag (#1981)
- Using "ts" collided with logger built-in tag and causes confusion
- Log a bit more to understand large jumps
2023-08-19 12:06:09 +05:30
Raja Subramanian 129b1df8e6 Use VP9 Key frame detection from Galene. (#1973)
* Use VP9 Key frame detection from Galene.

With ffmpeg generated VP9 file with single layer
and publishing via Go SDK, the key picture determination
outlined at https://datatracker.ietf.org/doc/html/draft-ietf-payload-vp9-16#page-13
under the F bit explanation does not work. It declares kay frame for
pretty much all frames. Unclear if ffmpeg generated bitstream has issues
or if that procedure in the above document does not work for single
layer case.

Using the bit stream explained here
https://storage.googleapis.com/downloads.webmproject.org/docs/vp9/vp9-bitstream-specification-v0.6-20160331-draft.pdf
(pages 28, 62, 63) implemented in Galene.
That is more expensive as it has to parse more, but works in all cases.

* Add AV1-TODo

* add some TODOs
2023-08-17 22:33:11 +05:30
Raja Subramanian 480edff4ac Adjust TS and cycles when adjusting start. (#1971)
* Adjust TS and cycles when adjusting start.

Chasing some AddPacket errors across relay.
Noticed that in one case the start/end sequence was flipped.
There is a known issue of it happening with resync.
Unclear if this instance was due to resync or not.
The start was close to the edge (64513). So, thought maybe
adjust at start and noticed that it needs to maybe increase
cycle count if start is wrapping back. In this case, the
start is 1000 before wrap point. So, may not be a wrap back
issue, but addressing what I found anyway.

* fix test
2023-08-16 13:52:01 +05:30
Raja Subramanian 96fa2f896b Set 32-bit RTP timestamp properly after repair. (#1968) 2023-08-15 23:09:45 +05:30
Raja Subramanian 77c8e82473 log adjustment for first packet (#1965) 2023-08-14 23:50:01 +05:30
Raja Subramanian 5c0a4beb61 Log more about layer offset. (#1959)
Seeing a good chunk of logs using default offset.
And it is concentrated heavily on few tracks.
Logging more to understand this better before
potentially demoting this log.
2023-08-11 13:03:10 +05:30
Raja Subramanian 19b84207a1 Use 32-bit ts for first packet adjustment. (#1955)
* Use 32-bit ts for first packet adjustment.

Otherwise, a new subscriber on a long running sees a huge difference
if the publisher side has rolled over.

As this happens only in the first two minutes of a track's lifecycle
it is fine to not consider rollover.

* log RTP in anachronous report
2023-08-11 09:43:12 +05:30
Raja Subramanian f22d1e5a75 Fix nil pointer dereference (#1949) 2023-08-10 01:31:51 +05:30
Raja Subramanian 0e9ec9a21e Ignore lagging layer switches. (#1948) 2023-08-09 17:42:33 +05:30
David Zhao debd75fa15 Integrate logger components (#1933)
* Integrate logger components

Dividing into the following components
* pub - publisher
* pub.sfu
* sub - subscriber
* transport
* transport.pion
* transport.cc
* api
* webhook

* update go modules
2023-08-03 13:31:17 -07:00
cnderrauber f7a1776f4c Add control of playout delay (#1838)
* Add control of playout delay

Add config to enable playout delay. The delay will be limited by
[min,max] in the config option and calculated by upstream & downstream
RTT.

* check protocol version to enable playout delay

* Move config to room, limit playout-delay update interval, solve comments

* Remove adaptive playout-delay

* Remove unused config
2023-08-02 16:12:23 +08:00
Raja Subramanian 0c34f12fa1 Demote some high frequency logs to Debugw (#1925) 2023-08-02 00:03:38 +05:30
Raja Subramanian a595c09bd2 Log the 32-bit RTP timestamp (#1921) 2023-08-01 00:18:05 +05:30
cnderrauber a87232f42a Frame integrity check for svc codec (#1914)
* Frame integrity check for svc codec

* Fix test

* Spell
2023-07-28 14:40:33 +08:00
David Zhao 981fb7cac7 Adding license notices (#1913)
* Adding license notices

* remove from config
2023-07-27 16:43:19 -07:00
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