Commit Graph

1212 Commits

Author SHA1 Message Date
Raja Subramanian
02117a4d46 Panic fixes (#3270)
Also, do negotiated down track extensions after bind.
2024-12-19 11:52:43 +05:30
cnderrauber
713e67cd52 Thottle the publisher data channel sending when subscriber is slow (#3255)
* Thottle the publisher data channel sending when subscriber is slow

Avoid the publisher overwhelm the sfu data channel buffer when
the subscriber has lower receive bitrates. It will drop message
if the subscriber is considered too slow to block the entire room.

* Enable nack in mediaengine and disable it in transceiver as need

pion doesn't support per transciver codec configuration, so the nack of this session will be disabled
forever once it is first disabled by a transceiver.
https://github.com/pion/webrtc/pull/2972
2024-12-18 10:51:34 +08:00
Raja Subramanian
28310b670f Update RTC config with congestion control config (#3262) 2024-12-18 00:18:13 +05:30
cnderrauber
6df339b77c Don't SetCodecPreferences for video transceiver (#3249)
The SetCodecPrefrences function will save codecs
to the transceiver and if the primary codec is not
support by the client, the saved codec will generate
rtx codec for the unsupported codec cause corrupted
sdp.
2024-12-13 21:12:30 +08:00
cnderrauber
5dd6858acf Don't wait rtp packet to fire track (#3246)
* Don't wait rtp packet to fire track

Create track from sdp instead of first rtp packet,
it is consistent with the browser behavior and
will accelerate the track publication.

* fix test
2024-12-13 15:06:14 +08:00
Raja Subramanian
789d0484e2 Add RTX to downstream (#3247)
* Add RTX to downstream

* test
2024-12-13 09:57:03 +05:30
Raja Subramanian
4b16017d09 Send side BWE - fixes (#3244)
* WIP

* no worker

* fixes

* use congested packet groups

* oldest group

* markers

* WIP

* WIP

* WIP

* WIP

* WIP

* clean up

* fmt

* consolidate

* store last packet only for bwe extension cases
2024-12-11 21:31:26 +05:30
Raja Subramanian
d0f7eaeadb Use sens side bwe config directly. (#3241) 2024-12-10 10:01:44 +05:30
Raja Subramanian
7f0c14306f One shot signalling mode fixes (#3223)
* set desired on synchronous track

* debug

* debug

* direction

* reuse

* clean up
2024-11-30 14:55:36 -08:00
cnderrauber
c76fb0bcf4 Disable close by dtls to fix migration (#3220)
Pion v4 imports new feature that will close
peerconnection on dtls.close to detects
remote peer closed quickly, it breaks the
session migration.
2024-11-30 09:20:45 +08:00
Raja Subramanian
44d26f0cb4 Probe controller refactor (#3221)
* WIP

* WIP

* WIP
2024-11-30 01:38:25 +05:30
Raja Subramanian
427ed23478 Move probe observer to pacer (#3214)
* Probe ID pass

* WIP

* WIP

* WIP

* WIP

* WIP

* WIP

* WIP

* WIP

* WIP

* WIP

* WIP

* clean up

* typo

* populate desired bytes

* correct num probes calculation

* debug log

* remove unused constant

* log channel observer

* debug

* clear isInProbe flag on end

* clear probe flag on reset

* re-arrange
2024-11-29 09:19:48 +05:30
lukasIO
1c940af8c0 Add datastream packet type handling (#3210)
* Add datastream packet type handling

* point to main in protocol

* Revert "point to main in protocol"

This reverts commit 2cc6ed6520.

* Update protocol
2024-11-28 12:23:40 +01:00
cnderrauber
54f9f7de51 upgrade to pion/webrtc v4 (#3213) 2024-11-28 16:05:38 +08:00
Raja Subramanian
c328b767c9 Do not treat data publisher as publisher. (#3204) 2024-11-26 20:44:37 +05:30
Raja Subramanian
23285744ba Server side metrics (#3198)
* mbb WIP

* deps

* WIP

* WIP

* remove unused file

* Switch to enabled

* misc

* deps

* mediatransportutil update

* Typo

* Set ParticipantIdentity in metrics data packets

* use uint32 as JSON decoder does not unmarshal time.Duration
2024-11-25 13:10:48 +05:30
Raja Subramanian
a83a7abcf4 Start up subscriber RTCP worker in one-shot-signalling mode. (#3194) 2024-11-22 11:04:05 +05:30
Raja Subramanian
3498e53650 Participant method to check a track by name is subscribed. (#3192)
* Set down track connected flag in one-shot-signalling mode.

Also, added maintaing ICE candidates for info purposes.
And doing analytics events (have to maintain the subscription inside
subscriptionmanager to get list of subscribed tracks, so added enough
bits from the async path into sync path to get the analytics bits also)

* comment typo

* method to check if a track name is subscribed
2024-11-22 07:43:38 +05:30
Raja Subramanian
31d6dd7107 Set down track connected flag in one-shot-signalling mode. (#3191)
* Set down track connected flag in one-shot-signalling mode.

Also, added maintaing ICE candidates for info purposes.
And doing analytics events (have to maintain the subscription inside
subscriptionmanager to get list of subscribed tracks, so added enough
bits from the async path into sync path to get the analytics bits also)

* comment typo
2024-11-21 18:41:33 +05:30
Raja Subramanian
9f25603213 One shot signalling mode (#3188)
* WIP

* comment

* Verify method on LocalParticipant

* cleanup

* clean up

* pass in one-shot-mode to StartSession

* null message source and sink

* feedback and also remove check in ParticipantImpl for one-shot-mode-filtering as a null sink can be used for that
2024-11-21 09:33:28 +05:30
Raja Subramanian
cd718c84f6 Misc/minor clean up. (#3183)
Cosmetic. While thinking through how to structure probing better,
noticing small things here and there. Cleaning up and making some small
PRs along the way.
2024-11-17 12:14:46 +05:30
Raja Subramanian
6509cdb5ea StreamAllocator (congestion controller) refactor (#3180)
* refactor WIP

* WIP

* compiling

* runlock

* fixes

* fmt

* stringer and unlikely logger

* clean up
2024-11-16 03:06:37 +05:30
Raja Subramanian
cc22306047 Attempt to fix missing participant left webhook. (#3173)
On a resume, the signal stats will call `ParticipantLeft`. Although, it
explicity says not to send events, it could still close the stats
worker.

To handle that, we created a stats worker if needed in
`ParticipantResume` notification in this PR
(https://github.com/livekit/livekit/pull/2982), but that is not enough
as that event could happen before previous signal connection closes the
stats worker.

A new stats worker does get created when `ParticipantJoined` is called
by the new signal connection, but it does not transfer connected state.
So, when the client leaves, `ParticipantLeft` is not sent.

I am not seeing why we should not transfer connected state always given
that it is the same participant SID/session. But, I have a feeling that
I am missing some corner case. Please let me know if I am missing
something here.
2024-11-14 10:59:15 +05:30
Raja Subramanian
a3f2ca56f9 TWCC based congestion control - v0 (#3165)
* file output

* wake under lock

* keep track of RTX bytes separately

* packet group

* Packet group of 50ms

* Minor refactoring

* rate calculator

* send bit rate

* WIP

* comment

* reduce packet infos size

* extended twcc seq num

* fix packet info

* WIP

* queuing delay

* refactor

* config

* callbacks

* fixes

* clean up

* remove debug file, fix rate calculation

* fmt

* fix probes

* format

* notes

* check loss

* tweak detection settings

* 24-bit wrap

* clean up a bit

* limit symbol list to number of packets

* fmt

* clean up

* lost

* fixes

* fmt

* rename

* fixes

* fmt

* use min/max

* hold on early warning of congestion

* make note about need for all optimal allocation on hold release

* estimate trend in congested state

* tweaks

* quantized

* fmt

* TrendDetector generics

* CTR trend

* tweaks

* config

* config

* comments

* clean up

* consistent naming

* pariticpant level setting

* log usage mode

* feedback
2024-11-11 10:24:47 +05:30
Raja Subramanian
653857e42b Split out audio level config. (#3163)
* Split out audio level config.

Inline it in yaml as it is exposed/documented config.

* test

* default congestion control enable
2024-11-08 21:36:38 +05:30
Raja Subramanian
86383b2271 De-centralize some configs to where they are used. (#3162)
* De-centralize some configs to where they are used.

And make default variables.

Renaming a bit, but these are all internal config and have not been
added to documented config.

* Keep documented config as is.

* test

* typo
2024-11-08 12:47:30 +05:30
Raja Subramanian
365e63230d Some misc clean up. (#3156)
* Some misc clean up.

- Have been seeing counterfeiter warnings about efficiency for a while
  with go:generate declaration multiple times in the same package.
  Address that: https://github.com/maxbrunsfeld/counterfeiter?tab=readme-ov-file#step-2b---add-counterfeitergenerate-directives
- A bit more readability on parameters passed to `sendLeave`

* spacing

* revert some deletes as the complaint was in analytics service only

* Declare in package only once.

Although the warning is about go:generate multiple times when directly
giving the interface to generate, have `go:generate` multiple times in a
package even with `-generate` ends up generating once per invocation.
Once per package is enough to run the generation just once.
2024-11-04 11:26:41 +05:30
Raja Subramanian
35bef35d66 Clean up drop ICE candidates. (#3153)
* Clean up drop ICE candidates.

With pion/ice v2.3.37, ICE Lite will accept use-candidate from peer.
So, there is no need to drop candidates.

Still leaving the FF change to not use Lite which was added as part of
this effort initially due to how FF does nominations. Updated comment to
explain why.

* clean up test
2024-11-02 10:50:55 +05:30
Raja Subramanian
1c80ce8308 Only drop srflx if configured. (#3149) 2024-10-30 21:20:34 +05:30
Raja Subramanian
da9bd7f426 make a util of IP address truncation for logging. (#3148)
* make a util of IP address truncation for logging.

* exported method
2024-10-30 19:44:41 +05:30
cnderrauber
526985f109 don't return video/rtx to client (#3142) 2024-10-26 22:29:04 +08:00
Raja Subramanian
024a75d27c display related only when address is valid (#3137) 2024-10-24 18:26:56 +05:30
Raja Subramanian
fbdc2491d9 Log truncated (#3136)
* Log truncated

* add related address
2024-10-24 16:24:54 +05:30
Raja Subramanian
b8c6b1f1ec Log ICE connection info on failure. (#3134)
- Truncate public remote IP
- Log only on short connection to avoid logging too much
2024-10-24 14:30:04 +05:30
Raja Subramanian
de102f32db Display both pairs on selected candidate pair change (#3133)
* Display both pairs on selected canddiate pair change

* disable ICE lite for Firefox
2024-10-23 21:30:52 +05:30
Raja Subramanian
487a3fc3fb ICE candidate marking (#3128)
- Update filtered if dropping a pending candidate later.
- Ordinal for selected pair so it is easy to see which got selected
  later.
2024-10-22 20:23:55 +05:30
cnderrauber
b30cc9066a Drop remote candidates based on lite option (#3127)
Only drop remote candidates if remote peer is
not lite and local peer is lite.
2024-10-22 17:53:40 +08:00
David Zhao
dd7cd7eafc Handle room configuration that's set in the grant itself (#3120)
* Handle room configuration that's set in the grant itself

* ensure refresh token contains updates

* deps

* dep

---------

Co-authored-by: Paul Wells <paulwe@gmail.com>
2024-10-21 23:31:12 -07:00
David Zhao
3e7185f264 chore: add check to skip launching TrackEgress for Egress participants (#3125)
Egress participants don't publish, so there is no functionality change
2024-10-21 20:47:41 -07:00
Raja Subramanian
a564f7fbe6 Add option to drop remote ICE candidates. (#3118)
Defaults to OFF.
2024-10-19 10:30:22 +05:30
Raja Subramanian
182a073353 Log ICE reconnected when selected pair changes. (#3117)
Logging selected pair when ICE connection state changed could have
picked up previous selected pair.

Also, log shortened remote IP and remote port.
2024-10-18 23:32:18 +05:30
Raja Subramanian
44a74fc06a Clean up sending raw mime as well. (#3113) 2024-10-18 00:34:29 +05:30
Raja Subramanian
40b10af960 Use monotonic time util. (#3112)
Thank you @paulwe for doing this. I was promising to do this for a
while, but just like other times, empty promises :-(
2024-10-17 10:49:24 +05:30
Raja Subramanian
792964ad1c Always add upper case mime for video to work around a prefix trim issue (#3106) 2024-10-16 15:32:37 +05:30
Raja Subramanian
634b1f9261 Populate raw mime when there is one already (#3104) 2024-10-16 13:03:26 +05:30
Raja Subramanian
c8bb3345c6 Send raw mime type also in subscribed qualities. (#3103) 2024-10-16 11:45:12 +05:30
Raja Subramanian
8b604df32a Set FEC enabled properly in connection stats module. (#3098)
* Set FEC enabled properly in connection stats module.

With RED, the FEC indication is in primary codec.

Also, clean up some bits that were not necessary (TrackInfoAvailable is
not needed)

TODO: There are still a couple of things to figure out
- If codec is RED, Opus is added as second codec synthetically using
  33098337fc/pkg/rtc/mediaengine.go (L31)
  which hard codecs FEC enabled. Ideally, we should get the primary
  codec parameters from SDP offer.
- The WebRTCReceiver does not have information about primary codec. For
  now, just setting FEC to true when RED is enabled. It is okay as it
  just affects when we declare quality drops, but ideally the primary
  codec should be retrieved from SDP offer.

* clean up and comment

* full prop check
2024-10-15 17:39:42 +05:30
cnderrauber
9147120915 Exclude session start time from publishing time (#3089) 2024-10-12 10:19:33 +08:00
cnderrauber
cf59267631 Add counter for pub&sub time metrics (#3084)
* Add counter for pub&sub time metrics

The pub&sub shows large value in migration related case like
muted/disabled migration, the subscription time depends on
the time when publisher unmute the track(sending rtp packet
after migration), add a counter to distinguish since we
can't control the time in such cases and the first subscription
attemps also is more meaningful than those cases.

* Add info log for high publish delay
2024-10-11 12:07:24 +08:00
cnderrauber
c8dbe8e977 reset subscription time when downtrack closed and expect resume (#3083) 2024-10-10 16:06:44 +08:00