Commit Graph

551 Commits

Author SHA1 Message Date
Raja Subramanian ab4d57ab5b Filter out UDP candidates from SDP if allowing only TCP. (#874)
* Filter out UDP candidates from SDP if allowing only TCP.

* Do it properly

* static check

* Adding TCP candidates to test
2022-08-05 23:11:07 +05:30
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
Raja Subramanian 3f16018b62 Cache ICE config in room manager. (#872)
* Cache ICE config in room manager.

* mage generate

* Read ICE config within lock
2022-08-05 12:49:19 +05:30
Raja Subramanian 339181a534 Enable fallback to TCP. (#870) 2022-08-05 10:49:34 +05:30
Raja Subramanian 6b6f61b4df Adding transport fallback (#866)
* Adding transport fallback

Commented out for now so that we can gather some data.

* Promoting a few logs to info
2022-08-03 23:03:10 +05:30
Raja Subramanian 3c9a2cc66a Log selected ICE candidate pair (#865)
* Log selected ICE candidate pair

* simplify
2022-08-03 13:31:37 +05:30
Raja Subramanian a393d64ccc Do not re-use transceiver when negotiation is pending. (#862) 2022-07-31 10:50:55 +05:30
Raja Subramanian 52b2e6398b Queue AddTrack if a published track is not yet closed (#857)
* Queue `AddTrack` if a published track is not yet closed

- Adding a queue for pending track by signal cid.
  Ideally, there should not be more than one pending,
  but making a queue to be generic.
- `TrackPublished` is sent if the queue has entries
  when a published track is closed.

* Fix tests and add more checks for queueing AddTrack
2022-07-29 11:51:36 +05:30
David Zhao 53f51c8cb0 Logging cleanup (#843)
* Logging cleanup

Changes log levels to better match significance

* fix lock
2022-07-21 00:39:49 -07:00
Raja Subramanian 51073e8918 Use TimedVersion for subscription permission update (#839)
* Use a read version for subscription permission

* Use TimedVersion for subscription permission updates

* Minor clean up

* latest protocol
2022-07-21 08:52:37 +05:30
Raja Subramanian c88d2f9af5 Make media track test more stable(hopefully) (#841) 2022-07-20 23:44:10 +05:30
cnderrauber b69c314145 update non block tcpmux (#840) 2022-07-20 16:33:56 +08:00
Raja Subramanian 29039b4e76 Use a go routine to clean up stats workers. (#836)
* Use a go routine to clean up stats workers.

It is possible that certain events (like TrackUnpublished) can
happen after the participant is closed. For webhooks pertaining
to those events, need details like room name/id. So,reap stats
workers a little while after the participant left event happens.

* handle data race report

* log analytics worker reap

* debug log
2022-07-18 11:47:43 +05:30
Raja Subramanian 4c7d3161a9 Record dynacast requirement of a subscriber synchronously. (#834)
With rapid changes to subscription settings, use of a goroutine
could end up processing dynacast needs for that subscriber in
a different order. So, record the susbcription needs of a subscriber
in the callback and process the data in a go routine.
2022-07-15 11:46:02 +05:30
cnderrauber a0578db3ed resolve downtrack.bind/close timing issue (#833)
* resolve downtrack.bind/close timing issue

* fix test case
2022-07-15 14:09:45 +08:00
Raja Subramanian af93954c26 Close data channels (#830)
* Close data channels

* don't need to explicitly close data channels
2022-07-13 21:55:12 +05:30
cnderrauber fcdff4f97a enable nack for audio track (#829) 2022-07-13 16:05:57 +08:00
cnderrauber 4280a5993b correct RUnlock (#826) 2022-07-11 12:27:57 +08:00
Raja Subramanian 01f7309adc Separate close and stop on MediaTrackSubscriptions. (#823) 2022-07-09 12:42:54 +05:30
Raja Subramanian 177061712c Do not hold lock while invoking resolver. (#816)
* Do not hold lock while invoking resolver.

Resolver is in room and it will grab its lock.
It is called from partcipant when checking permissions.
Permissions processing uses the participant lock.
So, not a good idea to call a room function with
participant lock held. Avoid that.

Also, use a full lock in the add/remove subscription
path. This is to ensure that permissions path and
subscription path (like subscribing to new participant's
tracks) do not race. As subscriptions are queued now
on the subscriber side, this should be fine.

* Revoke path resolution in ops queue goroutine

* fix test
2022-07-07 13:24:26 +05:30
Raja Subramanian 52aed86080 Add remote participant context to logger (#815) 2022-07-07 10:44:10 +05:30
Raja Subramanian ef66404a1a Keep track of pending subscriber operations. (#814)
* Keep track of pending subscriber operations.

This is required to determine if a receiver does not have
any subscription.

* correct spelling of queuing

* lock around hasPermission
2022-07-06 23:48:28 +05:30
Raja Subramanian fbb1f9fc80 Move subscribe/unsubscribe queue to participant. (#813)
* Move subscribe/unsubscribe queue to participant.

As subscribe/unsubscribe operation can come from both
local media track or remote media track, participant
needs to have it.

* Remove comment

* Stop reneg timer on close

* address comments
2022-07-06 17:27:32 +05:30
cnderrauber 4242205ede move close downtrack to goroutine (#810) 2022-07-05 17:26:47 +08:00
cnderrauber 937882c364 add negotiate failed to ToDisconnectReason (#809) 2022-07-05 11:24:32 +08:00
cnderrauber f17ed9b925 refine negotiation process (#807)
* refine negotiation process

* not restart during ice gathering

* fix test case
2022-07-04 17:11:09 +08:00
Raja Subramanian 7c35184944 Send permissions update on subscribe. (#805)
* Send permissions update on subscribe.

The permission `allowed` update was happening only when
processing pending subscriptions (which happens only on
subscription permissions update).

It is possible that subscription happens through other
paths (like subscribing new participant to tracks).
In that path, we were checking if the track has permissions
and adding to pending. But, we were not checking if
the track is in pending and if it is in there, removing
in on successful subscription and sending an update.
Fix that.

* log more fields in error
2022-07-03 12:17:22 +05:30
Raja Subramanian 5704a7bfca Need this public as it is used from elsewhere (#804) 2022-07-03 11:03:26 +05:30
Raja Subramanian 1428ab3713 Add logs around permissions handling (#803) 2022-07-03 10:56:00 +05:30
David Zhao f1f62ddda5 Sends disconnect reason when server sends Leave request (#801)
* Sends disconnect reason when server sends Leave request

* update go.mod
2022-07-02 21:22:26 -07:00
Raja Subramanian d0bbea6e91 Force send dynacast update on unmute. (#802)
As there is a queue to send dynacast update, forcing
an update on unmute should be fine. That will send
the current state. If the subscribers change it,
an update will be sent as necessary.

This addresses the case of subscription changes happening
when the published track is muted. Dynacast updates are
not sent when publisher tarck is muted. If on unmute,
if subscribers do not have any changes, an update is missed
(i. e. the changes that happen when publisher track is muted
is not sent).
2022-07-03 09:50:14 +05:30
Raja Subramanian 41c57f737c More use of subscriber logger when appropriate and an interface to get (#800) 2022-07-02 20:51:38 +05:30
Raja Subramanian 5a30f6ed87 Add logging for permissions debugging (#799)
* Add logging for permissions debugging

* Remove debug
2022-07-02 14:10:24 +05:30
Raja Subramanian e7033a23c0 Recover from retry on ICE restart (#798) 2022-07-02 11:46:28 +05:30
Raja Subramanian 03b0a01aad Use a queue for add/remove subscribe operations. (#797)
* Use a queue for add/remove subscribe operations.

If subscribe/unsubscribe happens very quickly, the subscription
state gets mixed up as things are keyed off of subscriberID.

Use a queue of subscribe operations and process it serially.

* set up callback for down track added

* move the queue on unexpected type

* move the queue if removeSubscirber does not have a subscribed track
2022-07-02 10:52:55 +05:30
Raja Subramanian 856cc1798f RemoveSubscriber while revoking. (#796)
Else, a quick turn around of permissions tries to subscribe
again and the subscriber is already in the subscribed list.
2022-07-01 11:31:47 +05:30
cnderrauber 93f152779e Migrate with muted track (#794)
* update pion

* migrate muted track

* refine
2022-06-30 00:14:29 +08:00
Raja Subramanian 1e39a680ac Log details of track score when not excellent. (#792) 2022-06-28 14:26:11 +05:30
Raja Subramanian e5f53a0d21 Pass willBeResumed into RemovePublishedTrack (#789) 2022-06-26 11:39:27 +05:30
David Zhao 16505e2ce9 Close room if recorder is the only participant left, not hidden. (#787)
Also need to close participant connections
2022-06-24 15:49:02 -07:00
Raja Subramanian 46bce33fb8 Cache and restore forwarder state on resume (#786)
* WIP commit

* Clean up

* spelling mistake

* Run subscribed track onBind in a go routine

* Address comments and more safety net

* Cache and restore forwarder state on resume

* conflicts

* mage generate
2022-06-24 22:02:03 +05:30
Raja Subramanian adf2d191b0 Re-use transceiver (via ReplaceTrack) if a down track is going to be resumed. (#785)
* WIP commit

* Clean up

* spelling mistake

* Run subscribed track onBind in a go routine

* Address comments and more safety net
2022-06-24 15:07:48 +05:30
cnderrauber 0b630e15b6 disable ice lite by default (#784)
* disable ice lite by default
2022-06-24 15:06:07 +08:00
Raja Subramanian 20512151c6 Prevent subscribe renegotiation if tracks will be resumed. (#781) 2022-06-24 00:06:37 +05:30
cnderrauber 20d777eff9 queue onSubscribedMaxQualityChange callback (#779) 2022-06-23 12:11:16 +08:00
Raja Subramanian 120110fbbe A few more reasons a participant could be closed with (#778) 2022-06-22 11:56:03 +05:30
David Zhao 9d12147d97 Temporary workaround for clients not able to handle combined updates (#777)
See: https://github.com/livekit/client-sdk-js/pull/275
2022-06-21 23:04:49 -07:00
Raja Subramanian 47b89c155f Log reason for participant close (#776)
* Log reason for participant close

Please suggest better naming for different scenarios if something comes
to mind.

* group service requests

* incorporate feedback

* Change names in tests
2022-06-22 10:32:22 +05:30
David Zhao 301bd2771c Expose IsPublisher and IsSubscribedTo via LocalParticipant interface (#772) 2022-06-19 23:58:31 -07:00
Raja Subramanian 1e6a12167b Use loss based scoring for screen share tracks. (#771)
* Use loss based scoring for screen share tracks.

* Remove named TODO markers and file issues
2022-06-20 12:08:30 +05:30