Commit Graph

927 Commits

Author SHA1 Message Date
David Zhao
02c28a5946 Fix Selected attribute not being copied (#2289) 2023-12-03 22:05:23 -08:00
David Zhao
98c81b92bb Helper function to remove address from ClientInfo (#2288) 2023-12-03 10:48:33 -08:00
David Zhao
37e1864df8 Expose detailed connection info with ICEConnectionDetails (#2287)
* Expose detailed connection info with ICEConnectionDetails

* clone to avoid data race

* lower transport

* simplify

* address feedback
2023-12-03 10:03:41 -08:00
David Zhao
3fe124c87f Log cleanup pass (#2285)
* Log cleanup pass

Demoted a bunch of logs to DEBUG, consolidated logs.

* use context logger and fix context var usage

* moved common error types, fixed tests
2023-12-02 15:07:31 -08:00
Raja Subramanian
d866b5110f Restrict scope of negotiation time out error logs (#2283)
* Restrict scope of negotiation time out error logs

1. Log "negotiation failed" only if signal channel was active
within half window of negotiation timeout. Negotiation timeout currently
is at 15 seconds. Signal pings are every 10 seconds.
2. In transport.go, do not report negotiation timed out and do not
callback negotiation failure if the peer connection state is not
connected. Goal of negotiation failure tracker is to take remedial
action when an in-session negotiation fails. Seeing a bunch of cases
of the case hitting even without ICE connection forming. Negotiation
timer is not intended for those cases.

* fix test
2023-12-02 12:44:37 +05:30
Raja Subramanian
7b778c50eb Group SDES items for one SSRC in the same chunk. (#2280) 2023-12-01 11:37:14 +05:30
Raja Subramanian
2ee5aa7c98 Add optional supervisor disable. (#2277)
* Add optional supervisor disable.

Used `DisableSupervisor` so that default can be enabled and
it can be disabled explicity. But, open to defaulting to disable
(i. e. change param to `EnableSupervisor`).

* Move nil check to call site
2023-11-30 13:04:31 +05:30
Raja Subramanian
fa061b47fc Logging adjustnments (#2273) 2023-11-29 15:40:01 +05:30
Paul Wells
890f0bfc67 initialize prometheus metrics in test files (#2267) 2023-11-27 21:31:39 -08:00
Raja Subramanian
5f76d1adcc Introduce DISCONNECTED connection quality. (#2265)
* Introduce `DISCONNECTED` connection quality.

Currently, this state happens when any up stream track does not
send any packets in an analysis window when it is expected to send
packets.

This can be used by participants to know the quality of a potentially
disconnected participant. Previously, it took 20 - 30 seconds for
the stale timeout to kick in and disconnect the limbo participant which
triggered a participant update through which other participants knew
about it.

Previously, `POOR` quality was also overloaded to denote that the
up stream is not sending any packets. With this change, that is a
separate indicator, i. e. `DISCONNECTED`.

* clean up

* Update deps

* spelling
2023-11-27 23:06:53 +05:30
Raja Subramanian
53542b09a0 Participant traffic load. (#2262)
* Participant traffic load.

Capturing information about participant traffic
- Upstream/Downstream
- Audio/Video/Data
- Packets/Bytes

This captures a notion of how much traffic load a participant is
generating.

Can be used to make allocation decisions.

* Clean up

* SIP patches

* reporter goroutine

* unlock

* move traffic stats from protocol

* check type
2023-11-26 23:05:00 +05:30
Raja Subramanian
56dd399684 Use a worker to report signal/data stats. (#2260)
* Use a worker to report signal/data stats.

Was checking if reporting is needed on every update.
The check is wasted work if volume of signal/data messages is high
as reporting happens only once in 10 seconds.

Changing to a worker based on a timer. And also aligning with
telemetry reporting interval which defaults to 30 seconds.

* Remove unused constant
2023-11-22 11:47:15 +05:30
Raja Subramanian
49ca1066cd Reduce logging (#2243)
* Reduce logging

1. Do not print rtp stats if nil. Means that some subscribed tracks may
   not have any logs (very short subscriptions which end before any
   packet is sent).
2. Log ICE candidates only at the end, not when ICE connects. That logs
   the selected ICE candidate pair.
3. Log ICE candidates only if not empty.

* Update some deps
2023-11-15 12:57:03 +05:30
Raja Subramanian
bcce9c26eb Helpers accessible from other packages. (#2233) 2023-11-09 17:15:23 +05:30
David Colburn
57643a42ed Agents enabled check (#2227)
* agents enabled check

* participant -> publisher

* nil check client

* add NumConnections

* add lock around agent check

* do not launch agents against other agents

* regen

* don't need atomic anymore

* update protocol
2023-11-07 19:19:07 -08:00
cnderrauber
302facc60d Reject migration if codec mismatch with published tracks (#2225)
* Reject migrated/published track mismatch codec with track info

* Check potential codecs

* Issue full connect if mismatch

* fix codec finding
2023-11-06 21:11:39 +08:00
Paul Wells
43703538c6 clean up proto logging (#2221) 2023-11-04 10:32:03 -07:00
Paul Wells
2a941ba58d improve participant hidden (#2220) 2023-11-04 09:59:23 -07:00
David Colburn
60374c6402 Agents (#2203)
* agents

* add test

* undo name changes

* remove debug logs

* fixes

* fix data race in test
2023-11-03 11:43:35 -07:00
Raja Subramanian
f165ae1fa0 Separate publish and subscribe enabled codecs for finer grained control. (#2217) 2023-11-03 10:14:11 +05:30
Raja Subramanian
f38a5794a0 fallback to vp8 if no viable codec (#2211) 2023-11-02 00:03:47 +05:30
cnderrauber
9399fb2bfe Only select alternative codec for video (#2210)
* Only select alternative codec for video

* Filter out empty mime
2023-11-01 19:45:44 +08:00
Raja Subramanian
4fa60247c1 Reduce log level (#2209) 2023-11-01 16:30:49 +05:30
Raja Subramanian
dc9f16f350 Do not block on down track close with flush. (#2201)
* Do not block on down track close with flush.

When publisher removes all subscribers, publisher side should
not be blocked for long. With close with flush, it could happen
if there a lot of bunch of subscribers.

So, when is expected, run it in a goroutine like it is done in
subscription manager.

Not moving the entire `RemoveSubscriber` bit to subscription manager as
there are two bits which are not tracked now
- mime type
- willBeResumed
Those two would have to be tracked in track manager and notified to
subscription manager so that it can act for that mine and if the track
will be resumed or not. As that touch more parts and could get
complicated, doing the simpler thing of cloning behaviour from
subscription manager for now.

* clean up

* code readability
2023-10-30 12:31:00 +05:30
cnderrauber
3633dfe39e Disable h264 for android firefox (#2190)
* Disable H.264 for android firefox

* Fix syntax error for rule

* lower case

* Remove disabled codec from AddTrackRequest

* Consistent handling of enabled codecs

Mainly cleaning up where we are doing codec filtering.

There's also behavior change of how we handle codec compatibility. If a client doesn't support the client's desired codec, we'll pick a backup automatically
instead of rejecting the client's request.

Requires an update on multi-codec simulcast handling.

* fix alternative codec selection

---------

Co-authored-by: David Zhao <dz@livekit.io>
2023-10-27 14:47:36 +08:00
cnderrauber
514e86eac4 Don't filter out ipv6 address for client don't support prflx over relay (#2193)
candidate
2023-10-26 17:05:22 +08:00
cnderrauber
0296a5bd86 Remove un-preferred codecs for android firefox (#2183)
* Remove un-preferred codecs for android firefox

Android firefox don't comply with the codec order in answer sdp and
has problem to publish h.264, remove other codecs to fix this.

* false(false) is true
2023-10-25 16:59:37 +08:00
cnderrauber
eca32792b8 Add configuration to limit MaxBufferedAmount for data channel (#2170)
* Add configuration to limit MaxBufferedAmount for data channel

* comment

* Fix generate flags

* fix test

* Don't disconnect slow subscriber
2023-10-23 15:03:58 +08:00
Paul Wells
325e5ca753 add psrpc room service (#2171)
* add psrpc room service

* update deps

* disable by default

* feedback

* config

* test
2023-10-22 22:49:38 -07:00
Raja Subramanian
f97242c8ba Use 32-bit time stamp to get reference time stamp on a switch. (#2153)
* Use 32-bit time stamp to get reference time stamp on a switch.

With relay and dyncast and migration, it is possible that different
layers of a simulcast get out of sync in terms of extended type,
i. e. layer 0 could keep running and its timestamp could have
wrapped around and bumped the extended timestamp. But, another layer
could start and stop.

One possible solution is sending the extended timestamp across relay.

But, that breaks down during migration if publisher has started afresh.
Subscriber could still be using extended range.

So, use 32-bit timestamp to infer reference timestamp and patch it with
expected extended time stamp to derive the extended reference.

* use calculated value

* make it test friendly
2023-10-18 21:48:41 +05:30
Raja Subramanian
3e4cd3a161 Accept more range for first packet time adjustment. (#2150) 2023-10-17 23:52:14 +05:30
David Zhao
65934e6486 Fix ICE connection fallback (#2144)
* Fix ICE connection fallback

Short connection detection relied on iceFailedTimeout, which previously
had been misinterpreted. Since we've reduced iceFailedTimeout, it is
creating false negatives.

We'll instead use PingTimeout since clients are expected to keep the
signal connection active.

* reduce ping interval to align with total ice failure timeout
2023-10-15 14:36:12 -07:00
David Zhao
0931dc0300 Handle playoutDelay for Firefox (#2135)
We will need to disable playoutDelay for FF users if the developer is
assuming streams are synced.
2023-10-07 00:00:52 -07:00
David Zhao
f40a97fd3e Allow playout delay even when sync stream isn't used. (#2133)
The two options should function independently. Users could still improve
video jitter by using up to 100ms of playout delay.
2023-10-06 14:51:11 -07:00
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
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
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
David Colburn
8a0d417a8c Participant egress (#2070)
* participant egress

* remove hasPublished when participant leaves room
2023-09-18 12:47:57 -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
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
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
463c62b99a Update deps (#2061) 2023-09-11 22:16:02 +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
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
Trey Hakanson
b38b51dad8 Integrate updated TWCC responder (#2038)
Integrates the updated TWCC responder based on `pion/interceptor` from
https://github.com/livekit/mediatransportutil/pull/25
2023-09-06 08:37:52 +05:30
cnderrauber
9b9298b927 Add batch i/o to improve throughput (#2033)
* Add batch i/o to improve throughput

* remove empty line

* Solve comments

* Change rtcconfig.UDPPort to PortRange

* Fix test
2023-09-06 10:18:20 +08:00
Raja Subramanian
e922ae5f23 Filter out noisy error (#2032) 2023-09-04 22:01:07 +05:30