Commit Graph

2775 Commits

Author SHA1 Message Date
cnderrauber
3cf70b2198 Disable fast negotiation temporarily after migration (#2991) 2024-09-10 00:16:09 +08:00
Raja Subramanian
d53f732ada Do not take padding packets into account in max pps calculation (#2990) 2024-09-09 11:08:50 +05:30
Paul Wells
b63192a376 add config for signal retry (#2989) 2024-09-08 19:53:19 -07:00
David Zhao
50576b503e Handle trailing slashes in URL (#2988)
When a user includes a trailing slash in LIVEKIT_URL, it would produce
double slashes in the path, i.e. `https://myhost.livekit.cloud//twirp/RoomService.ListRooms`

Currently the server will send a 302 MOVED response, causing Twirp requests to fail.

We now remove the double slash in front within the middleware.
2024-09-07 11:30:24 -07:00
renovate[bot]
e8fcbefcec Update module github.com/prometheus/client_golang to v1.20.3 (#2978)
Generated by renovateBot

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-09-07 11:04:11 -07:00
Raja Subramanian
6843c1dafe Pin to Go 1.22.7 (#2987)
* Set go version to 1.22.5

* Pin to Go 1.22.7
2024-09-07 16:55:59 +05:30
Raja Subramanian
bfb5fa1f97 Put go version at 1.22 (#2986)
Not sure what is causing it to add the minor version and toolchain.
Even now, with this, running `go mod tidy` makes those changes.
`staticcheck` says invalid Go version.

Manually setting it to 1.22.
2024-09-07 16:29:12 +05:30
Raja Subramanian
cb235c123c Seed down track state on re-use. (#2985)
With the new early negotiation, onBinding callback could happen later.
Reset reusingTransceiver only if not re-using it.
2024-09-07 10:14:35 +05:30
Raja Subramanian
787b8450e9 Record out-of-packet count/rate in prom. (#2980)
* Record out-of-packet count/rate in prom.

Adding a field to AnalyticsStream to make this easier to report.
Let me know if adding to AnalyticsStream is not ok.

Will set up a protocol PR if it is okay.

* deps
2024-09-07 00:19:54 +05:30
Raja Subramanian
bec7453a1f Recreate stats worker on resume if needed. (#2982)
* Ref count the stats worker.

NOTE: Don't liek this much, but wanted to open this get some 👀 on
this and get feedback.

There are two entities, one for counting signal bytes and another for
media stats. They both send `ParticipantJoined` and `ParticipantLeft`
event.

In the case of a participant resume, as the old web socket
connection is closed, that triggers a signal stats counter close. That
would call `ParticipantLeft` and that would close the stats worker.

The closed stats worker got reaped in `FlushStats` after three minutes.

So, all events after that did not have a worker and hence went
unreported including missing participant_left webhook because it relied
on checking if a participant was ever connected and that needed to check
the worker state.

Using a ref count to keep track of join/leaves. And not close the worker
until ref count goes down to 0.

* create a stats worker on resume

* revert incorrect changes

* transfer connected state

* transfer connected state when creating worker

* resolve participant on a resume
2024-09-06 23:58:03 +05:30
cnderrauber
95fa55eb5d Update pion to fix transceiver reuse (#2983) 2024-09-06 23:32:02 +08:00
cnderrauber
5ae88c267e CacheDowntrack synchronously on DownTrack.Close (#2981)
Avoid repeat adding local/remote downtracks when migration
after #2970 allow remote track can be subscribed before resolved.
2024-09-05 22:00:38 +08:00
cnderrauber
08b8db9eb1 Start negotiate immediately if last one is before debouce interval (#2979) 2024-09-05 15:37:30 +08:00
Mathew Kamkar
730fe51642 exponential backoff when calling CreateRoom (#2977)
* exponential backoff when calling CreateRoom

* dz+bb review: check ctx cancellation, remove retry max

* bb review: fix loop condition

* raja review: use timer, bring back max tries
2024-09-04 23:18:31 -07:00
renovate[bot]
a6e9795b59 Update module github.com/livekit/protocol to v1.21.0 (#2908)
Generated by renovateBot

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-09-04 00:05:58 -07:00
cnderrauber
4792e7e134 Revert "Add tracksubscribed event on downtrack added (#2934)" (#2975)
This reverts commit 8b47218270.
2024-09-04 10:42:18 +08:00
cnderrauber
d6ce2338e2 Use correct subscriber id in dynacast notify (#2972) 2024-09-03 11:35:52 +08:00
Raja Subramanian
6de871d4e8 Allow start streaming on an out-of-order packet. (#2971)
But, do not record first packet time on an out-of-order packet.
It so happens that packets get out-of-order a lot more across relay.
And it turns out with some H.264 stream, the first few packets of a key
frame are very small (may be SPS/PPS, haven't checked), they get
out-of-oder quite a lot, so much so a down track never starts even it
has 20 - 25 key frames have passed through.
2024-09-02 21:36:46 +05:30
cnderrauber
efa85221b3 Negotiate downttrack for subscriber before receiver is ready (#2970)
* Negotiate downttrack for subscriber before receiver is ready

This change will save 1 round sdp negotiation time for
subscribing to simulcast-codec or remote node track

* solve comment

* Fix simulcast-codec case
2024-09-02 14:10:14 +08:00
Denys Smirnov
0f7f068e61 Update protocol. Support SIP Callee dispatch rule type. (#2969) 2024-08-31 19:48:12 +03:00
Raja Subramanian
579f76cf7c Use 0 rollover when possible. (#2968) 2024-08-31 11:36:49 +05:30
renovate[bot]
a7add9479f Update go deps (#2963)
Generated by renovateBot

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-08-29 23:09:55 -07:00
Raja Subramanian
a4baa8b550 Skip ICE restart on unestablished peer connection. (#2967)
* Do not ICE restart on an idle/not yet started peer connection.

* Skip ICE restart on unestablished peer connection.

For publish only participants, the subscriber peer connection is not
negotiated. So, ICE restart was hitting an error while trying to restart
the SUBSCRIBER peer connection.

* use ICE gathering state as peer connection state may not have changed if first offer/answer was missed
2024-08-30 11:19:51 +05:30
cnderrauber
28417ef599 fix republish failed (#2966)
* fix republish failed

parallel negotiation would cause remote webrtc track consume
pending republished track then failed.

* comment
2024-08-29 15:41:32 +08:00
cnderrauber
16896e4d66 Add FastPublish in JoinResponse (#2964)
Set FastPublish in JoinResponse for participant can publish
and no ice fallback setting.
2024-08-28 12:00:28 +08:00
cnderrauber
bde702d9c9 Don't remove DD extesion for simucalst codecs (#2960) 2024-08-26 17:52:33 +08:00
David Zhao
91cb4369ef Standardize twirp hooks during server init (#2959) 2024-08-26 00:53:13 -07:00
Raja Subramanian
e9f26c21e7 Panic fix for nil candidate check. (#2957) 2024-08-25 10:12:32 +05:30
Raja Subramanian
56e67c9d25 Properly exclude mDNS when not trickling also. (#2956) 2024-08-24 23:23:23 +05:30
renovate[bot]
7cce1917ad Update module github.com/jellydator/ttlcache/v3 to v3.2.1 (#2955)
Generated by renovateBot

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-08-24 10:29:47 -07:00
renovate[bot]
a76a69fb6a Update go deps (#2946)
Generated by renovateBot

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-08-23 15:51:51 -07:00
cnderrauber
947e8f5909 Speed up track publication (#2952)
* speed up track publication

Add metrics for track publication and subscription

Return EnabledCodecs in JoinResponse so client can
choose codec without server side codec fallback

Cache remote webrtc track without AddTrackRequest to
let client send publisher offer before AddTrackRequest response

* go mod

* clean code
2024-08-23 18:38:32 +08:00
Raja Subramanian
37c6f95fe4 Reduce threshold of out-of-order very old packet detection. (#2951)
There are cases where the very first packet on resume is an out-of-order
packet. In that case, the gap in both sequence number and time stamp is
a small(ish) negative number. With a high threshold to declare very old
packet, the condition does not trip and the packet gets through and
treated as a packet that has rolled over.

It should be fine to have smaller threshold (in fact, it is probably
okay to have something a little over 1.0 too) as the expected jump is
calculated based on elapsed time since last packet receive and new
packets should be coming in with a diff close to that. So, a factor of
just over 1.0 to prevent false triggers should be fine. Using 1.5 for
now.
2024-08-22 17:48:12 +05:30
David Colburn
0fdfe2f5a0 refactor sip create participant (#2949) 2024-08-21 17:13:26 -04:00
Raja Subramanian
d78fdbf2a8 Handle another old packet condition. (#2947)
* Handle another old packet condition.

With this detection, the sequence number can be rolled over even when TS
rollover is not possible. For example, a track at 300 pps can rollver
the sequence number space in minutes compared to 13h+ for video time
stamp to roll over.

* fix typo
2024-08-21 13:32:20 +05:30
Denys Smirnov
7ad6d97b1b Propagate SIP attributes from a Dispatch Rule. (#2943) 2024-08-19 18:09:37 +03:00
cnderrauber
15bf920f2c fix framenumber test (#2942) 2024-08-19 16:35:38 +08:00
Raja Subramanian
1fb8964814 Refactor propagation delay estimator. (#2941)
* Refactor propagation delay estimator.

NOTE: It is not possible to calculate OWD (one-way-delay) in a passive
fashion. So, this should not be used for anything requiring high
precision.

But, mainly factoring it out as a separate object just in case it can be
re-used.

TODO:
- probably has some edge case that is not handled well
- maybe path change detection can be improved
- will write UT later. This is just purely splitting it out from what
  was embedded in RTPStatsReceiver.

* fix labels

* precision -> accuracy
2024-08-19 12:03:45 +05:30
renovate[bot]
ebc6e49d52 Update go deps (#2936)
Generated by renovateBot

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-08-18 22:00:10 -07:00
Raja Subramanian
08b8ef56de Use monotonic clock in packet path. (#2940)
Set up a base time when starting a receiver and use that clock as base
for other packet times to ensure that clock is monotonic.
2024-08-17 23:19:27 +05:30
renovate[bot]
210fc18281 Update pion deps (#2932)
Generated by renovateBot

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-08-15 15:49:00 -07:00
Paul Wells
dabbb298c5 mark explicit create paths (#2935) 2024-08-13 22:00:39 -07:00
cnderrauber
8b47218270 Add tracksubscribed event on downtrack added (#2934)
will remove this once the remote node has tracksubscribed
event sent.
2024-08-14 10:19:01 +08:00
Paul Wells
c371929535 add roommanager service (#2931)
* add roommanager service

* cleanup

* deps

* timeout

* cleanup

* cleanup

* config

* cleanup
2024-08-13 11:00:41 -07:00
Raja Subramanian
edad813c61 Add DisconnectReason to ParticipantInfo. (#2930) 2024-08-13 17:24:09 +05:30
renovate[bot]
5d55486710 Update module github.com/ory/dockertest/v3 to v3.11.0 (#2927)
Generated by renovateBot

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-08-12 19:41:34 -07:00
renovate[bot]
fead891d7a Update module github.com/pion/sctp to v1.8.21 (#2928)
Generated by renovateBot

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-08-12 19:38:50 -07:00
Raja Subramanian
9a6b4c6956 Send signal response for non-error cases also. (#2926)
* Send signal response for non-error cases also.

Gated by protocol version 15 or higher for sending OK response.

* explicit reason init
2024-08-12 22:25:34 +05:30
David Zhao
28f797786b Version bump to 1.7.2 (#2924) v1.7.2 2024-08-11 21:36:13 -07:00
renovate[bot]
7d53a42322 Update go deps (#2918)
Generated by renovateBot

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-08-11 10:50:56 -07:00