Commit Graph

419 Commits

Author SHA1 Message Date
David Zhao 882f3bdde5 Allow subscription requests made from server APIs (#249) 2021-12-10 11:51:03 -08:00
shishirng e7b50a79fe Send room info in events by default (#248)
Signed-off-by: shishir gowda <shishir@livekit.io>
2021-12-10 14:11:13 -05:00
Raja Subramanian 8c774f144e Tightening up stats and also counting primary/rtx/padding separately (#247)
* Tightening up stats and also counting primary/rtx/padding separately

* Fix tests

* annotate type stored in atomic.Value
2021-12-10 19:30:27 +05:30
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
Raja Subramanian 7948fabce0 StreamAllocator tweaks (#240)
* WIP commit

* test padding only with a gap scenario

* Debug

* Fix video corruption, need buffer to include payload and translated header size

* Revert incorrect change

* Fix VP8 translation to return buffer with proper length

* Restore 7-bit mode

* WIP commit

* Clean up

* More clean up and tests compiling again

* Fix tests
2021-12-08 21:56:07 +05:30
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
Raja Subramanian 5dc0a43b29 Unit tests for sfu.Forwarder (#239) 2021-12-07 02:51:08 +05:30
David Zhao 318bee4f1e Improve video quality selection by using publisher feedback (#238) 2021-12-06 12:12:08 -08:00
Raja Subramanian ff390820e1 Make VP8 packet translation thread-safe. (#237)
* Make VP8 packet translation thread-safe.

Was using one packet from pool for all VP8 translation which was not thread safe.
Grab packets from the pool when needed for VP8 translation and return to pool after done.
Do not grab packet from pool if the header size between incoming and translated matches.
That also saves copying the packet payload.

* Keep Get/Put in the same function.
2021-12-05 10:01:35 +05:30
Raja Subramanian 45690bc301 Use StreamStateChange with a single list (#235)
* Use StreamStateChange with a single list

Use enum for state change indication on associated track.

* update protocol version
2021-12-04 11:57:23 +05:30
David Colburn c41384cd09 ActiveRecording (#234)
* ActiveRecording

* regenerate

* update to 0.10.3

* 1.17
2021-12-03 21:40:53 -08:00
David Zhao c00d799ac6 Fixed permission handling with room deletion (#233) 2021-12-03 14:27:13 -08:00
Raja Subramanian edafb0a118 VP8Munger tests (#229)
A bit of clean up of unused bits.
2021-12-03 21:57:49 +05:30
Raja Subramanian 6141567aef Unit tests for VP8 pack/unpack in packetMeta. (#228)
Deleting unused code.
2021-12-03 15:37:49 +05:30
Raja Subramanian ac650cd21d RTPMunger unit tests (#227) 2021-12-03 14:47:00 +05:30
Raja Subramanian 5eb58bcb41 Fixing a couple of bugs in StreamAllocator (#225)
* Debug

* More debug

* break -> return

* comment

* Clean up

* spelling fixed
2021-12-02 14:43:56 +05:30
cnderrauber 6510692f23 export structures for cloud (#220)
* export structures for cloud


Co-authored-by: cnderrauber <zengjie9004@gmail.com>
2021-12-02 13:57:22 +08:00
Raja Subramanian 96a3f3e9a7 Minor clean up (#221) 2021-12-01 19:15:06 +05:30
David Zhao 50469b33a9 Fixed incorrect simulcast information (#218) 2021-11-30 21:22:16 -08:00
Raja Subramanian 57ee033d67 Split Forwarder into its own file to make sfu.DownTrack smaller. (#217) 2021-12-01 01:26:55 +05:30
Raja Subramanian 5e7f93c954 Stream allocator - v0.2 (#216)
* Use protocol friendly StreamedTracksUpdate

* WIP commit

* Stream allocator update

* subtract the requested bandwidth as delta from Allocate could be adding to bandwidth

* Calculate delta correctly

* correct comment

* Simplify eventCh per David's suggestion
2021-12-01 01:05:19 +05:30
David Zhao a799069392 Add note about node-ip being public IP 2021-11-30 08:57:44 -08:00
cnderrauber c47ad5e323 export structure & functions for relay (#214)
* export structure & functions for relay

Co-authored-by: jie.zeng <zengjie9004@gmail.com>
2021-11-30 14:08:32 +08:00
David Colburn 6cf662cbe9 send roomID with all events 2021-11-29 16:41:55 -08:00
David Colburn 27a80aa801 fix stats worker 2021-11-29 16:24:29 -08:00
Raja Subramanian e996c185ce Simplifying (hopefully) sfu.DownTrack (#213)
* Simplifying (hopefully) sfu.DownTrack

* Remove unnecessary check as pdding only packets are dropped before that check

* Temporal filtering max layer

* - Split out forwarder bits into a separate structure
- Address comments from Jie and David

* Remove debug and unneeded stuff

* Fix test

* Remove unneeded default initialization
2021-11-28 09:15:36 +05:30
Raja Subramanian 092789a08f Stream allocator fixes (#212)
* Stream allocator fixes

- Treat simple track like simulcast track with one layer to make
it stream allocator friendly.

* Address David's comments
2021-11-27 09:22:39 +05:30
cnderrauber dc60e27413 create TrackSender & TrackReceiver (#211)
* create TrackSender & TrackReceiver

change WebRtcReceiver & DownTrack to use corresponding interface
2021-11-26 15:40:10 +08:00
Raja Subramanian 98695cdd22 downstream allocator (#155)
* WIP branch to hash out down stream allocator.

* Plug more bits of stream allocator

* update protocol

* remove SignalRequest_Simulcast (#154)

* Plug more bits of stream allocator

* Handle simulcast track available layers change

* WIP branch to hash out down stream allocator.

* Plug more bits of stream allocator

* Handle simulcast track available layers change

* Adopt signature of call to AdjustAllocation

* Move StreamAllocator to PCTransport and allocate only for subscriber.

* Move streamallocator to ion-sfu

* Start/Stop of streamallocator

* Use StreamAllocator for subscriber bandwidth management.

* Do not allocate in ADD_TRACK

* Set payload in constructor

* - Add some logging
- Protocol message to notify clients of paused/resumed streams

* named return

* oops correct sense of isPausing

* Update pkg/sfu/streamallocator.go

Committing David's suggestion.

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

* - Log estimate changes/commits.
- Catch more than epsilon change oscillating for long time.

Co-authored-by: David Colburn <xero73@gmail.com>
Co-authored-by: David Zhao <david@davidzhao.com>
2021-11-26 09:11:04 +05:30
David Colburn 9aff9af690 back to MessageRouter interface 2021-11-24 18:43:26 -08:00
David Colburn 991c334d2d telemetry interfaces (#210)
* telemetry interfaces

* move AddUptrack under stats

* regenerate

* a space

* consistency

* fix test
2021-11-24 17:58:04 -08:00
Mathew Kamkar e3c91de594 Configurable limit for number of tracks (#197)
* configurable node track limit

* sample config

* todos

* end of file new line

* default max num tracks

* bandwidth limit

* client message for limit exceeded node

* 10 Gbps default network limit
2021-11-23 15:48:07 -08:00
shishirng 5cdb1c4848 Send room name along in stat message (#205)
Signed-off-by: shishir gowda <shishir@livekit.io>
2021-11-23 15:51:16 -05:00
Raja Subramanian a554da26dc Let down track do the layer filtering (#203) 2021-11-22 23:45:38 +05:30
Raja Subramanian 2f35128ac2 Prioritize down tracks based on max layer(s) (#202)
Use max layer subscription of down tracks to
prioritize bandwidth allocation. The ordering is
- Highest spatial layer
- Highest temporal layer, if spatial layer matches
- Down track id if both layers match (this is to
  prevent unnecessary re-ordering)

Testing:
--------
(Really need to make a DownTrack interface so that
we can mock it and use it in tests)
For now, just a sanity check.
2021-11-22 23:21:26 +05:30
Raja Subramanian 391e2f8b31 Separate out max layer setting (#201)
Small step on the way to making StreamAllocator prioritization of tracks.
With the new callback into StreamAllocator, the idea is to use the
max layer information to do track prioritization.

Testing:
--------
Sanity check that sample app works
2021-11-22 14:01:25 +05:30
lukasIO d9219a2a67 track numParticipants in room (#199)
* track numParticipants in room

* only track participant if not a hidden participant

* adjust coding style to use ++

* fix typo

* fix missing nil check

* update roomstore with new numParticipants on participantChanged

* only update roomstore if participant is not hidden

* call StoreRoom directly after StoreParticipant when joining/leaving
2021-11-21 14:15:22 -06:00
David Colburn a0b623914a store participant before webhook (#200)
* store participant before webhook

* delete participant before participant left event
2021-11-21 13:41:16 -06:00
David Zhao 6dcb29c559 Use publisher PC as default with publish-only connections (#198) 2021-11-20 22:28:36 -08:00
David Zhao 79cfc0d76a update protocol & pion versions 2021-11-19 21:25:08 -10: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
cnderrauber c4c93eaad6 Fix issue #159 (#195)
* Fix issue #159

use timestamp for AudeioLevel observer
change smoothinterval default to 2 for more sensitive
2021-11-16 21:59:15 +08:00
David Colburn 95e29d3766 Interface updates (#194)
* update interfaces, a bit of cleaning

* regenerate

* return interface for RoomService

* export packetBufferSize

* update router interface

* move participant key into router

* change locks back

* read only room store

* fix server rm locks

* update SendJoinResponse

* clean up imports

* update room messaging

* regenerate
2021-11-15 15:25:50 -06:00
David Zhao ffb2c50a70 Fixed room API breakage (#190) 2021-11-14 11:18:01 -08:00
David Zhao ceae58ac20 Fixed deadlocks occurring in Receiver writeRTP (#189)
When we RLock during write cycles, the mutex spends the majority of its time
staying locked. As new participants join, they have to acquire the WLock
before downtracks could be add it.

In load test scenarios (25 participants joining together), it's common to see
goroutine dump showing MediaTrack.AddSubscriber -> DownTrack.storeDownTrack trying to acquire mutex, and never able to acquire it.
2021-11-13 22:59:53 -08:00
David Colburn 4e16e4275c move NewStatsInterceptorFactory 2021-11-12 20:21:54 -08:00
David Colburn 92838d75a8 Analytics events + stats (#187)
* events

* bump

* update incoming stats

* publisher stats

* outgoing rtcp

* stats

* remove unnecessary struct

* merge mediaTrack

* put comment back
2021-11-12 16:36:10 -06:00
David Zhao 6500ce262d Fix publisher loss reporting (#186) 2021-11-11 23:29:54 -08:00
David Zhao 5a057f3d19 Handle nil when buffer pair doesn't exist 2021-11-11 23:16:21 -08:00
Raja Subramanian 0a20acdf68 Do not parse padding only retransmit packets as VP8 payload. (#185) 2021-11-12 10:09:25 +05:30