Commit Graph

1706 Commits

Author SHA1 Message Date
Raja Subramanian
4ea284fae0 Log potential sequence number de-sync in receiver reports. (#2128)
* Log potential sequence number de-sync in receicer reports.

Seeing some cases of a roll over being missed. That ends up
as largish range to search in an interval and reports missing packets
in the packet metadata cache.

Logging some details.

* just log in one place
2023-10-05 13:10:13 +05:30
Raja Subramanian
5aa093f65d Log time when there are too many packets. (#2127)
Ideally, can remove the nil return when there are too many packets
as we have more information with extended sequence numbers, but
logging duration first to understand what is happening better.
2023-10-05 12:02:55 +05:30
Raja Subramanian
6c49d1a160 Logging a few bits at Infow (#2126)
Seeing sequencer errors with egress (related to dummy start).
So, logging a few bits at Infow to understand them better.
2023-10-05 11:16:31 +05:30
Raja Subramanian
c710ab901e Log stream start at Infow (#2125)
Seeing some sequence number adjustment where timestamp is 0.
Want to check the stream start.
2023-10-05 00:12:41 +05:30
Raja Subramanian
cb0a48c12d Handle RED extended sequence number. (#2123)
When converting from RED -> Opus, if there is a loss, SFU recovers
that loss if it can using a subsequent redundant packet. That path
was not setting the extended sequence number properly.

Also, ensuring use of monotonic clock for first packet time adjustment
also.
2023-10-03 19:38:55 +05:30
Raja Subramanian
96ccf696d3 Cap expected packets to padding diff. (#2122)
* Cap expected packets to padding diff.

On the receiver, no longer using packet metadata cache to calculate
interval stats. An optimisation to get rid of packet metadata cache
on receiver side.

Because of that, padding packets in an interval could be more than
expected packets. As padding packets is just a counter, out-of-order
padding packets will make the diff look larger than expected packets
in a window. Cap the expected to 0.

NOTE: This makes it so that the count is not accurate in a window,
but that is okay occasionally. It will affect reported stats and quality
calculations, but it should be rare. For example, if 30 packets were
received in a window and 60 out-of-order padding packets were received,
it would reported as 0 packets were received. One option is to not
increment padding packets when they are out-of-order, but that will mess
up overall stats. Will make that change if we see this happen a lot.

* log unexpected padding packets
2023-10-03 12:36:19 +05:30
Raja Subramanian
e6e3e2a729 sligtly easier readability (#2121) 2023-10-02 22:47:40 +05:30
Raja Subramanian
989d621c97 A small change to move out of order check before RTT calc. (#2117) 2023-10-02 11:51:46 +05:30
Raja Subramanian
180ad541fc Mark packet not handled if restart is rejected (#2115)
* Mark packet not handled if restart is rejected

* log both sn and ts on restart/rollback
2023-09-30 10:24:13 +05:30
Raja Subramanian
ee3a7c01bc Log resync at Infow. (#2114)
* Log resync at Infow.

Seeing potentially large sequence number jumps on a resync.
And it seems to happen on a lot of subscribe/unsubscribe.
Logging at Infow to understand better.

Probably need to find a way to avoid resync. But, logging for now to
check if I can catch one.

* Remove resync and log large sequence number jumps
2023-09-30 08:42:46 +05:30
Raja Subramanian
39d0af4381 Start key frame requester on start. (#2111)
Sending a single PLI on connected & bound meant that the upstream
throttler may not have sent it and down stream does not have a key frame
to lock onto. Caused some e2e test failures due to limited time of
track.
2023-09-28 18:44:48 +05:30
cnderrauber
92a355e1f3 Add SyncStreams flag to Room (#2110)
* Add SyncStreams flag to Room

* Increase protocol version

* Revert version change

* Move flags to internal & solve comment
2023-09-28 15:41:44 +08:00
David Zhao
4c9d95149d Enable SVC codecs by default (#2109) 2023-09-27 21:16:13 -07:00
Raja Subramanian
789a2bd390 Log ICE candidates when closing the peer connection. (#2105)
There are cases that experience the signalling channel timeout
and disconnect and there are no logs of what the state of ICE at all.
Log ICE candidates when closing transport so that there is some
visibility in those cases.
n
2023-09-26 13:21:08 +05:30
Pingos
4f9467040e Bind() function fails when mime == "audio/red" (#2104) 2023-09-26 13:36:54 +08:00
cnderrauber
1200a960a2 Use generic type cast for IDs (#2095) 2023-09-20 17:09:24 +08:00
Raja Subramanian
281d2b674b Changing some log levels (#2094)
Logging expected WS close at Infow to understand reasons for closure.
Moving "read from ws" to Debugw as it happens when signalling closes.

Also filter out a data channel abort chunk log as it shows a bunch of
errors, but those are expected though.
2023-09-20 14:13:48 +05:30
Raja Subramanian
a624e30b74 Use marshal + unmarshal to ensure unmarshallable fields are not copied. (#2092)
* Use marshal + unmarshal to ensure unmarshallable fields are not copied.

Need to ensure that config structs/fields are marshallable.

There was a use of a = b copy of struct and some of the embeded structs
had locks and copying was not good.

* update protocol

* Update deps
2023-09-20 00:23:49 +05:30
Raja Subramanian
d0bfb349aa Set packet time for padding packets (#2091) 2023-09-19 19:54:54 +05:30
cnderrauber
e46da0705a Add max playout delay config (#2089)
* Add max playout delay

* config sample
2023-09-19 11:30:38 +08:00
David Colburn
8a0d417a8c Participant egress (#2070)
* participant egress

* remove hasPublished when participant leaves room
2023-09-18 12:47:57 -07:00
Raja Subramanian
dd2427bf05 Stop writing packets in sysnthesize on track close. (#2086) 2023-09-18 22:25:48 +05:30
Raja Subramanian
e0d98eebb6 Do stats update in line. (#2085) 2023-09-18 18:42:39 +05:30
Raja Subramanian
ca2f8fedab Fix out-of-range access. (#2082)
Happens when converting quality in subscibed settings to layer.
Looks like it can happen only if the provided quality is OFF.
Don't know of any client that does that. Anyhow, prevent out-of-range
access which causea a panic.
2023-09-18 10:03:22 +05:30
David Zhao
0b0431b765 Per-session TURN credentials (#2080)
Switching to using session specific TURN credentials instead of shared
credentials per Room. Also eliminates need to load Room from Redis
during TURN authentication
2023-09-17 10:08:35 -07:00
Raja Subramanian
019ad88b08 Do not force reconnect on resume if there is a pending track (#2081)
* Do not force reconnect on resume if there is a pending track

* move GetPendingTrack -> LocalParticipant
2023-09-17 14:00:09 +05:30
Raja Subramanian
97048a923c Reducing rtp stats memory consumption - part 2 (#2078)
* WIP commit

* move a struct to sender only

* Snapshot intervals

* make receiver history 4K too
2023-09-16 18:54:18 +05:30
David Zhao
340906267f Reduce ghost participant disconnect timeout (#2077)
It's been reported that "ghost" participants, those that did not terminate
cleanly, hang around the room for too long after they disappear.

Evaluating our timeouts a bit, it seems that we are really conservative
in waiting for participants to disconnect. This PR cuts down the disconnect
timeout from 50s to 20s, a 30s reduction.
2023-09-16 00:15:04 -07:00
Raja Subramanian
f29887dcd0 Use bit map. (#2075)
* Use bit map.

Also, duplicate packet detection is impoetant for dropping padding
only packets at the publisher side itself. In the last PR, mentioned
that it is only for stats.

* clean up

* Update deps
2023-09-16 02:03:50 +05:30
Raja Subramanian
9c2ad54146 Clean up debug logs (#2076) 2023-09-16 01:57:34 +05:30
David Zhao
2113557842 Skip SendDataPacket logging on transport failure (#2074)
That's a sign of peer connection failure, we do not need to log these
2023-09-15 12:55:54 -07:00
Raja Subramanian
044f6cec40 Reduce packet meta data cache - part 1 (#2073)
* Reduce packet meta data cache - part 1

Packet meta data cache takes a good amount of space.
That cache is 8K entries deep and each entry is 8 bytes.
So, that takes 64KB per RTP stream.

It is mostly needed for down stream to line up with receiver reports.

So, removing cache from up stream (RTPStatsReceiver) as part 1.
Will look at optimising the down stream in part 2.

* Remove caching from RTPStatsReceiver

* clean up a bit more

* maintain history and fix test
2023-09-15 21:39:03 +05:30
Raja Subramanian
7ac0abdf1b Decrement value when end is in open range. (#2072)
* Decrement value when end is in open range.

Not an error when end is in open range.

* change API call
2023-09-14 14:31:39 +05:30
Raja Subramanian
69177b8b6e Debug logs to check on sequencer missing offset. (#2071)
* Debug logs to check on sequencer missing offset.

* spelling

* close range on value decrement
2023-09-14 12:20:33 +05:30
Raja Subramanian
68aebb0106 Do not mute when stream is paused. (#2069) 2023-09-13 19:59:24 +05:30
Raja Subramanian
a55c50f61d Throttle packet errors/warns a bit. (#2068)
* Throttle packet errors/warns a bit.

In very bad network conditions, it is possible that packets
arrive out-of-order, have choppy behaviour.

Use some counters and temper logs.

* slight change in comment
2023-09-13 15:52:10 +05:30
Raja Subramanian
3f9f3adf91 Fix init. (#2067)
Stupid me.
2023-09-13 12:53:16 +05:30
Raja Subramanian
2cf751d261 Use timer in scorer lock scope. (#2066)
Using time from outside make anachronous samples in expected
distance/bit rate measurement. So, have to let the time be
snap shotted in scorer lock scope.
2023-09-13 01:38:34 +05:30
Raja Subramanian
5f701ece34 Include top bits from start in highest sequence number from RR. (#2064)
Streaming could start after 16-bits has rolled over. So, have to add
that base back to what is received in receiver report.

Otherwise, it looks like there are not packets received in window
leading to poor quality.
2023-09-12 14:36:25 +05:30
Raja Subramanian
254a35543d Fix down stream stats. (#2063)
Need to pass in the correct time. Previously streaming start was
determined by another delta snap shot which as removed for efficiency.
Did not realise that we were passing in zero time for stats.

Also, revert of the change (the part which did not re-pause) from this
PR (https://github.com/livekit/livekit/pull/2037). That change affects
other paths. The edge it was trying to fix is more rare. Need to think
about a way which covers all cases.
2023-09-12 08:34:28 +05:30
Raja Subramanian
463c62b99a Update deps (#2061) 2023-09-11 22:16:02 +05:30
Raja Subramanian
f333ce05ed fix start (#2060) 2023-09-11 20:59:47 +05:30
cnderrauber
696798279e Check destination identites of data message if sid is empty (#2058) 2023-09-11 14:42:48 +08:00
Raja Subramanian
be4ea44425 Log ClientInfo on participant close. (#2057)
Want to check client distribution for negotiation failed induced closes.
2023-09-11 10:29:09 +05:30
Raja Subramanian
1b20b8f1ac Make interface for connection stats. (#2056)
* Make interface for connection stats.

Implement suggestion from @paulwe to clean that up a bit.

* fix test
2023-09-11 08:39:33 +05:30
Raja Subramanian
c09d8d0878 Split RTPStats into receiver and sender. (#2055)
* Split RTPStats into receiver and sender.

For receiver, short types are input and need to calculate extended type.

For sender (subscriber), it can operate only in extended type.
This makes the subscriber side a little simpler and should make it more
efficient as it can do simple comparisons in extended type space.

There was also an issue with subscriber using shorter type and
calculating extended type. When subscriber starts after the publisher
has already rolled over in sequence number OR timestamp, when
subsequent publisher side sender reports are used to adjust subscriber
time stamps, they were out of whack. Using extended type on subscriber
does not face that.

* fix test

* extended types from sequencer

* log
2023-09-11 07:33:39 +05:30
Raja Subramanian
b5f2f83278 Fix time stamp adjustment when starting with dummy packets. (#2053)
* Fix time stamp adjustment when starting with dmummy packets.

- Populated extended values in ExtPacket on dummy packet.
- Have to pass reference time stamp offset to first packet time
  adjustment.

* display participant version info
2023-09-09 17:33:26 +05:30
Raja Subramanian
d24f409354 Simplify SN cache a bit. (#2052) 2023-09-09 13:00:59 +05:30
David Zhao
f351f9b2ed Allow RoomService.SendData to use participant identities (#2051)
* Allow RoomService.SendData to use participant identities

* update protocol

* update webrtc to 3.2.19
2023-09-08 16:22:56 -07:00
Raja Subramanian
492eb3bf18 Sequencer small optimisations (#2049)
* Sequencer small optimisations

1. Use range map to exclude padding only packets. Should take lesser
   space as we are not using slice to hold pointer to actual data.
2. Avoid `time.Now()` when adding each packet. Just use the arrival time
   as it should be close enough. `time.Now()` was showing up in
   profile.

* remove debug

* correct comment
2023-09-08 23:48:54 +05:30