Commit Graph

173 Commits

Author SHA1 Message Date
Raja Subramanian
75ec31f237 Support starting off with not forwarding video (#623) 2022-04-19 12:37:53 +05:30
Raja Subramanian
2e9bccfeff Allow padding packets to stream tracker. (#618) 2022-04-18 10:20:52 +05:30
Raja Subramanian
ed2a0011d9 Lock to receiver report for senders (#616) 2022-04-17 08:43:50 +05:30
Raja Subramanian
a98d955284 Delta stats throughout (#615)
* Use delta stats throughout and avoid calculating deltas in telemetry

* Fix a few things after testing

* Remove debug

* Fix tests

* delete instead of setting to nil

* Point to the latest protocol
2022-04-16 21:11:32 +05:30
Raja Subramanian
587534d121 Count repeated NACK only on a hit (#611) 2022-04-13 18:01:59 +05:30
Raja Subramanian
ee7bb0a1ad Log both estimate and nack ratio when congestion detected (#608) 2022-04-10 12:09:11 +05:30
David Zhao
4475a028b6 Removed REMB references for publisher (#605) 2022-04-07 18:24:11 -07:00
Raja Subramanian
93a2730128 Resync on mute to avoid sequence number jumps on unmute (#597) 2022-04-06 23:23:57 +05:30
David Zhao
8fbe00edb3 Avoid locking when flushing DownTrack (#594) 2022-04-05 23:45:51 -07:00
Raja Subramanian
2e71fba3da Prevent negative timestamp diff (#595)
Found another reason for potential stalling on layer switch up.

When switching up, it is possible that the key frame of the packet
at higher layer arrives very close to a packet in the currently
forwarded layer.

An inversion happens when higher layer packet arrives earlier
(as timestamped at receicver), but gets scheduled for forwarding
later (as seen by forwarder).

Because of the order of processing goroutines,
it is possible to have negative diff when trying to adjust
RTP timestamps for layer switch. A negative diff results in
large jump in RTP timestamp. Client stalls, sends PLI three seconds
later (3 seconds is a Chrome thing, not sure about others), waits
for another key frame and starts again. In the mean time, the
video is frozen.
2022-04-06 10:18:41 +05:30
Raja Subramanian
73ae58bb42 Reduce chatty logs (#592) 2022-04-06 06:30:26 +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
cnderrauber
3959251837 add support for vp9 and av1 (#574) 2022-03-28 22:22:48 +08:00
Raja Subramanian
f293de054d Fix large reported loss in RTPStats (#564)
Had to check for half the range to see if start needed to be moved back.
2022-03-24 12:17:36 +05:30
Raja Subramanian
ab7c63a08a Remove padding double counting (#562) 2022-03-24 06:36:17 +05:30
Raja Subramanian
ed9234f71b Removing unused functions and adding more logs (#560)
* Removing unused functions and adding more logs

* Do not include padding packets in Packets
2022-03-23 22:26:34 +05:30
Raja Subramanian
06ea1d2ad3 Log rtp stats for debugging large gaps or all packets getting reported lost (#559) 2022-03-23 15:12:45 +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
82e1c391a4 Fix time stamp jump on layer switch (#543) 2022-03-20 13:36:29 +05:30
Raja Subramanian
1d03a5a3b6 Lock temporal layers to target for non-temporal layer codecs also (#542) 2022-03-20 11:11:49 +05:30
Raja Subramanian
8c9c1fe837 Always do stats update and header extension processing (#540)
Also, use Errorw for tracking large gap to get a back trace.
2022-03-19 21:29:10 +05:30
Raja Subramanian
5a9da8bee2 Do not double count NACK miss in sfu.DownTrack (#536) 2022-03-19 11:10:58 +05:30
Raja Subramanian
ed00146937 Fix packets/packetRate mismatch (#534)
This still does not address root cause of large loss, but at least
does not display crazy thing like packets = 0, but packet rate is 45/s.

Also, RLock in ToString() as there are bits of structure used in
stringification.
2022-03-19 01:06:52 +05:30
Raja Subramanian
13083a143f More logs (#533) 2022-03-19 00:38:22 +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
3ce4010e89 Fix bracket (#531) 2022-03-18 11:25:20 +05:30
Raja Subramanian
a709cc0ad7 Exempt layers in stream tracker (#530)
For now, exempt layer 0 from stream tracker declaring it stopped.
2022-03-18 11:17:48 +05:30
Raja Subramanian
64f82a6a73 Fix off by one packets expected (#529) 2022-03-18 10:03:09 +05:30
cnderrauber
c6a35d3ff1 fix keyFrameRequestGeneration not exit after close (#527)
* fix keyFrameRequestGeneration not exit after close

* change to bound check

* Refactor stop key frame requester into a function

* Remove redundant key frame requester stop

Co-authored-by: boks1971 <raja.gobi@tutanota.com>
2022-03-17 18:50:07 +08:00
Raja Subramanian
dc6b3369f4 Minor clean up of unused stuff (#525) 2022-03-17 10:19:51 +05:30
Raja Subramanian
33f9726b79 Key frames (#522)
* Key frames

- Keep track of key frame stats
- Split out PLI from down track used for purpose of layer locking.
This will give us a good picture of down stream issues forcing a PLI.
- Use key frame requester whenever there is a layer lock required.
Not just the first key frame. With the synchronous thing, the counter
was just ridiculously high like 150 or something because of all
the initial padding packets. Also, use RTT in key frame requester.

* send first PLI before waiting

* Turn off key frame requester when disabled

* simplify
2022-03-16 19:55:12 +05:30
Raja Subramanian
f3368a567b Use overridden packet loss (#519) 2022-03-16 11:36:54 +05:30
David Zhao
d498cccc05 Fixed panics with nil stats (#517) 2022-03-15 12:01:26 -07:00
Raja Subramanian
4d1cc82c89 Remove unused with move to RTPStats (#516) 2022-03-15 23:01:37 +05:30
Raja Subramanian
ae85e55fd4 Using RTPStats across the board (#515)
* WIP commit

* Clean up
2022-03-15 17:47:19 +05:30
Raja Subramanian
80bd45f061 Some clean up (#505)
* WIP commit

* Refactor NTP time

* Clean up

* Update lk protocol
2022-03-11 22:40:49 +05:30
cnderrauber
a5fa54853f fix potential nil rtcp packets cause rtcpSendWorker exit (#504) 2022-03-11 15:40:24 +08:00
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
acbafa06f2 Log key frame and layer lock (#496) 2022-03-09 09:50:16 +05:30
cnderrauber
184fc93c6a fix panic on close channel (#495) 2022-03-09 11:49:27 +08:00
cnderrauber
128199e634 don't send datatrack info to client (#492)
* don't send datatrack info to client
2022-03-08 17:05:26 +08:00
cnderrauber
608da4ba4b stats for pli and bitrate (#487)
* stats for pli and bitrate

* solve comments

* return 0 if no pli sent
2022-03-07 14:59:01 +08:00
Raja Subramanian
c743d2ab3a Warn on ops queue full (#481)
Pass logger so that we can log with proper context.
2022-03-02 19:08:07 +05:30
Raja Subramanian
bfa350451e Start connection stats only after bind (#480) 2022-03-02 17:05:11 +05:30
cnderrauber
913ef3a646 Datatrack for data channel (#476)
* data track
2022-03-01 15:48:20 +08:00