43 Commits

Author SHA1 Message Date
Anunay Maheshwari
0c33b8c671 chore: move codecs/mime stuff to protocol (#4255) 2026-01-20 20:54:32 +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
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
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
a370bb2054 Support G.711 A-law and U-law (#3849)
* More codecs

* clean up

* clean up

* add to unprocessed for nil mime type

* enhance tests to check for audio codec preferences also
2025-08-13 14:49:07 +05:30
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
aeec75edeb H265 supoort and codec regression (#3358)
* H265 supoort and codec regression

Support H265 codec.
Add optional codec regression for subscribers don't
support advanced codecs like H265, AV1, VP9.

* restart forwarder on upstream codec change

* tests

* Reneogitate new codec if client doesn't support change

* Add option to disable codec regression

---------

Co-authored-by: boks1971 <raja.gobi@tutanota.com>
2025-02-06 11:56:49 +08:00
Raja Subramanian
789d0484e2 Add RTX to downstream (#3247)
* Add RTX to downstream

* test
2024-12-13 09:57:03 +05:30
cnderrauber
54f9f7de51 upgrade to pion/webrtc v4 (#3213) 2024-11-28 16:05:38 +08:00
cnderrauber
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
cnderrauber
947e8f5909 Speed up track publication (#2952)
* speed up track publication

Add metrics for track publication and subscription

Return EnabledCodecs in JoinResponse so client can
choose codec without server side codec fallback

Cache remote webrtc track without AddTrackRequest to
let client send publisher offer before AddTrackRequest response

* go mod

* clean code
2024-08-23 18:38:32 +08:00
Raja Subramanian
ad1f508680 Add support for "abs-capture-time" extension. (#2640)
* Add support for "abs-capture-time" extension.

Currently, it is just passed through from publisher -> subscriber side.

TODO: Need to store in sequencer and restore for retransmission.

* abs-capture-time in retransmissions

* clean up

* fix test

* more test fixes

* more test fixes

* more test fixes

* log only when size is non-zero

* log on both sides for debugging

* add marshal/unmarshal

* normalize abs capture time to SFU clock

* comment out adding abs-capture-time from registered extensions
2024-04-11 15:25:10 +05:30
cnderrauber
be87a1b6f0 Support rtx for publisher (#2452)
* Support rtx for publisher

* remote log

* solve comment
2024-02-06 21:30:37 +08:00
Raja Subramanian
f38a5794a0 fallback to vp8 if no viable codec (#2211) 2023-11-02 00:03:47 +05:30
cnderrauber
9399fb2bfe Only select alternative codec for video (#2210)
* Only select alternative codec for video

* Filter out empty mime
2023-11-01 19:45:44 +08:00
cnderrauber
3633dfe39e Disable h264 for android firefox (#2190)
* Disable H.264 for android firefox

* Fix syntax error for rule

* lower case

* Remove disabled codec from AddTrackRequest

* Consistent handling of enabled codecs

Mainly cleaning up where we are doing codec filtering.

There's also behavior change of how we handle codec compatibility. If a client doesn't support the client's desired codec, we'll pick a backup automatically
instead of rejecting the client's request.

Requires an update on multi-codec simulcast handling.

* fix alternative codec selection

---------

Co-authored-by: David Zhao <dz@livekit.io>
2023-10-27 14:47:36 +08:00
Raja Subramanian
273defa75f Do not offer H.264 high profile in subscriber offer. (#1997)
* Do not offer H.264 high profile in subscriber offer.

Do not register H.264 high profile with media engine in subscriber
direction.

* add comments
2023-08-25 22:29:59 +05:30
David Zhao
981fb7cac7 Adding license notices (#1913)
* Adding license notices

* remove from config
2023-07-27 16:43:19 -07:00
cnderrauber
d9cd07c4b1 Return chosen codec for simulcast codecs (#1624)
* Return chosen codec for simulcast codecs

* Increase timeout for subscription test
2023-04-17 15:31:28 +08:00
cnderrauber
fb301e6e75 Add vp9 svc support by Dependency Descriptor (#1586)
* Add VP9 SVC support

* Fix preferred fps does not work

* Fix forwarder test
2023-04-06 21:51:33 +08:00
cnderrauber
bdd69c7a1c Add red encoding for opus only publisher (#1137)
* Add red encodings for opus only publisher

* Add test case for red receiver
2022-11-02 10:36:29 +08:00
Raja Subramanian
e7cc6bd4a1 Remove VP9 from media engine set up. (#1004)
* Remove VP9 from media engine set up.

* Remove vp9 from config sample
2022-09-14 16:16:14 +05:30
cnderrauber
c20a91d2b2 enable red by default (#940)
* enable red by default

* fix test case
2022-08-22 17:40:12 +08:00
cnderrauber
a118d21af0 add red codec for opus (#938)
* opus/red codec

* panic

* forward red track to nonred subscriber

* config

* clean code

* solve comments
2022-08-22 12:32:27 +08:00
David Colburn
0b8a180554 Code inspection (#581)
* Code inspection

* fix [4]int64 conversiong
2022-03-30 13:49:53 -07:00
cnderrauber
3959251837 add support for vp9 and av1 (#574) 2022-03-28 22:22:48 +08:00
Raja Subramanian
107e7bbb39 Configurable bandwidth estimation side (#298)
* Fix tests

Add back adding track to publishedTracks for testing purposes.

* WIP branch

* Don't know why merge from `master` did not catch this change.

* WIP commit

* Hook up all the bits for TWCC to work

* Fix typo

* WIP commit

* Catch up to latest API

* Move RTP/RTCP info config

* Instantiate GCC/TWCC interceptor only when in use

* comment SSBWE parts

* RTCP feedback in publisher config
2021-12-30 20:09:03 +05:30
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
David Zhao
2d93ccd668 Updated protocol from protocol/proto -> protocol/livekit (#242)
* Updated protocol from protocol/proto -> protocol/livekit

* separate MediaTrack from PublishedTrack
2021-12-08 13:58:38 -08: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
Raja Subramanian
2d76c672e3 Use abs-send-time RTP header extension for video downstream (#149)
- Update ion-sfu to v1.20.14
- Enable `abs-send-time` for video tracks

Reference: ion-sfu PR - https://github.com/livekit/ion-sfu/pull/12

Testing:
--------
- Look at SDP offer in subscriber PC and ensure that abs-send-time is negotiated.
- Ensure that downstream packets have `abs-send-time` extension for video packets.

TODO:
-----
- Not yet setting this for audio tracks. Eventually we want to move
to TWCC. This is just a step along the way.
2021-10-19 23:46:04 +05:30
David Colburn
8a44fad307 protocol 0.8 (#95)
* protocol 0.8

* merge new selector
2021-08-27 13:16:33 -05:00
David Zhao
4ce29799cf remove H.264 profile 42001f. Safari (14.1.1) does not playback tracks offered in this profile 2021-07-13 22:32:38 -07:00
David Zhao
6751361187 Feature: codec restrictions.
In order to ensure clients are publishing with compatible codecs, the server can enforce codec restrictions.
2021-07-02 16:54:54 -07:00
David Zhao
a3228c2ae9 resolve data race conditions, code quality 2021-06-04 14:57:55 -07:00
David Zhao
090f8d0664 use dedicated PeerConnections for sending and receiving (#19)
* protobuf updates to support new protocol

* use dedicated publish & subscribe peerconnections

* update client to work with dedicated PCs

* fix Go client negotiation, reduced length of UUID
2021-02-12 22:30:31 -08:00
David Zhao
ae203c27e3 send resync to ensure keyframes have been requested 2021-02-06 23:02:21 -08:00
David Zhao
46dadc25c2 simplify token issuer/verifier interface 2020-12-27 20:53:07 -08:00
David Zhao
7d7787590c updated server to webrtc v3 (untested) 2020-12-11 20:15:04 -08:00
David Zhao
c618f8c42f client consumes provided track 2020-11-13 12:31:01 -08:00
David Zhao
6c039bc64f receiver class, imported relevant SFU helpers 2020-10-23 23:01:35 -07:00
David Zhao
71d3a470f5 checkpoint 2020-10-23 00:12:33 -07:00