Commit Graph

577 Commits

Author SHA1 Message Date
Raja Subramanian
f4f9df375f Ignore 0 RTT for nacker (#424)
- Propagate when a track is added
- Reduce scope of lock
2022-02-09 14:08:07 +05:30
Raja Subramanian
222b02aa73 RTT (#420)
* Consolidating PLI throttle

Use the throttler in `sfu.WebRTCReceiver`.

Does change shape of config object.

* Move PLIThrottleConfig to sfu.WebRTCReceiver

* fix test compile

* Cleaning up unused stuff

* improve readability

* RTT

- Calculate down track RTT using RTCP Receiver report
- Surface it back to the participant
- Participant updates all its published trackes
  (throttled to limit update to once in 5 seconds)
- That propagates to all the upstream sfu.Buffer and the nacker.
  So, we will have RTT throttled NACKs.

* rtt callback
2022-02-09 09:34:40 +05:30
shishirng
562546829b handle remote ip address in case of forwarding (#421)
Signed-off-by: shishir gowda <shishir@livekit.io>
2022-02-08 16:13:55 -05:00
Raja Subramanian
3117547d60 Consolidating PLI throttle (#419)
* Consolidating PLI throttle

Use the throttler in `sfu.WebRTCReceiver`.

Does change shape of config object.

* Move PLIThrottleConfig to sfu.WebRTCReceiver

* fix test compile

* Cleaning up unused stuff

* readability improvement
2022-02-08 22:50:43 +05:30
Raja Subramanian
fee3009853 Use buffer channel for all RTCP messages (#418)
RTCP messages are going through two channel hops now.
Maybe we don't need that anymore now that the original
problem is diagnosed. But, pushing all RTCP via
the callbackOps channel for now to make it consistent.
2022-02-08 17:19:59 +05:30
Raja Subramanian
e948ecb3a8 Duplicate packets should not update packet loss counter (#417) 2022-02-08 16:32:49 +05:30
Raja Subramanian
d3ca4a37a8 Proper context for down track logger (#416)
It was having two participants (both publisher and subscriber).
Fix it by getting logger from susbcriber and adding track context.
2022-02-08 15:54:45 +05:30
Raja Subramanian
bce3a9b10a Tigether scoping on connection stats lock. (#415) 2022-02-08 13:51:44 +05:30
cnderrauber
00b2a216c7 fix deadlock cause underlying buffer full (#413)
* fix deadlock cause underlying buffer full
2022-02-08 16:00:56 +08:00
Raja Subramanian
941cac8dfc set DTLS retransmit interval to 100 ms (#414) 2022-02-07 23:43:41 -08:00
Raja Subramanian
36289bbca7 FPS (#410)
* WIP commit

* WIP commit

* WIP commit

* WIP commit

* WIP commit

* WIP commit

* Clean up

* Clean up

* Store RTT in stats

* spelling mistake

* Make tests compile

* Fix test compilation error

* fix tests

* clone

* latest protocol
2022-02-08 12:53:14 +05:30
David Zhao
a6eb4290d3 Generate telemetry stubs (#412) 2022-02-07 23:15:24 -08:00
shishirng
32b56e0fd6 Add ParticipantActive telemetry method (#411)
* Add ParticipantActive telemetry method

Signed-off-by: shishir gowda <shishir@livekit.io>

* fix test

Signed-off-by: shishir gowda <shishir@livekit.io>

* Update go mod

Signed-off-by: shishir gowda <shishir@livekit.io>
2022-02-07 17:23:39 -05:00
David Zhao
81521f80db Support for custom TURN servers (#409)
Closes #271
2022-02-05 23:15:58 -08:00
David Zhao
e6c236357a Option to disable ICE-Lite to improve compatibility (#408) 2022-02-05 22:57:47 -08:00
Raja Subramanian
4a9b844781 Process RTX packets for TWCC (#406)
The SRTP replay detection was disabled recently.
But, they were effectively getting dropped in `sfu.bucket`.

Doing two things with RTX packets in this PR
1. Update stats - add to packet count and bytes
2. Process header extension - to process TWCC
2022-02-05 23:25:53 +05:30
Raja Subramanian
7f2a5ae036 latest DTLS to fix long delay connections (#405) 2022-02-05 13:14:06 +05:30
Raja Subramanian
9c3794144e Force DTLS role client for the simulated client side peer connection (#403)
* Force DTLE role client for the simulated client side peer connection
during migration.

Without that, with remote side being ice-lite (i. e. server offer
is subscriber peer connection), pion chooses the server DTLS role
and both side end up being servers.

* pion/webrtc -> 3.1.21

* remove local reference

* Use setup from previous answer

* more comments
2022-02-04 23:11:27 +05:30
Raja Subramanian
4388a68b7e Breaking up calc for easier reading. (#402)
* WIP commit

* fix test

* More clean up

* cast to right size

* use local variable

* set a default RTT

* Do not log RTX, although need to figure out source of RTX

* fix test
2022-02-04 14:18:25 +05:30
Raja Subramanian
05c8a6b2fd Cleaning/simplifying some buffer bits (#398)
* Cleaning/simplifying some buffer bits

1. NACKs are always inserted in order. So, get rid of
bunch of out-of-order handling in there and simplify.
2. For now, removing triggering a key frame from NACKs.
Let subs drive it.
3. Move to 16-bit sequence numbers except for receiver
report handling. Simplify bits about unwrapping sequence
number on all packets.
4. Remove unused code.

* remove unused field
2022-02-04 08:43:32 +05:30
David Zhao
6f6d55345b Use ParticipantInfo version to ensure consistency (#399)
* Use ParticipantInfo version to ensure consistency

Deprecating time.Time and avoid locking unnecessarily

* properly adjust ulimit. update protocol

* Save initial version from params

* get rid of metadata field, use grants copy

* fix test
2022-02-03 17:10:52 -08:00
David Colburn
7bbd238188 clean up logs and imports (#400) 2022-02-03 14:20:19 -07:00
David Zhao
a8d43aab67 Uses IceLite only for protocol 6 clients (#397)
* Update to Pion v3.1.20, with fixes DTLS role ambiguity

* Gate ice-lite on protocol version

Co-authored-by: boks1971 <raja.gobi@tutanota.com>
2022-02-02 21:16:08 -08:00
Raja Subramanian
ede39fe87f Disable SRTP replay protection (#396) 2022-02-02 16:31:07 +05:30
Raja Subramanian
e22f47b416 Split out stream tracker manager (#394)
* Random clean up

* Split out StreamTrackerManager for re-use

* Reset the correct tracker

* use generation counter to exit coroutine

* start only for video and when enabled

* Add RemoveAllTrackers method
2022-02-01 13:24:42 +05:30
Raja Subramanian
247807b2cc Use an atomic flag to stop stream allocator (#395)
* Use an atomic flag to stop stream allocator

* use a mutex for event channel

* RLock while posting event

* lock isStopped flag to prevent posting to closed channel
2022-02-01 12:41:37 +05:30
Raja Subramanian
0574803be8 Random clean up (#392) 2022-02-01 08:57:34 +05:30
Raja Subramanian
9db2bd22df LK logger with context in SFU (#391)
* LK logger with context in SFU

* Move buff.SetLogger into sfu.WebRTCReceiver
2022-02-01 08:57:09 +05:30
David Colburn
3d132730f9 replace entire nodeStats object (#393) 2022-01-31 17:09:36 -07:00
Raja Subramanian
745939ec24 Smoother dynacast transition (#390) 2022-01-31 07:47:24 +05:30
Raja Subramanian
a1f88faed1 Add a resync API to sfu.DownTrack (#389)
* Add a resync API to sfu.DownTrack

Also passing in logger with context into sfu package. More to do here
with proper logging context in all modules, but this is a start

* Remove debug code

* fix tests
2022-01-30 10:59:47 +05:30
shishirng
7ac3631b6c Get clients remote address from request (#385)
Signed-off-by: shishir gowda <shishir@livekit.io>
2022-01-29 10:51:21 -05:00
Raja Subramanian
3bfdb2523e Catch some instances of traversing map outside lock (#388)
* one more place, do not range over map outside lock

* Catch one more location

* Catching a couple of more places
2022-01-29 20:14:36 +05:30
David Zhao
3430650d3e Server-side parsing of UserAgent (#387) 2022-01-29 00:52:06 -08:00
David Zhao
6af6eefb8c Improve readability of test failures (#386) 2022-01-28 21:34:21 -08:00
Raja Subramanian
5b57522c05 Refactoring connection stats (#384) 2022-01-29 00:55:00 +05:30
David Zhao
9747243ce2 Honor autoSubscribe when subscription permissions are granted later (#381)
* Ensure autosubscribe is honored when subscription permissions were granted later

* negotiate even if no media has been added

* don't double-negotiate
2022-01-28 09:55:10 -08:00
cnderrauber
30c175e9a7 change vp8 blank frame to 8x8 (#382)
* change vp8 blank frame to 8x8

* rename
2022-01-28 23:03:03 +08:00
Raja Subramanian
f962fef2c8 Apply subscribed track settsings on add (#379) 2022-01-28 08:34:13 +05:30
shishirng
1e156025b4 Store client meta on participant join (#380)
* Store client meta on participant join

capture region, time_to_connect, ip, node

Signed-off-by: shishir gowda <shishir@livekit.io>

* Update proto dep

Signed-off-by: shishir gowda <shishir@livekit.io>
2022-01-27 15:44:03 -05:00
shishirng
26eea78b54 Telemetry connection scores (#377)
* octets - total bytes needs to be uint64

uint32 wraps at 4GB

Signed-off-by: shishir gowda <shishir@livekit.io>

* Cleanup stats handler to use connectionQuality stats

remove per packet rtcp handlers, buffer stats

* cleanup connection stats

* Update mediatrack to store rtcp stats in connection stats

* Update downstream handling of connection stats and telemetry

* Update telemetry tests

Signed-off-by: shishir gowda <shishir@livekit.io>

* Misc fixes

Signed-off-by: shishir gowda <shishir@livekit.io>

* Minor fix to avoid accessing buffer before its allocated

Signed-off-by: shishir gowda <shishir@livekit.io>

* start updateStats worker in AddReciever()

Signed-off-by: shishir gowda <shishir@livekit.io>

* Use previous score to calculate avg scores

* Restructure connectionStats

Signed-off-by: shishir gowda <shishir@livekit.io>
2022-01-27 11:24:54 -05:00
David Colburn
32825d2666 clean up WriteRoomRTC (#378)
* clean up WriteRoomRTC

* regenerate
2022-01-26 19:12:39 -07:00
David Zhao
69116a57fc Correctly use writeParticipantMessage for APIs (#376) 2022-01-26 00:26:42 -08:00
Raja Subramanian
45b07e2b3f Add trackID to logger context (#375) 2022-01-26 13:23:38 +05:30
Raja Subramanian
44afa8bae1 Delete down track on close (#374)
Note that it is called from Unbind also (previous behaviour). It should
be fine as long as there is no new down track for the same peer added
between close calling it and unbind calling it.
2022-01-26 13:22:39 +05:30
David Colburn
c92e0e38d5 Room closed fix (#370)
* Room closed fix

* switch to uber/atomic

* release after err check
2022-01-25 09:23:22 -07:00
Raja Subramanian
bb26109096 Add a method to clear receiver. (#372)
With remote media track receiver starting/stopping/restarting possibly,
receiver should be cleared when stopped and will be re-initialized when
it is restarted.
2022-01-25 18:08:41 +05:30
cnderrauber
b2cb93d9a4 fix concurrency problem (#369) 2022-01-25 16:13:52 +08:00
David Colburn
e7e3fcac43 remove duplicate IsRecorder 2022-01-24 20:51:57 -07:00
David Colburn
627a93298e IsRecorder (#368)
* IsRecorder

* regenerate fakes
2022-01-24 18:22:10 -07:00