Commit Graph
2270 Commits
Author SHA1 Message Date
cnderrauberandGitHub 73900be59d Set mime_type for tracks don't have simulcast_codecs (#3040)
go sdk don't have simucalst_codecs set could cause
partial track info broadcast to other nodes.
2024-09-24 15:36:08 +08:00
holzgeistandGitHub 9b277803c6 fix: copy attributes to refresh token (#3036)
otherwise they will be missing on a full reconnect
2024-09-23 08:31:21 -07:00
Paul WellsandGitHub d26ade0076 add helpers for partiicpant reconnect and version (#3034) 2024-09-22 23:37:35 -07:00
Paul WellsandGitHub 5e3b3ee3c1 return copy of job state when starting job (#3035) 2024-09-22 23:37:06 -07:00
cnderrauberandGitHub 341d1e512c change bind log to debug (#3033) 2024-09-23 12:05:38 +08:00
cnderrauberandGitHub eed925fddf avoid race condition on downtrack.Codec (#3032) 2024-09-22 14:27:26 +08:00
Paul WellsandGitHub 8428d5e62b update protocol (#3031)
* update protocol

* test

* cleanup
2024-09-21 17:05:39 -07:00
Benjamin PrachtandGitHub 22c36ef423 Implement SIP TransferParticipant API (#3026) 2024-09-20 12:16:15 -07:00
Raja SubramanianandGitHub 191e8635e8 fix missed baseTime init (#3025) 2024-09-19 18:37:35 +05:30
Paul WellsandGitHub 61179d5624 simplify agent registration (#3018)
* simplify agent registration

* testutils

* deps

* fix

* gen

* cleanup

* lower job load
2024-09-19 05:58:30 -07:00
lukasIOandGitHub 94d7b1708f Allow agents to override sender identities on ChatMessage (#3022)
* Allow agents to override sender identities on ChatMessage

* temporarily replace protocol

* check for empty identity

* string compare instead of identity compare

* update protocol

* Fix typo

* whitespace
2024-09-19 11:11:14 +02:00
Paul WellsandGitHub 370f386dd0 add convenience methods to participant (#3016)
* add convenience methods to participant

* tidy
2024-09-19 00:20:22 -07:00
Raja SubramanianandGitHub 7df6f86693 Initial plumbing for metrics. (#2950)
* Initial plumbing for metrics.

This implements
- metrics received from participant.
- callback to room.
- room distributes it to all other participants (excluding the sending
  participant).
- other participants forward to client.
- counting metrics bytes in data channel stats

TODO:
  - recording/processing/batching
  - should recording/processing/batching happen on publisher side or
    subscriber side?
  - should metrics be echoed back to publisher?
  - grants to publish/subscribe metrics.

* mage generate

* clear OnMetrics on close

* - CanSubscribeMetrics permission.
- Echo back to sender.

* update deps

* No destination identities for metrics

* WIP

* use normalized timestamp for server injected timestamps

* compile

* debug log metrics batch

* correct comment

* add baseTime to wire

* protocol dep

* Scope metrics forwarding to only participants that a participant is
subscribed to.

Also remove the participant_metrics.go file as it was not doing anything
useful.

* update comment

* utils.ErrorIsOneOf

* couple of more utils.CloneProto
2024-09-19 11:42:31 +05:30
Paul WellsandGitHub 4deaac2f3f replace proto.Clone calls (#3024)
* replace proto.Clone calls

* deps

* tests
2024-09-18 22:47:33 -07:00
cnderrauberandGitHub 978db00034 Add sdk, participant_kind to pub sub metrics (#3023)
* exclude go client from track publication metric

* add sdk,participant_kind lables

* fix test
2024-09-19 10:42:47 +08:00
cnderrauberandGitHub 3ecd03fa31 Use new track id for republishing (#3020)
* Use new track id for republishing

Always generates new track id for track publishing
to make the behavior more consistent. A republishing of
clien track will be considered as a new track publication
and always trigger trackUnpublished & trackPublished event
on subscriber side.

* remove test
2024-09-19 09:17:12 +08:00
Paul WellsandGitHub 1436a1f186 driveby cleanup (#3017)
* driveby cleanup

* test
2024-09-18 00:45:55 -07:00
Raja SubramanianandGitHub f21bc84967 Log only when not nil. (#3015)
* Log only when not nil.

Default logging confuses debugging as we call using nil as well to make
the call site simpler. And logging a nil makes it look like it is
incorrect seeding. `nil` fields do not seed. So, don't log when `nil`.

* log SDP
2024-09-18 12:39:53 +05:30
Raja SubramanianandGitHub 9a4ddf05d5 Fix forwarder panic defer of nil senderReport (#3011) 2024-09-17 08:44:09 +05:30
cnderrauberandGitHub 0c002b8675 exclude sip client from track publish metric (#3007) 2024-09-17 09:42:21 +08:00
Raja SubramanianandGitHub 914e5d6993 Set SenderReport to nil on seeding if empty. (#3008)
With protobuf marshalling/unmarshalling, the default struct was getting
used and nil checks for non existence were failing. That means the right
layers were not reported active on migration.

Also, restore the wrapped loggers as some fields needs some conversion
before logging.
2024-09-16 23:56:13 +05:30
Denys SmirnovandGitHub 47a9969f44 Pass project to CreateSIPParticipantRequest. (#3006) 2024-09-16 20:09:33 +03:00
Raja SubramanianandGitHub 2e7bcbc5e2 Forward ChatMessage (#3005)
* Forward ChatMessage

* fill in participantIdentity

* remove redundant setting
2024-09-16 20:17:38 +05:30
Raja SubramanianandGitHub a0b4c39fd5 Use OnSelectedCandidatePairChanged to keep track of selected pair. (#3004)
* Use OnSelectedCandidatePairChanged to keep track of selected pair.

* update webrtc dep
2024-09-16 19:44:21 +05:30
Raja SubramanianandGitHub 3c8a7d7828 Log down track state on seeding. (#3003)
Also, log when RTCP sender report for reference layer is received.

Cleaning up a bunch of wrapped logger calls as we already have
logger.Proto which I forgot about while doing those wrappers.
2024-09-14 23:07:54 +05:30
Raja SubramanianandGitHub 098aa78ab7 Do not remove from subscription map on unsubscribe. (#3002)
* Do not remove from subscription map on unsubscribe.

Notes in line as to why.

* Avoiding the extra check. It is fine to check under lock for clean up.
It is done in other places.

* comments
2024-09-14 12:56:48 +05:30
Denys SmirnovandGitHub 0e68404f2c Support passing SIP headers. (#2993) 2024-09-13 11:06:38 +03:00
Raja SubramanianandGitHub 1b5bb4dddc Log ICE reconnected. (#2999)
To increase visibility of ICE reconnect, logging reconnected at Infow
level. Otherwise, it is hard to see if an ICE restart finished
successfully.

Also, cleaning up ICEConnectionDetails a bit. Just separate out
read-only fields into its own struct and use it for read-only export.
2024-09-12 13:16:41 +05:30
Raja SubramanianandGitHub 182ab9a951 Log more details around layer switch (#2996)
* Log more details around layer switch

* split error
2024-09-11 09:23:42 +05:30
Paul WellsandGitHub 70b84871fe compute agent service affinity from available capacity (#2995) 2024-09-10 18:12:09 -07:00
Raja SubramanianandGitHub b678ccdd66 Cache RTCP sender report in forwarder state. (#2994)
* Cache RTCP sender report in forwarder state.

To be used in migration.

TODO: need to check more places to operate pure in unix nano rather than
converting.

* match name
2024-09-10 20:50:50 +05:30
cnderrauberandGitHub 3cf70b2198 Disable fast negotiation temporarily after migration (#2991) 2024-09-10 00:16:09 +08:00
Raja SubramanianandGitHub d53f732ada Do not take padding packets into account in max pps calculation (#2990) 2024-09-09 11:08:50 +05:30
Paul WellsandGitHub b63192a376 add config for signal retry (#2989) 2024-09-08 19:53:19 -07:00
David ZhaoandGitHub 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
Raja SubramanianandGitHub 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 SubramanianandGitHub 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 SubramanianandGitHub 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
cnderrauberandGitHub 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
cnderrauberandGitHub 08b8db9eb1 Start negotiate immediately if last one is before debouce interval (#2979) 2024-09-05 15:37:30 +08:00
Mathew KamkarandGitHub 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
cnderrauberandGitHub 4792e7e134 Revert "Add tracksubscribed event on downtrack added (#2934)" (#2975)
This reverts commit 8b47218270.
2024-09-04 10:42:18 +08:00
cnderrauberandGitHub d6ce2338e2 Use correct subscriber id in dynacast notify (#2972) 2024-09-03 11:35:52 +08:00
Raja SubramanianandGitHub 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
cnderrauberandGitHub 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
Raja SubramanianandGitHub 579f76cf7c Use 0 rollover when possible. (#2968) 2024-08-31 11:36:49 +05:30
Raja SubramanianandGitHub 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
cnderrauberandGitHub 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
cnderrauberandGitHub 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
cnderrauberandGitHub bde702d9c9 Don't remove DD extesion for simucalst codecs (#2960) 2024-08-26 17:52:33 +08:00