Commit Graph

822 Commits

Author SHA1 Message Date
Raja Subramanian
2510b9462e Taking a bunch of go modernize suggestions. (#4194)
This is not all of it as it is not possible (or at least I do not know
of a way) to get all suggestions for a repo/project. Did this via loop
searching mainly and taking the modernize suggestions.
2025-12-25 16:55:58 +05:30
cnderrauber
4104b8270b update protocol (#4183)
* update protocol

* fix test
2025-12-22 12:54:11 +08:00
Raja Subramanian
cd99fec2e7 Make new path for signalling v1.5 support. (#4180)
* Make new path for signalling v1.5 support.

To be able to support newer clients to interact with older servers, move
signalling v1.5 to new path (`/rtc1`). On the new path, `join_request`
is required and single peer connection is used.

With the existing path `/rtc`, single peer connection is still supported
if `join_request` is used.

Newer clients connecting to old server should follow
1. Try new path WebSocket
2. If that fails, try new path validate at `/rtc1/validate`.
3. If the above gets a 404 which will happen with older server, revert
   back to old path and signalling 1.0.

Open to suggestions on path name.

* test on both paths

* change path from /rtc1 -> /rtc/v1

* test all rtc service path combinations
2025-12-20 01:02:22 +05:30
Raja Subramanian
e7601251bc Make data message naming a bit more consistent. (#4177)
* Make data message naming a bit more consistent.

OnDataPacket and OnDataMessage half-way in the chain made it confusing
(for me at least). Use same name throughout.
API still uses SendDataPacket, but that is not harder to read.

* test
2025-12-19 12:09:16 +05:30
Raja Subramanian
a04e566dbf Use published track for model access in data down track. (#4176)
* Use published track for model access in data down track.

No need to pass in the model.

* implementation type assertion

* remove redundant log key

* one more type

* Close interface method

* clean up redundant log key

* remove unused method

* some interface changes to support data tracks in replay

* correct mock signature
2025-12-19 11:00:18 +05:30
Jade Ellis
47c86be1df Add support for TURN static auth secret credentials (#3796)
Closes https://github.com/livekit/livekit/issues/2245
2025-12-18 14:16:38 +05:30
Paul Wells
0a82438687 add explicit room exists servicestore op (#4175) 2025-12-17 22:14:06 -08:00
Paul Wells
898ebe058c clean up manual roomservice log redaction (#4165)
* clean up manual roomservice log redaction

* deps
2025-12-16 23:02:45 -08:00
Paul Wells
3e41725395 move delete to oss service store (#4164) 2025-12-16 22:00:43 -08:00
Raja Subramanian
a26c48304a Add support for RTP stream restart. (#4161)
* Add support for RTP stream restart.

When an unhandled packet is encountered, try a restart sequence.
Restart happens when 5 packets with contiguous sequence numbers and same
or increasing time stamps are received. Note that this does not work for
B-frame type of scenarios, but that is true for receive path handling
even before this. As WebRTC does not use B-frames, it is fine. But,
needs to be looked at again if B-frames are necessary.

It is controlled by a config that is disabled by default.

* clean up

* debug log
2025-12-16 13:21:39 +05:30
Raja Subramanian
ca4b56d2d5 Handle case of sequence number jump just after start. (#4150)
It is possible that the stream stops just after start and
restarts much later introducing a large gap in sequence number.
That could look like an unhandled case because the wrap back handler
does not have enough packets yet.

Let other checks based on time stamp gap take effect and only if that
also leaves the sequence number unhandled, drop the packet.
2025-12-12 00:29:15 +05:30
Raja Subramanian
97099cae3e Configurable telemetry stats worker clean up wait. (#4148)
* Configurable telemetry stats worker clean up wait.

* make worker clean up wait setting atomic
2025-12-11 11:25:32 +05:30
changgesi
d7db7cb389 chore: fix a large number of spelling issues (#4147)
Signed-off-by: changgesi <changgesi@outlook.com>
2025-12-11 09:34:13 +05:30
Raja Subramanian
64f3d1e972 switch participant callbacks to room to listener interface (#4136)
* switch participant callbacks to room to listener interface

* mage generate

* clean up

* clear listener

* clean up

* use interface in up data track manager

* tweaks

* Paul feedback - should reduce the diff as this keeps the room handlers as is except making methods for a couple of anonymous handlers

* clean up
2025-12-08 15:59:45 +05:30
Raja Subramanian
7954748d7a Data tracks (#4089)
* WIP

* WIP

* Starting to add some signalling integration testing.

* Working tests.

* fix tests

* Forward data packets (#4096)

* WIP commit

* WIP

* WIP

* fix forwarding

* address PR comments

* move some methods from LocalParticipant to Participant interface

* handle subscription update

* add extensions and tests

* more packet tests

* add test for replace extension and fix a bug

* update protocol and add config
2025-12-04 10:44:34 +05:30
Raja Subramanian
7f10e18bac Record join/publish/subscribe cancellations. (#4102)
To get better picture of success/failure rate.
2025-11-25 14:06:02 +05:30
Raja Subramanian
37a06821e2 logger proto redaction. (#4090)
Unfortunately, this could not be used for twirp/analytics redaction.

Probably worth writing a proto clone utility which will filter out based
on tags.
2025-11-18 14:15:17 +05:30
cnderrauber
54cf7d46c8 Control latency of lossy data channel (#4088)
* Control latency of lossy data channel

* remove log

* test
2025-11-18 16:30:16 +08:00
Raja Subramanian
d510fff1e7 Downgrade x/tools to be able to make a release (#4084) 2025-11-15 18:56:22 +05:30
Raja Subramanian
ae5fb7e882 Add packet to forwarding stats only if packet is forwarded. (#4056)
Packets not being forwarded were getting included in forwarding stats
calculation and skewing the measurement towards a smaller number.

The latency measurement does not include the batch IO of packets on
send. With a 2ms batching, that will add an average latency of 1ms.
2025-11-06 12:31:49 +05:30
Raja Subramanian
9ca6ee0077 Use replace so that x/tools does not get overridden (#4048) 2025-11-02 17:58:01 +05:30
Matthew Brown
704449247e if RingingTimeout is provided, deadline should be set to that timeout. (#4018)
* if RingingTimeout is provided, deadline should be set to that timeout.

This is because the SIP bridge will not return until RingingTimeout
which may be longer than the 30 second default deadline.

* handle Deadline being "before" timeout.
2025-10-27 15:03:03 +02:00
Raja Subramanian
cef6fdb7b6 Correct direction for request/response for prom counters. (#4027)
* Correct direction for request/response for prom counters.

I think I had it reversed.

* clean up

* clean up
2025-10-24 23:15:23 +05:30
Raja Subramanian
5a426d15e1 Use rtp converter from protocol/utils (#4019) 2025-10-22 14:09:33 +05:30
Raja Subramanian
2afbf0e8ca Some golang modernisation bits. (#4016)
Mainly doing this to check CI static check failures.
2025-10-21 12:53:18 +05:30
Raja Subramanian
ca0d5ee972 Count request/response packets on both client and server side. (#4001)
Currently, the signal requests are counted on media side and signal
responses are counted on controller side. This does not provide the
granularity to check how many response messages each media node is
sending.

Seeing some cases where track subscriptions are slow under load. This
would be good to see if the media node is doing a lot of signal response
messages.
2025-10-14 16:58:36 +05:30
Nishad
100bb46af3 Adding ProviderInfo to GetSIPTrunkAuthenticationResponse (#3993) 2025-10-12 15:40:32 +05:30
Denys Smirnov
a87f6c4bc8 Allow passing inline trunk for outbound calls. (#3987) 2025-10-07 17:30:14 +03:00
Benjamin Pracht
be018f97b6 Provide the InputVideo/AudioState to Ingress in WHIPRTCConnectionNotify (#3982) 2025-10-06 14:16:35 -07:00
Benjamin Pracht
146bd9699d Do not panic of redis is not configured (#3981) 2025-10-06 07:47:29 -07:00
Raja Subramanian
3bd20ddb28 Revert unintentional change to not handle transport fallback on (#3970)
publisher peer connection.

While cleaning up during single peer connection changes, unintentionally
removed handler.

Also, another small change to log first packet time adjustment after
increment.
2025-09-30 10:24:26 +05:30
Paul Wells
060719d17d add config for user data recording (#3966)
* add config for user data recording

* missing file

* wire

* deps
2025-09-29 14:01:39 -07:00
Paul Wells
3d73703152 add idempotent reference count to telemetry stats worker (#3964)
* add idempotent reference guard to telemetry stats worker

* tidy

* sync

* tidy
2025-09-29 02:35:16 -07:00
Anunay Maheshwari
990c5fafbb feat: server rpc apis (#3904)
* feat: server rpc apis

* fix: cleanup

* fix: move rpc impl to participant

* cleanup

* cleanup, psrpc errors

* remove TODO comment

* update protocol, handle participant disconnect case

* add ephemeral participant identity to rpc data packet

* fix: panic

* chore(deps): bump proto
2025-09-24 13:16:27 +05:30
Paul Wells
56ee23282f handle terminated job requests (#3948) 2025-09-23 23:54:01 -07:00
cnderrauber
f4a06cf025 Clean code as there is no oss sweeper for ingress (#3918) 2025-09-11 16:44:52 +08:00
David Zhao
5f561b4ff1 Include agent_name as a participant attribute (#3914) 2025-09-10 21:29:55 -07:00
Paul Wells
782a35e801 update protocol for psrpc (#3915) 2025-09-10 21:01:28 -07:00
cnderrauber
76645fad5e Rpcs for ingress proxy WHIP (#3911)
See https://github.com/livekit/protocol/pull/1194
2025-09-09 22:49:42 +08:00
Raja Subramanian
991a4a4f53 Refactor subscribedTrack + mediaTrackSubscriptions. (#3908)
- Move downTrack instantiation to SubscribedTrack as it should own that
  DownTrack. Still more to do here as `DownTrack` is fetched from
  `SubscribedTrack` in a few places and used. Would like to avoid that,
  but doing this initially.
- Use an interface from sfu.Downtrack and replace a bunch of callbacks.
  SubscribedTrack is the implementation for DownTrackListener.
2025-09-08 18:20:19 +05:30
Raja Subramanian
e16b3ba95a Use gzip reader pool (#3903)
Borrowing from @paulwe's change for internal proto
2025-09-07 13:50:22 +05:30
Paul Wells
17c349210d update protocol for sip api change (#3902) 2025-09-06 12:00:22 -07:00
Raja Subramanian
07c40cf349 Use RequestResponse to report protocol handling errors (#3895)
* Send errors as necessary

* WIP

* WIP

* WIP

* WIP

* deps

* static check

* fix test

* test

* test

* logs
2025-09-04 11:27:07 +05:30
Raja Subramanian
6633bf9372 Use departure timeout from room preset. (#3888)
Not sure why only that was applying from req which is effectively a
no-op as the clone is a replica of the req. Guess, it was a typo/miss.
Change it to use room preset config value.
2025-08-29 22:22:32 +05:30
Paul Wells
2aeadf14dc init ua parser once (#3883) 2025-08-28 05:20:25 -07:00
Raja Subramanian
890fd94249 Single peer connection mode (#3873)
* WIP

* check using protocol version

* revert

* clean up

* sdp cid argument

* WIP

* WIP

* test

* clean up

* clean up

* fixes

* clean up

* clean up

* clean up

* conditional checks

* tests for both dual and single peer connection

* test

* test

* test

* type check

* test

* todo

* munges

* combined config

* populate mid

* limit to receive only

* clean up

* clean up

* clean up

* older test

* clean up

* alternative audio codec

* dtx

* don't need to copy

* Anunay feedback

* use the available peer connection

* publisher check

* WIP

* WIP

* WIP

* no mid

* media sections requirement

* mage generate

* WIP

* WIP

* set data channel receive size for test

* handle early media better

* WIP

* do not do ICERestart if no subscriber

* WIP

* WIP

* WIP

* WIP

* WIP

* WIP

* start up subscriber RTCP worker

* WIP

* WIP

* clean up

* clean up

* flag to indicate use of single peer connection

* remove unused interface method

* clean up

* clean up

* Jie feedback #1

* deps

* do not access subscriber in one shot mode

* more places for one shot mode

* more one shot fixes

* deps

* deps

* test
2025-08-28 12:16:18 +05:30
David Zhao
bfe98eaa09 fix: ensure the participant kind is set on refresh tokens (#3881) 2025-08-26 10:25:25 -07:00
Benjamin Pracht
dc3a775350 Fix timeout handing in StopEgress (#3876) 2025-08-25 10:34:26 -07:00
Raja Subramanian
b182d07bac Log signal messages as debug. (#3851) 2025-08-14 16:17:45 +05:30
Raja Subramanian
fa5f4ef33c Populate SDP cid in track info when available. (#3845)
* Populate SDP cid in track info when available.

- Adding SDP cid to TrackInfo. Browsers like FF uses a different stream
  id for AddTrack and actual SDP offer. So, have to look up using both
  on server side. To make it easier, store both (only if different) in
  TrackInfo.
- Use a codec in TrackInfo for audio also. There is some discussion
  around doing simulcast codec for audio so that something like PSTN can
  use G.711 without any transcoding. So, just keep it consistent between
  audio and video.
- Populate SDP cid when SDP offer is received. It could populate a
  pending track or an already published track if the new offer is for a
  back up codec where the primary codec is already published.
- Passed around parsed offer to more places to avoid parsing multiple
  times.
- Clean up MediaTrack interface a bit and remove unneeded methods.

* WIP

* WIP

* deps

* stream allocator mime aware

* clean up

* populate SDP cid before munging

* interface methods
2025-08-13 10:53:16 +05:30