1550 Commits

Author SHA1 Message Date
David Zhao 3e08ff1043 version 1.3.4 (#1411) v1.3.4 2023-02-09 23:31:42 -08:00
David Zhao 9a7ea7a2fa Close previous request channels when during initial retry (#1409)
So we don't leave abandoned requests hanging on the media instance
2023-02-09 17:27:33 -08:00
renovate[bot] aebec26ace Update docker/build-push-action action to v4 (#1405)
Generated by renovateBot

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-02-09 15:39:05 -08:00
Dan McFaul ad7e075c18 exit after panic (#1392)
* let panics crash

* Revert "let panics crash"

This reverts commit 8027cccadd.

* catch and log panics then os.Exit

* Recover only recovers, caller can exit

* only exit on pacic, still need Recover calls in goroutines
2023-02-09 16:33:22 -07:00
renovate[bot] bee4bcc158 Update golang Docker tag to v1.20 (#1403)
Generated by renovateBot

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-02-09 15:29:53 -08:00
David Colburn d2f0496223 list egress by id (#1404)
* list egress by id

* update proto ref
2023-02-09 00:10:54 -08:00
David Colburn 403c23ef82 Update renovate config (#1399)
* update renovate config

* group pion deps

* pion
2023-02-08 16:38:45 -08:00
Raja Subramanian 8a7478fd0e Send stream state paused only when it is paused due to bandwidth limitation. (#1391)
* WIP commit

* Send stream state paused only when it is paused due to bandwidth limitation.

When stream is resumed after a stream is paused, an active update is
sent. Note that this means if there are intervening events like
mute/unmute between pause and resume, resume will be sent.
2023-02-08 20:03:32 +05:30
Raja Subramanian 95bc5b9849 Trigger max layer switch when downgrading. (#1398)
When downgrading (could be due to overshoot or opportunistically
locking to a higher layer), need to check if the max layer notification
needs to be done so that dynacast has the right max layer for the
participant corresponding to this downtrack.
2023-02-08 18:54:54 +05:30
cnderrauber a04e7ce647 Fix panic by CreateSenderReport before bind completed (#1397) 2023-02-08 17:02:19 +08:00
Raja Subramanian 4d8def2eb7 Ignore errors on closed connection. (#1396) 2023-02-08 13:41:04 +05:30
Raja Subramanian a1338b149c Limit layer to num advertised. (#1395)
* Limit layer to num advertised.

Otherwise, this leads to invalid layer for non-simulcast tracks.

* need to subtrack 1

* fix test
2023-02-08 11:28:32 +05:30
cnderrauber 5161dba873 Filter mdns candidate if not mdns not enabled (#1393)
* Filter mdns candidate if not mdns not enabled

* log target
2023-02-08 10:27:24 +08:00
cnderrauber 2393a559c4 ensuare onPacket is not nil in rtcpreader callback (#1390) 2023-02-07 15:49:32 +08:00
cnderrauber 524e8985c6 silent frame for muted audio downtrack (#1389)
send silent frame for subscribe to a muted audio downtrack (opus)
write blank frames for red audio track
2023-02-07 15:29:38 +08:00
Raja Subramanian 9d32c6065d Include track priority in de-duper checks (#1388) 2023-02-07 11:57:29 +05:30
cnderrauber 470a6fc9f1 Revert "Send silent frame for muted audio downtrack (#1385)" (#1387)
This reverts commit 0e699d6ed0.
2023-02-07 14:10:39 +08:00
cnderrauber 0e699d6ed0 Send silent frame for muted audio downtrack (#1385)
* Send silent frame for muted audio downtrack

* Don't drop audio packets on pub muted

* don't inject blank audio frames for muted track
2023-02-07 13:12:50 +08:00
David Zhao 2851a8ac98 Improved robustness of subscription stack (#1382)
UpdateSubscription had a shortcoming where when it couldn't find the
participant, it ignored the request.

This PR further removes the reliance of current publisher state from
subscribers.
- SubscribeToTrack only takes in a trackID
- Introduced RoomTrackManager to maintain all published tracks to a room
- Added TrackUnpublished event to clearly indicate when a track has been removed
- SubscribeRequested event no longer include information about the publisher
2023-02-06 18:08:26 -08:00
Raja Subramanian aaba402ada Log messages processed by signal de-duper. (#1384)
This will get noisy. Will revert once we have some data to analyse.
2023-02-06 10:55:42 +05:30
cnderrauber 8b6dab780c Add reconnect reason and signal rtt calculation (#1381)
* Add connect reason and signal rtt calculate

* Update protocol

* solve comment
2023-02-06 11:12:25 +08:00
Raja Subramanian d67cdb6141 Return early if already subscribed. (#1377)
* Return early if already subscribed.

When already subscribed, returned `subTrack` is nil.
Return early, but do not return an error.

* check for nil subTrack

* check for nil as well
2023-02-04 13:47:35 +05:30
David Zhao add9962655 Avoid triggering subscription failed handler unnecessarily. (#1379)
Certain errors are not at fault of the subscriber. For these errors
the reconciler should keep trying instead of giving up.
2023-02-03 01:06:04 -08:00
Raja Subramanian 1c697a073c Re-initialise reference layer on a resume. (#1376)
* Re-initialise reference layer on a resume.

It is possible for a down track to resume from seeded state.
But, storing reference layer means it is storing something that
is dependent on up track. On a resume, if the up track does not
produce the reference layer, RTCP sender reports will not be sent.
So, remove that up track dependency and re-initialise the reference
layer on a resume.

This could affect A/V sync, but it should not be bad.
But, need to observe the effects.

* min difference of 1
2023-02-03 10:38:49 +05:30
David Zhao 15edd4d86e Fix potentially nil access in buffer (#1374) 2023-02-02 14:56:07 -08:00
David Zhao be4764b93b Improve panic recovery to use participant logger. (#1375)
Also made IssueFullReconnect public
2023-02-02 14:55:50 -08:00
Raja Subramanian 501fb0860e correct test name, only latest version is used (#1373) 2023-02-03 03:50:45 +05:30
Raja Subramanian 037ae572d9 Ensure older participant session update does not go out after a newer (#1372)
* Ensure older participant session update does not go out after a newer
session has joined.

* fix tests

* change comment

* do not send older version
2023-02-03 00:30:11 +05:30
David Zhao 8c513a1fc5 Improve SubscriptionManagerTest resilience (#1370)
This check fails on GH Actions occasionally due to timing differences.
2023-02-01 22:55:57 -08:00
David Zhao 40120db993 Tweaks to subscription reconcile timeout (#1369) 2023-02-01 22:36:14 -08:00
David Zhao 8ba6418ab4 Server-side workaround for JS SDK's inability to handle ReconnectResponse (#1367)
See: https://github.com/livekit/client-sdk-js/pull/568
2023-02-01 15:37:18 -08:00
Raja Subramanian ffadb94e3a Simplifying forwarding logic a bit (#1349)
* Notes on wht to do

- Should targetLayers be altered while doing opportunistic locking
- Should targetLayers be altered in any other path than stream allocator path?
- Lock to layer as long as it is <= opportunistic layer
- When not congested, opportunistic can be highest
- When congested, opportunistic could be nil or lowest if paused is not allowed
- When muting, can we hold on to current layers (or keep it as previous) and
  restore on unmute.
- Store current/target in forwarder state and restore on seeding
- Watch for looking for targetLayers, etc. when looking to insert padding
  packets. There may be an assumption about restarting on key frame and hence
  okay to insert padding when target layers are invalid. This may not be true
  any more when doing opportunistic forwarding.
- Can we distinguish between publisher mute or dynacast (i. e. publisher side
  stopping) vs subscriber mute and do something useful? Publisher side mute
  could mean continuity in sequence numbers on a restart (might be able to
  catch it with opportunistic forwarding). But, there is the challenge of
  unmute from publisher via signalling channel vs media. If media is arriving,
  should subscribers do opportunistic forwarding before publisher mute state
  update happens?
- Maybe introduce a mode where forwarding continues to a frame end (of course
  with a time limit just in case the end of frame packet is lost) and then
  insert silence/padding packets?
- Ensure that audio blank frame insertion does not suffer from frame boundary
  issues.

* pub/sub mute separate + more notes on things to check

* WIP commit, more notes

* WIP commit

* WIP commit

* WIP commit

* WIP commit

* WIP commit

* WIP commit

* clean up

* slightly better comments

* Do not stop on unmute

* do not inject blank frames when pub muted

* do not forward on audio publisher mute
2023-02-01 21:57:53 +05:30
cnderrauber 7e5ba6a3b0 Improve connectivity check (#1366)
* Add Timer to detect dtls failure quickly

* Fix pc state check in timeout after ice

* More strict conditions to switch candidate type

* log for signal interuppt

* typo
2023-02-01 20:00:34 +08:00
Raja Subramanian 1c321bfccc Ignore inactive media. (#1365)
* Ignore inactive media.

Seeing some errors of
"track info not published prior to track".
Happens when trying to configure publisher answer for audio
for DTX and stereo and trying to find a pending track.
There are cases where there are inactive m-lines in SDP
that is hitting this.

* fix sense
2023-02-01 12:41:07 +05:30
Benjamin Pracht 30adc6ee15 Fix typo in twirp server status code parsing (#1361) 2023-01-31 17:43:59 -08:00
Raja Subramanian 71eac631a1 Log offer/answer close to WebSocket connection ingress/egress. (#1359) 2023-01-31 17:50:56 +05:30
David Zhao 2048cfbfc7 Increase subscription manager notFound timeout (#1358)
Giving it more time before triggering the nuclear option of unsubscribing
from the track.
2023-01-31 00:52:12 -08:00
Raja Subramanian 80c647ef15 Update PSRPC to 0.2.5 (#1357)
Not able to update cloud without this.
2023-01-31 14:11:44 +05:30
Benjamin Pracht c6e8887ab8 Allow requesting a specific Egress Cluster Id (#1342) 2023-01-30 17:04:26 -08:00
David Zhao b023c531c2 Fix incorrect unsubscribed track telemetry (#1350)
- only log unsubscribe on close if Track was actually bound
- update subscribed counters even if a failure had been logged before
2023-01-30 10:16:21 -08:00
Raja Subramanian 2671493870 Use purely RR based RTT. (#1351)
* Use purely RR based RTT.

With normalization of NTP time stamp to local time,
don't need to keep track of NTP time of publisher + local time of
when a report is sent. RTT calculations can happen with RR only.

Also, do not log errors when RTT cannot be calculated due to
no last SR. This can happen if the receiver sends an RR before
it receives an SR. As SFU is doing SRs once in 5 seconds, it is
possible some RRs happen before the first SR.

* use error type

* correct error name
2023-01-30 19:32:06 +05:30
David Zhao a24eb62b83 Set IsPublisher to true for data-only publishers (#1348) 2023-01-29 23:10:26 -08:00
Paul Wells 52fd0a641b adjust jitter histogram buckets (#1347)
* adjust jitter histogram buckets

* typo
2023-01-29 22:45:32 -08:00
renovate[bot] cea314063f fix(deps): update module github.com/urfave/cli/v2 to v2.24.2 (#1346)
Generated by renovateBot

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-01-29 21:44:35 -08:00
David Zhao 9a1f4ab18b Allow /rtc/validate to return room not found message (#1344)
It's not always possible for WebSocket clients to obtain status code or
error messages returned during WS Upgrade. Moving autocreation validation
to an explicit interface in the validation step so the /rtc/validate
would be able to return an appropriate message.
2023-01-29 21:41:44 -08:00
David Zhao 21f816d23c Slight tweaks to subscription manager logging (#1345) 2023-01-29 11:45:47 -08:00
cnderrauber 3a4a294a92 Enable upstream nack for opus only audio track (#1343) 2023-01-28 16:02:38 +08:00
David Zhao 5e9221dbd8 Enable video at low res by default when adaptive stream is enabled. (#1341)
When AdaptiveStream is enabled, default the subscriber to LOW quality stream
we would want LOW instead of OFF for a couple of reasons
1. when a subscriber unsubscribes from a track, we would forget their previously defined settings
   depending on client implementation, subscription on/off is kept separately from adaptive stream
   So when there are no changes to desired resolution, but the user re-subscribes, we may leave stream at OFF
2. when interacting with dynacast *and* adaptive stream. If the publisher was not publishing at the
   time of subscription, we might not be able to trigger adaptive stream updates on the client side
   (since there aren't any video frames coming through). this will leave the stream "stuck" on off, without
   a trigger to re-enable it
2023-01-27 20:41:26 -08:00
David Zhao db40272657 Persist participant before firing webhook (#1340)
Fixes #1339
2023-01-27 19:29:38 -08:00
Paul Wells d83f9fe68b add lock tracker to participant (#1338)
* add lock tracker to participant

* update protocol dep
2023-01-27 13:44:22 -08:00