Commit Graph

3363 Commits

Author SHA1 Message Date
Paul Wells
e9b6d9f5e0 handle boolean pointers in config linter 2025-09-24 15:16:18 -07:00
Raja Subramanian
bfba6feed4 Adjust stream allocator ping interval based on state. (#3951)
* Adjust stream allocator ping interval based on state.

In steady state, does a 15 second ping.
While deficient, to be able to react to probes faster, it pings at 100ms
interval.

* clean up

* log ops queue not able to wake up
2025-09-24 14:45:57 +05:30
Raja Subramanian
3837006b39 Revert "Switch ops queue a singly linked list. (#3949)" (#3950)
This reverts commit 80b1166292.
2025-09-24 14:10:01 +05:30
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
Raja Subramanian
80b1166292 Switch ops queue a singly linked list. (#3949)
Seeing a good chunk of CPU in deque usage in some profiles.
2025-09-24 13:13:00 +05:30
Paul Wells
56ee23282f handle terminated job requests (#3948) 2025-09-23 23:54:01 -07:00
Raja Subramanian
49f9b9c8bd Flush stats when there are no packets. (#3947)
With no packets flowing through, the stat gets stuck.
Flush the pipe if there have been no packets in the report interval.
2025-09-23 16:57:41 +05:30
Raja Subramanian
e6a3df1edc ForwarStats.GetStats needs to be public (#3946)
* ForwarStats.GetStats needs to be public

* prevent deadlock
2025-09-23 15:46:12 +05:30
Raja Subramanian
824d116bfe Tweaks tresholds for logging high forwarding latency/jitter. (#3945)
* Tweaks tresholds for logging high forwarding latency/jitter.

Previous attempt showed skewed jitter (i. e. more than 10x latency),
But, no large latency.

So, reducing the latency treshold to declare high latency.
And also keeping track of lowest/highest per reporting window and
logging those along with short term and long term measurements.

NOTE: previously short term and long term were separate calls with locks
acquired. Now, it is all in one lock. So, it does increase the lock
duration a bit, but hopefully not by too much as the welford merge for
short term would go over 20 samples (at 50 ms sampling interval and 1 s
reporting window).

* revert skew factor
2025-09-23 14:46:43 +05:30
Raja Subramanian
408492e030 Log some information around high forwarding latency. (#3944)
* Log some information around high forwarding latency.

Latency is not 0 after switching to microseconds resolution.
But, still seeing high jitter. Logging a bit more to understand under
what conditions it happens.

More notes inline.

* compact
2025-09-23 12:37:09 +05:30
Raja Subramanian
6a41fae548 Use microseconds for forwarding stats. (#3943)
Latency is always 0, but jitter is high.
Not sure how that happens as latency is the welford mean and jitter is
welford standard deviation. Feels like some mis-labeling.

Anyhow, switching to microseconds units to get better resolution.
2025-09-23 02:28:19 +05:30
Raja Subramanian
856e0871bc mediatransportutil to log local address when validating external IP (#3942) 2025-09-22 23:52:16 +05:30
Alex
40101cf7dd Update protocol for SipCreateParticipant (#3939) 2025-09-19 10:47:11 -07:00
Raja Subramanian
b07e7a3828 Use difference in key frame counter to stop seeder. (#3936)
The key frame seeder could be started multiple times.
Use difference to detect stop condition.
2025-09-19 15:15:26 +05:30
Raja Subramanian
d7f928783f Avoid matching on empty track id. (#3937)
Due to SDP ordering, Pion did not provide track ID on a receiver.

Pion needs a=msid line to be before a=ssrc line -> need to check if this
is a spec requirement

Because of the above, it had empty id for the receiver in onTrack.
That matched a published track because we do not duplicate SdpCid in
TrackInfo if the SDP cid matches the signal cid. But, the search checks
both and it matched on empty SDP cid.

Do not accept empty ids in searches to prevent this from happening.
2025-09-19 15:14:17 +05:30
Raja Subramanian
56fb28858a Do DD restart only if DD structure is present. (#3935) 2025-09-19 02:39:08 +05:30
Raja Subramanian
86facce9f4 More debugging of DD jump (#3934) 2025-09-19 01:29:28 +05:30
Raja Subramanian
6058a3f622 Add debugging from DD frame number wrap around. (#3933)
* Add debugging from DD frame number wrap around.

On a DD parser restart, the extended highest sequence number oes not
seem to be updated. Adding some debug to understand it better.

* more logs

* log incoming sequence number and frame number
2025-09-19 00:17:45 +05:30
Raja Subramanian
dc6825c010 mediatransportutil crash fix for logging local address (#3930) 2025-09-16 19:15:49 +05:30
Raja Subramanian
d6f0588fb2 Update mediatransportutil to log external IP found via STUN. (#3929) 2025-09-16 16:34:23 +05:30
Raja Subramanian
2c30a0640a Fix dynacast subscriber node clearing on move participant. (#3926) 2025-09-14 15:20:20 +05:30
Raja Subramanian
6489237e33 Simulcast audio fixes (#3925)
* Simulcast audio fixes

* clean up
2025-09-14 09:41:40 +05:30
Raja Subramanian
9f0ab8706f Wait for SetRemoteDescription before configuring senders. (#3924)
* Wait for `SetRemoteDescription` before configuring senders.

Details inline in code.

* comment
2025-09-12 23:24:56 +05:30
Raja Subramanian
df6c26dbf6 Subscrbed audio codecs - update from remote nodes. (#3921) 2025-09-12 13:01:00 +05:30
Raja Subramanian
798fa76110 Support simulcasting of audio (#3920)
* WIP

* WIP

* new files

* clean up

* test

* Deps

* clean up

* clean up

* goimports latest
2025-09-12 10:20:04 +05:30
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
Raja Subramanian
eee2001a31 Set publisher codec preferences after setting remote description (#3913)
* Set publisher codec preferences after setting remote description

Munging SDP prior to setting remote description was becoming problematic
in single peer connection mode. In that mode, it is possible that a
subscribe track m-section is added which sets the fmtp of H.265 to a
value that is different from when that client publishes. That gets
locked in as negotiated codecs when pion processes remote description.
Later when the client publishes H.265, the H.265 does only partial
match. So, if we munge offer and send it to SetRemoteDescription, the
H.265 does only a partial match due to different fmtp line and that gets
put at the end of the list. So, the answer does not enforce the
preferred codec. Changing pion to put partial match up front is more
risky given other projects. So, switch codec preferences to after remote
description is set and directly operate on transceiver which is a better
place to make these changes without munging SDP.

This fixes the case of
- firefox joins first
- Chrome preferring H.265 joining next. This causes a subscribe track
  m-section (for firefox's tracks) to be created first. So, the
  preferred codec munging was not working. Works after this change.

* clean up

* mage generate

* test

* clean up
2025-09-10 18:28:36 +05:30
Hamdan
fc995533e1 add incoming request id to request response message (#3912) 2025-09-10 08:58:12 +05:30
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
2f43a575db Release candidate for v1.9.1 (#3899)
* Release candidate for v1.9.1

* trim
v1.9.1
2025-09-05 21:28:12 +05:30
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
98352fd0f9 Prevent race in determining BWE type. (#3891) 2025-08-30 21:56:11 +05:30
Raja Subramanian
f7291fdaa8 Do not send both asb-send-time and twcc. (#3890)
* Do not send both asb-send-time and twcc.

In single peer connection mode, both extensions are set on the media
engine and both would be negotiated. Unfortunately, pion/webrtc does
not yet support RTPSender.SetParameters() which would allow setting
specific header extensions for the sender. So, check for TWCC enabled
and use it. If not, do abs-send-time if that is enabled.

* check BWE type

* comment
2025-08-30 19:22:14 +05:30
Raja Subramanian
21b42fa6d9 Do not advertise NACK for RED. (#3889)
Set the transceiver codecs first in single peer connection mode and
then do audio specific config so that NACK is removed for RED.
2025-08-30 17:34:44 +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
Raja Subramanian
38f7906ecb Handle migration better in single peer connection case. (#3886)
* Handle migration better in single peer connection case.

Have to avoid creating a sender for publish tracks.
Otherwise, the sender messes up the answer SDP because
it forced to inactive and that gets used by type match when setting
remote description offer.

Create sender only for m-lines which was used to send.

* remove unnecessary RemoveTrack
2025-08-29 18:18:32 +05:30
cnderrauber
5026de2bea handle frame number wrap back in svc (#3885)
* handle frame number wrap back in svc

* Add Slack Notifier

* check nil dd ext

* log format
2025-08-29 17:11:49 +08:00
Raja Subramanian
091e3c13a1 Revert to using answer for migration case. (#3884)
Was breaking migration in cases where there was inactive transceivers
because of direction check.

This change will break single peer connection case, but can look at that
one later.
2025-08-29 12:58:42 +05:30
Paul Wells
2aeadf14dc init ua parser once (#3883) 2025-08-28 05:20:25 -07:00
Raja Subramanian
998a9f9404 Switch known rids from 012 -> 210, used by OBS. (#3882)
* Switch known rids from 012 -> 210, used by OBS.

* static check
2025-08-28 14:47:57 +05:30
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
Paul Wells
8d270e2a0f chunk room updates (#3880)
* chunk room updates

* move to config

* typo

* default
2025-08-26 09:16:00 -07:00
cnderrauber
b4e146c5cb update mediatransport util for ice port 3478 (#3877) 2025-08-26 10:35:10 +08:00
Benjamin Pracht
dc3a775350 Fix timeout handing in StopEgress (#3876) 2025-08-25 10:34:26 -07:00