Commit Graph

511 Commits

Author SHA1 Message Date
David Colburn 1f643dc96b remove SignalRequest_Simulcast (#154) 2021-10-21 17:11:43 -05:00
David Colburn c680c2465d update protocol 2021-10-21 14:36:53 -07:00
Raja Subramanian e0e46e079d Prevent missing entry in pending tracks (#152)
* Prevent missing entry in pending tracks

Problem:
--------
A track received via signalling request `AddTrack` is stored
in `pendingTracks` of participant. A MediaTrack is created
when `onTrack` fires after `SetRemoteDescription`. At that
time, pending tracks are searched to find a matching track
and look up an already published MediaTrack.

This is because `onTrack` fires once for every layer of
Simulcast and MediaTrack abstraction is for a media track and
not one for every layer of Simulcast track.

To accomplish that, pending tracks are cleaned up 5 seconds
after the MediaTrack is created. The theory there is that
`onTrack` will fire on all layers within 5 seconds. But, have
observed several instances on my slow machine of that firing
after 5 seconds which results in the search failing and we end
up creating a new MediaTrack.

The above is probably the reason (I am guessing though) for
subscriber PC having an extra m-line some times.

Considered fix:
---------------
One possible option is to increase that 5 seconds timeout to a
very large value. But, it has another issue.

`getPendingTrack` is given the track id which comes in the SDP.

Entries are added to the pending tracks using track id received
via the `AddTrack` signalling message.

And those two need not be the same. Especially Firefox has different ids
every time. Not sure if that is something we do on client side which
causes that, but it does look like a real possibility.

To handle that case, `getPendingTrack` looks up tracks by media kind
(audio/video) if the look up by SDP client id fails.

Here, it is possible that there are two pending tracks of type video
(think camera and screen sharing as an example) and looking up by kind
might end up picking the wrong one.

Fix:
----
Store the signalled client id and SDP client id in the MediaTrack and
look up the published tracks by SDP client id for a track match.

If there is no match, create a new MediaTrack and add it to publishedTracks
and delete the corresponding pending track all within the lock (yeah not
great to have a lot of code within the lock, but this is probably worth
it to have the correctness).

This does solve the issue of deferred pending track removal causing issues.

However, note that kind based look up may do some switching. In a scenario
where there are two pending tracks of kind video and the look up has to
rely on kind, it is possible that signalCid and sdpCid get cross matched
(i. e. client might have sent a signalCid for a Simulcast track, but during
kind based look up it gets assigned to a non-simulcast track). I think
that is okay as there is no strong correlation between the two.

Testing:
--------
- Connect from Chrome, Firefox (both orders, Chrome joining first, Firefox joining first) and ensure that media subscriptions and publishing are correct
- Ensure that DTX munging works properly too.

* Fix tests

Add back adding track to publishedTracks for testing purposes.

* Add a test to check case of `AddTrack` rejecting already published track

* Remove debug.

* Address PR comments - do not need to return SDP cid from `getPendingTracks`.
2021-10-21 12:50:07 +05:30
David Zhao 3f0d1ff0ce v0.13.5 v0.13.5 2021-10-19 23:22:55 -07:00
David Colburn 86d7fe8241 take iceServers out of room (#151) 2021-10-19 19:56:34 -05:00
David Zhao 833e497f37 Pass TrackInfo entirely to ensure fields aren't missing (#150) 2021-10-19 17:27:32 -07: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 0c8fe361b2 Small refactor (#148)
* small refactor

* extra line

* fix room allocator test

* selector fakes not used

* keep decisions out of router

* put nodeId logic back

* fix room allocator test
2021-10-18 21:49:16 -05:00
David Colburn 1d626ba053 Update turn (#147)
* more generic turn server

* public turn realm name

* support turn cert itself in config

* remove cert/key from config

* double auth handler

* generate

Co-authored-by: Mathew Kamkar <578302+matkam@users.noreply.github.com>
2021-10-18 16:14:27 -05:00
David Zhao 43079866a2 Update to Pion v3.1.5, fixed simulcast / non-simulcast mixing 2021-10-15 09:35:01 -07:00
David Zhao 182c19e8e2 version v0.13.4 v0.13.4 2021-10-15 00:32:57 -07:00
David Zhao 81712f9502 revert to pion v3.1.0-beta.3
mixing of simulcast and non-simulcast tracks is broken
2021-10-15 00:31:57 -07:00
David Zhao eba0c23375 Handle TrackInfo.Source attribute (#146)
* Support passing along Source attribute
v0.13.3
2021-10-14 13:10:57 -07:00
Raja Subramanian d08646f17e Reuse transceivers (#145)
* WIP - Re-use transceiver

* Support both old and new methods for adding transceiver
2021-10-14 11:57:59 +05:30
Raja Subramanian ac4db4575f LK-105 (Opus DTX) (#140)
* LK-105 (Opus DTX)

https://linear.app/livekit/issue/LK-105/allow-enabling-of-opus-dtx

Enable/Disable Opus DTX using SDP answer based on setting in
`AddTrack` request.

Testing:
--------
Chrome and Firefox work. Having audio problems with Safari
(maybe the Safari 15 issue as I am not getting media)

* Check that receiver has no tracks

* Skip non-audio transceivers

* A small clean up to not use pendin track outside lock and also append with spread

* Address comments from review by David

* Update pkg/rtc/participant.go

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

* Pull in tagged version of webrtc and lk protocol

Co-authored-by: David Zhao <david@davidzhao.com>
2021-10-13 11:22:33 +05:30
Mathew Kamkar 84ab0f82af Prometheus counters for RTC connection steps (#143)
* signal ws connection, participant join, ice connection

* must register

* offer negotiation

* dz review: offer and offer_response

* dz review: answer
2021-10-12 15:22:17 -07:00
David Zhao 4149c4a314 removed duplicate region log 2021-10-10 22:52:51 -07: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
David Zhao 575b99840a Fixed handling of multiple nodes in region-aware routing 2021-10-10 22:25:29 -07:00
Brint E. Kriebel 822f8c3944 Region Aware node selection fixes and enhancements (#141)
* cli: Allow setting the current node region with flag or env variable

Also add region to "starting LiveKit server" log.

* routing: Add region to node registration

Register the node's region on the selected router so it can be used for
region aware node selection.

Also add the region to the list-nodes output.

* regionaware: Set minDist to zero for the current node

If you don't set the minDist when leaving the loop early for a node that
matches the current region, the minDist value with still be at max. This
causes the the wrong node to be selected if the current node is the
first one the loop passes through.

Add a test that validates this change. The new test fails if this new
change is not in place.
2021-10-10 22:21:37 -07:00
cnderrauber 8ff18e0326 forward fraction lost from subscriber to publisher (#142)
Co-authored-by: cnderrauber <zengjie9004@gmail.com>
2021-10-10 21:56:13 -07:00
David Colburn 72bd394106 v0.13.2 v0.13.2 2021-10-10 13:27:37 -07:00
David Zhao 3013139fa0 update link to deployment docs 2021-10-08 23:02:52 -07:00
Mathew Kamkar b212fb9a9e Prometheus counter for Signal/RTC messages (#139) 2021-10-08 12:02:08 -07:00
David Colburn 2c9ef2f6bb Update recording service (#137)
* update recording service

* return empty for EndRecording

* update protocol
2021-10-08 13:44:41 -05:00
Russ d'Sa f6f5602bc4 consolidate on api key and api secret to describe our key pairs (#138)
* consolidate on api key and api secret to describe our key pairs

* tweak error message for the keys flag
2021-10-07 15:50:18 -07:00
David Zhao 52e10ea315 handle nil MessageChannel 2021-10-06 22:24:09 -07:00
David Zhao c745f0a318 Region aware routing (#135)
* Region aware routing

* update config, fix spacing on commented out lines
2021-10-06 21:40:04 -07:00
Mathew Kamkar b0eca12ee8 Simple deployment to EC2 (#134)
* aws ami

* cloud-init from base ami

* rename

* readme and ubuntu cloud-init

* nginx ssl termination

* small readme fixes

* nginx on ubuntu cloud-init

* better default config, nginx websocket config

* small change to readme

* packer does not need to start services

* standardize nginx config

* path fixes

* small fixes

* end line return

* move readme to docs repo

* remove lk-image cloud-init and bake into ami
2021-10-05 10:47:55 -07:00
Artur Shellunts 4915692f7c Refactor getConfigString (#133)
* Add test for getConfigString

* Refactor getConfigString

* Increase connect timeout in tests
v0.13.1
2021-10-04 17:20:47 -07:00
David Zhao fb91dce30e version bump v0.13.1 2021-10-04 17:17:41 -07:00
David Zhao 797d2607c4 Fix NACK handling in simulcast (fixed in ion-sfu) 2021-10-04 17:17:41 -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
Théo Monnom 939ed10ca6 Room Metadata Implementation (#126) 2021-10-02 22:08:29 -07:00
David Zhao cdb04248fb Fixed reconnection for single node
It does not yet support resuming the session.
2021-09-24 14:19:23 -07:00
David Colburn d83b7b543d update protocol 2021-09-22 13:48:37 -07:00
David Zhao 4fe3c07bb0 version bump 0.13.0 v0.13.0 2021-09-21 23:26:22 -07:00
David Colburn 347bf0345a Recording webhooks (#125)
* dump

* update protocol

* const

* regenerate wire

* message bus nil check

* nil message bus if no redis

* start and stop rec service
2021-09-21 23:46:25 -05:00
David Zhao 3ed3afad2c Recognize Go client in parsing 2021-09-17 16:25:47 -07:00
David Colburn c4c14785be let the room manager delete from router and store (#121) 2021-09-17 13:57:06 -05:00
David Zhao ff47301820 Implements protocol 3 speaker updates (#120)
* Disallow AddTrack from participants that don't have the permission

* Support protocol 3 speaker updates, client info

* update protocol

* Disallow AddTrack from participants that don't have the permission

* increase wait time for GH to pass
2021-09-17 11:47:13 -07:00
David Colburn abde72a907 Remove room manager from room service (#119)
* start splitting

* room allocator

* remove room manager

* Update pkg/service/roomallocator.go

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

Co-authored-by: David Zhao <david@davidzhao.com>
2021-09-17 01:29:29 -05:00
Mathew Kamkar 700a879c0b Redis Router graceful stop (#116)
* prestop and hasparticipants in interface

* add prestop function to existing routers

* fakerouter prestop

* update protocol version

* read lock

* redis router graceful stop

* test fix

* force stop
2021-09-15 13:07:44 -07:00
David Zhao 20d0c0ca43 Fix mute of simulcasted video tracks with < 3 encodings (#114) 2021-09-14 15:50:34 -07:00
David Zhao 95a5e3ca85 Fix data publish test (#113) 2021-09-12 00:25:36 -07:00
David Zhao 66997b37f9 improve reliability of data publish test 2021-09-11 23:33:35 -07:00
David Zhao 976e61f10c more generous sleep workaround in test client, better logging 2021-09-11 23:18:20 -07:00
David Zhao ceea024fdb fix tests 2021-09-11 22:50:00 -07:00
David Zhao e99ec0b339 Add tests to data publishing with protocol 3 2021-09-11 22:27:17 -07:00
David Zhao 1bcaf9d0ea update test client to use protocol 3 2021-09-10 20:58:33 -07:00