942 Commits

Author SHA1 Message Date
Paul Wells 01f90d185f copy receivers on write (#2336)
* copy receivers on write

* cleanup

* cleanup

* test
2023-12-21 08:23:22 -08:00
Raja Subramanian 4c1047d8c3 Populate simulcast codec layers. (#2334)
Previously, it was done on read. Missed populating it on write
in the TrackInfo consolidation effort.

Fix by populating layers when adding pending track itself.
As all codecs will have same layers, clone the top level layers and add
it all codecs.
2023-12-21 18:52:49 +05:30
Raja Subramanian a4888fcf8f Prevent unsafe access (hopefully). (#2332)
* Prevent unsafe access (hopefully).

Thank you @paulwe for catching it.

* prevent recursive locks
2023-12-21 16:02:10 +05:30
Raja Subramanian faff67162b Consolidate TrackInfo. (#2331)
* Consolidate TrackInfo.

TrackInfo was spread across a bit. Consolidating it.

* TODO comments

* test

* update TrackInfo on SSRC change

* further consolidation

* log mimes only

* update receivers on SSRC set

* clone proto on return

* feedback: break loop on mime match

* prevent data race
2023-12-21 09:56:54 +05:30
Raja Subramanian d0c36aa6cc Make UpdateTrackInfo an interface. (#2327) 2023-12-20 09:58:08 +05:30
Raja Subramanian 7c841e8895 Only assign TrackInfo Version on fresh publish. (#2325)
* Only assign TrackInfo Version on fresh publish.

* remove redundant nil check
2023-12-20 09:48:13 +05:30
Raja Subramanian 37539fdf76 Add Version to TrackInfo. (#2324)
* Add Version to TrackInfo.

Set when a track is published.

* update protocol
2023-12-19 11:50:48 +05:30
Raja Subramanian 5ee307952e Reduce a couple of logs to Debugw. Small saving. (#2322) 2023-12-18 14:27:55 +05:30
Raja Subramanian 3cf4fbc6a9 Store identity in participant update cache. (#2320)
Need to store identity of other partiicpant in cache so that it
can be sent with the disconnected participant update.
Side note: Feels like the cache can be made to hold the full proto
to make things simpler, but just adding a field for now.
2023-12-15 15:40:10 +05:30
cnderrauber a150eaf697 Fix mid info lost when migrating multi-codec simulcast track (#2315)
* Fix mid info lost when migrating multi-codec simulcast track

* update pion
2023-12-15 00:02:27 +08:00
Raja Subramanian 0478af449f Do not error on end-of-candidates candidate (#2314) 2023-12-14 15:22:57 +05:30
lukasIO 23b46042cc Populate disconnect updates with participant identity (#2310) 2023-12-13 15:32:25 +01:00
Raja Subramanian dfcafff955 Log track info when media published. (#2306)
With pending track added moved to Debugw, will be good to have this when
track is published.
2023-12-11 11:20:25 +05:30
Raja Subramanian c766676d36 Handle nil pair (#2305) 2023-12-10 21:44:16 +05:30
Raja Subramanian 83efa9258e Bump up protocol for connection quality LOST. (#2297)
Also log trackID/trackInfo in layer mapping.
2023-12-06 16:59:05 +05:30
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