Commit Graph

51 Commits

Author SHA1 Message Date
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
Raja Subramanian
5ca1626439 Support join request as proto + base64 encoded query param (#3836)
* Support join request as proto + base64 encoded query param

* joinPublish

* staticcheck

* deps

* tests

* gzip

* test

* deps

* clean up
2025-08-07 11:13:27 +05:30
Denys Smirnov
425f6bb3a9 Allow passing extra attributes to RTC endpoint. (#3693) 2025-06-06 14:40:06 +03:00
Soungmin Son (Eddy)
97fcb82a77 Fix: Return NotFoundErr instead of Unavailable when the participant does not exist in UpdateParticipant. (#3543)
* Check if Participant exists when update metadata

* Change Test cases

* type smuggle oss participant check into roomstore

* tidy

---------

Co-authored-by: Paul Wells <paulwe@gmail.com>
2025-03-20 23:56:34 -07:00
Raja Subramanian
9551c52c85 Try 2 to consolidate mime type (#3407)
* Normalize mime type and add utilities.

An attempt to normalize mime type and avoid string compares remembering
to do case insensitive search.

Not the best solution. Open to ideas. But, define our own mime types
(just in case Pion changes things and Pion also does not have red mime
type defined which should be easy to add though) and tried to use it everywhere.
But, as we get a bunch of callbacks and info from Pion, needed conversion in
more places than I anticipated. And also makes it necessary to carry
that cognitive load of what comes from Pion and needing to process it
properly.

* more locations

* test

* Paul feedback

* MimeType type

* more consolidation

* Remove unused

* test

* test

* mime type as int

* use string method

* Pass error details and timeouts. (#3402)

* go mod tidy (#3408)

* Rename CHANGELOG to CHANGELOG.md (#3391)

Enables markdown features in this otherwise already markdown'ish formatted document

* Update config.go to properly process bool env vars (#3382)

Fixes issue https://github.com/livekit/livekit/issues/3381

* fix(deps): update go deps (#3341)

Generated by renovateBot

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Use a Twirp server hook to send API call details to telemetry. (#3401)

* Use a Twirp server hook to send API call details to telemetry.

* mage generate and clean up

* Add project_id

* deps

* - Redact requests
- Do not store responses
- Extract top level fields room_name, room_id, participant_identity,
  participant_id, track_id as appropriate
- Store status as int

* deps

* Update pkg/sfu/mime/mimetype.go

* Fix prefer codec test

* handle down track mime changes

---------

Co-authored-by: Denys Smirnov <dennwc@pm.me>
Co-authored-by: Philzen <Philzen@users.noreply.github.com>
Co-authored-by: Pablo Fuente Pérez <pablofuenteperez@gmail.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Paul Wells <paulwe@gmail.com>
Co-authored-by: cnderrauber <zengjie9004@gmail.com>
2025-02-10 10:44:15 +05:30
cnderrauber
8fa1127724 Disable data channel throttle by default (#3281)
* Disable data channel throttle by default

* data race

* err type
2024-12-21 12:08:54 +08:00
cnderrauber
08b58a23af Refine data slow test (#3278) 2024-12-20 10:58:00 +08:00
cnderrauber
90804c553e more relax on subscriber bitrates (#3265) 2024-12-18 17:02:06 +08:00
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
cnderrauber
499fbd2a1d More test cases for fire track by sdp (#3248)
* More test cases for fire track by sdp

* name
2024-12-13 21:02:26 +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
cnderrauber
54f9f7de51 upgrade to pion/webrtc v4 (#3213) 2024-11-28 16:05:38 +08: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
David Zhao
91cb4369ef Standardize twirp hooks during server init (#2959) 2024-08-26 00:53:13 -07:00
David Zhao
7a774cc82a Support for participant attributes (#2806)
* Support for participant attributes

* move metadata setters to LocalParticipant

* address feedback

* forward error

* update go mod

* update attributes first
2024-06-19 23:14:19 -07:00
David Zhao
981fb7cac7 Adding license notices (#1913)
* Adding license notices

* remove from config
2023-07-27 16:43:19 -07:00
Raja Subramanian
5459bd2931 Push track quality to poor on a bandwidth constrained pause. (#1867)
* Push track quality to poor on a bandwidth constrained pause.

* add tests

* scale distance by divisor

* fix test distance to desired

* wait longer for subscription manager to reconcile
2023-07-11 15:29:35 +05:30
Raja Subramanian
06f9b574cb Delete down track from receiver in close always. (#1842)
* Delete down track from receiver in close always.

I think with the parallel close in goroutines, it so happens that
peer connection can get closed first and unbind the track.

The delete down track and RTCP reader close was inside if `bound` block.
So, they were not running leaving a dangling down track in the receiver.

* fix tests

* fix test
2023-06-30 20:44:57 +05:30
cnderrauber
c1842cb54f Avoid reconnect loop for unsupported downtrack (#1754)
* Avoid reconnect loop for unsupported downtrack

If the client subscribes to a track which codec is unsupported by the
client, sfu will trigger negotiation failed and issue a full reconnect
after received client answer. If the client try to subscribe that track
then it will got full reconnect again. That will cause a infinite
reconnect loop until the client don't subscribe that track. This PR
will unsubscribe the error track for the client and send a
SubscriptionResponse that contain the reason to indicates the track's
codec is not supported to avoid the reconnect loop.
2023-05-31 11:41:22 +08:00
David Zhao
12c6f1e12c Added Xiaomi 2201117TI to devices that does not support H.264 (#1728) 2023-05-22 21:38:56 -07:00
David Zhao
ab1ccae0c7 Respond to signal ping / pong (#871)
* Respond to signal ping / pong

* Pass back 1 for pong for now, we don't need the timestamp

* update protocol
2022-08-05 09:24:47 -07:00
Dan McFaul
aa0df2813f deleting nonRtc rooms and fixing race when deleting rooms (#721) 2022-05-27 09:45:22 -06:00
David Colburn
0b8a180554 Code inspection (#581)
* Code inspection

* fix [4]int64 conversiong
2022-03-30 13:49:53 -07:00
cnderrauber
128199e634 don't send datatrack info to client (#492)
* don't send datatrack info to client
2022-03-08 17:05:26 +08:00
cnderrauber
913ef3a646 Datatrack for data channel (#476)
* data track
2022-03-01 15:48:20 +08:00
David Zhao
7eb2fecadd Close websocket connection upon join failure (#458)
* Close websocket connection on join failure to avoid hang

* fix auto creation bug
2022-02-22 17:43:25 -08:00
David Colburn
7bbd238188 clean up logs and imports (#400) 2022-02-03 14:20:19 -07:00
David Zhao
6af6eefb8c Improve readability of test failures (#386) 2022-01-28 21:34:21 -08:00
David Zhao
9747243ce2 Honor autoSubscribe when subscription permissions are granted later (#381)
* Ensure autosubscribe is honored when subscription permissions were granted later

* negotiate even if no media has been added

* don't double-negotiate
2022-01-28 09:55:10 -08:00
David Zhao
126bb8867b Ability to disable auto-create (#361)
* setting to disable autocreate

* improve test reliability

* update comment

* update to address feedback
2022-01-21 09:57:36 -08:00
David Colburn
5bea9debb7 Code cleanup (#353) 2022-01-19 02:13:06 -08:00
David Zhao
cd9c125414 Also allow headers with CORS (#339) 2022-01-14 10:13:11 -08:00
David Zhao
f9b2af0cf9 Use CORS middleware to allow RoomService use (#335) 2022-01-13 09:29:48 -08:00
David Zhao
b747cdb822 Pass along mime type with TrackInfo (#292) 2021-12-27 23:43:30 -08:00
David Zhao
15cd98be22 Enable Room.List to filter by specific names (#290) 2021-12-27 23:32:29 -08:00
David Colburn
faa870de3d Move callbacks out of messageRouter (#269)
* move callbacks out of messageRouter

* OCD

* more OCD

* fix forwarder test

* even more OCD

* maximum OCD

* package name collision, copy lock by value
2021-12-17 13:19:23 -08:00
shishirng
461f29c097 Allow participants to create new connection for publishing new tracks (#224)
* Allow participants to create new connection for publishing new tracks

new param 'publish=<name>' enables publishing new connection with publish
only grants. Also, identity is appended with '#<name>'

* Add integration test to duplicate publish only connection

Signed-off-by: shishir gowda <shishir@livekit.io>

* Reuse token in test and set subscribeGrant to false on publish param

Signed-off-by: shishir gowda <shishir@livekit.io>

* create auth token with grants

Signed-off-by: shishir gowda <shishir@livekit.io>

* Signal ice on negotiate in test client

Signed-off-by: shishir gowda <shishir@livekit.io>

* Update pkg/service/rtcservice.go

Co-authored-by: David Zhao <david@davidzhao.com>

Co-authored-by: David Zhao <david@davidzhao.com>
2021-12-07 16:23:16 -05:00
cnderrauber
b7f32dfffd Handle multiple codecs in renegotiation (#191)
* Handle multiple codecs in renegotiation

update pion to v3.1.9 for answer same order of codec as publisher.
register enable codecs in subscriber peerconnectin created.

add codec parameter to buffer.bind
buffer should use the codec of TrackRemote as it's codec mime.

sent h264blankframe when DownTrack closing
2021-11-17 21:18:43 +08:00
Artur Shellunts
03342efe4f Test improvements (#136)
* Fix "ineffectual assignment" linter warning

* Simplify TestClientCouldConnect

* Simplify range expression
2021-10-10 22:37:31 -07:00
Artur Shellunts
1c12272927 Refactor singlenode_test.go (#131)
* Fix typo

* test: move client creation to where it is used

* Refactor TestAutoSubDisabled
2021-10-04 13:07:38 -07:00
David Zhao
1bcaf9d0ea update test client to use protocol 3 2021-09-10 20:58:33 -07:00
David Colburn
1f1eea383f add ctx to interfaces (#105)
* add ctx to interfaces

* use existing context
2021-08-30 20:31:24 -05:00
David Zhao
c510ea2e1a Fix race condition with Transport negotiations 2021-06-04 12:26:23 -07:00
David Zhao
bf281b1994 Simplify test helpers, cleanup redis between tests 2021-06-04 11:22:08 -07:00
David Zhao
24919d8ccb working CI test workflow, more reliable transport_test 2021-06-03 22:35:39 -07:00
David Zhao
0900054c24 ability to disable auto subscribe per participant 2021-05-22 22:54:47 -07:00
David Zhao
c76cdf11c2 add tests to ensure subscriber cleanup 2021-05-12 23:52:41 -07:00
David Zhao
99baeb38e4 fix bugs with websocket reconnection, don't re-use redis sinks (#22) 2021-02-15 17:57:01 -08:00
David Zhao
61b9569e38 fix: use track SID instead of source ID 2021-02-08 16:45:18 -08:00
David Zhao
f004aa2952 auto-create rooms upon creation 2021-01-24 23:47:24 -08:00