Commit Graph

766 Commits

Author SHA1 Message Date
Raja Subramanian
fe8c355a32 Support participant identity in permissions (#663)
* Support participant identity in permissions

It is harder for clients to update permissions by SID as remote
reconnecting means a new SID for that participant. Using participant
identity is a better option.

For now, participant SID is also supported. Internally, it will
get mapped to identity. Server code uses identity throughout after
doing any necessary conversion from SID -> Identity.

* Address comments
2022-05-02 12:35:20 +05:30
Raja Subramanian
d863b45dc1 Remove Head field from ExtPacket structure. (#662)
* Remove `Head` field from `ExtPacket` structure.

Although we do not intend to, but if packets get out-of-order
in the forwarding path (maybe reading in multiple goroutines
or using some worker pool to distribute packets), the `Head`
indicator could lead to wrong behaviour. It is possible that
at the receiver, the order is
- Seq Num N, Head = true
- N + 1, Head = true

If the forwarding path sees `N + 1` first, the Head flag
when it sees `N` packet is incorrect and will lead to incorrect
behaviour.

The alternative check is very simple. So, remove `Head` flag.

* Remove unused field
2022-05-02 10:16:17 +05:30
David Zhao
289d63ac53 Fix node ip parameter not being used (#661)
* Use node-ip if provided

* formatting
2022-04-29 15:26:37 -07:00
Raja Subramanian
ea61b588a2 Simplifying SN info cache in RTPStats module (#660)
* Simplifying SN info cache in RTPStats module

* Remove unnecessary field
2022-04-28 18:48:59 +05:30
Raja Subramanian
ca6ad7ec7a Use seq num offsets cache instead of missing seq num map. (#658)
* Use seq num offsets cache instead of missing seq num map.

Map operations can be costly. Use a fixed size array to store offsets.
4096 sequence numbers should be more than 16 seconds for 720p video
which should be plenty to look up offset of out-of-order packets.
Packets out-of-order more than that will probably be useless anyway.

* Move offset cache population to only when we are forwarding

* add some debug logs

* Remove debug
2022-04-28 15:16:42 +05:30
Raja Subramanian
a83bd5c2f6 Split out load balancer into a separate module (#657) 2022-04-26 15:46:30 +05:30
Raja Subramanian
2f902a3edc Remove callbacks queue from sfu/DownTrack (#655)
* Remove callbacks queue from sfu/DownTrack

- Connection stats callback was happening in connection stats go routine
- RTT update launches a goroutine on the receive side as it affects the
  subscriber. So, no need to queue it.
- Changed two things
  o Move close handler to goroutine. It is better that way as it touches
the subscriber as well
  o Move max layer handling into a goroutine also so that the callback
does minimal work.

With this all the send side callback queues are removed.

* small clean up
2022-04-25 13:28:24 +05:30
Raja Subramanian
f0f66a2d75 Remove ops queue from stream tracker. (#652)
It is not needed as the callback happens in a goroutine.
Also, had missed included bitrate availability change in the queue
which was inconsistent.
2022-04-25 12:51:29 +05:30
David Zhao
4e5863496c Set numCPUs correctly in non-linux environment (#653) 2022-04-24 23:25:33 -07:00
David Zhao
b9ee0b5800 Skip loading of participant before writing messages to them. (#654)
In some implementations of the Store interface, it's possible that the
media node has not yet persisted the participant when we are trying to
send it messages. In which case we should not error on loading of the
participant.
2022-04-24 23:09:06 -07:00
Raja Subramanian
4d7950ec2f Do not send down track callbacks to streamallocator via queue (#651) 2022-04-24 21:41:58 +05:30
Raja Subramanian
0a802077dd Remove callbacks queue from sfu/buffer. (#650) 2022-04-24 21:39:28 +05:30
David Zhao
26700ea135 Add back region when hydrating ParticipantInit. (#648)
It was left out in the previous PR #646
2022-04-24 09:07:33 -07:00
Raja Subramanian
d38566850a Do not post close callback in ops queue if not started. (#649)
* Do not post close callback in ops queue if not started.

Ops queue is started in `Bind()`. If `Close()` is called
when bind did not happen (because the underlying peer connection
closed before bind), the close callback does not run.

Check if ops queue is running before posting close callback
into the queue.

Not pretty, but covers this case. Need to think about it more.

* correct check
2022-04-24 11:40:22 +05:30
David Zhao
b7d22c4f34 Fix MessageChannel leaks (#646) 2022-04-22 10:53:20 -07:00
Raja Subramanian
2e182afb61 Reduce memory used by RTPStats. (#645)
Keep track of last 2048 sequence numbers instead of full range
to reduce memory usage.
2022-04-22 17:17:37 +05:30
David Zhao
57e2321a18 Expose Participant.IsPublisher to differentiate pubs from subs (#643) 2022-04-21 22:15:01 -07:00
cnderrauber
8bb46637bb enable accept aggressive nomination by default (#644) 2022-04-22 12:41:43 +08:00
cnderrauber
124d628c0a add config to accept aggressive nomination (#642) 2022-04-21 18:32:18 +08:00
Raja Subramanian
2b6a304b27 Increase size of RTCP channel just to be safe. (#641)
Also, using select to log warnings when queue is full.
2022-04-21 12:21:21 +05:30
cnderrauber
3f9d6c11bc add log info for client closed websocket (#640) 2022-04-21 12:44:43 +08:00
David Zhao
3c53b843c5 Fixes bps and pps average computation. (#639)
Exclude NACK count from being a trigger to refresh stats.
Since NACKs are updated instantaneously without having to wait for
Telemetry updates that occurs every 10s, having even a single NACK
could cause us to compute averages prematurely.
2022-04-20 19:17:02 -07:00
David Zhao
59112b9200 Increase default message channel from 200 -> 10k (#638) 2022-04-20 16:34:00 -07:00
Raja Subramanian
43d0573693 Moving smoothing into the audio level module. (#636) 2022-04-20 23:59:51 +05:30
Raja Subramanian
6a53891f9f Process header extensions in line (#635)
* WIP commit

* Pass audio config

* Fix test compile
2022-04-20 18:20:28 +05:30
Raja Subramanian
1fe485ef0c Use cache for packet level processing. (#632)
* Use cache for packet level processing.

Do not overload ops queue for packet level operations.

* byte -> uint8
2022-04-20 13:19:10 +05:30
David Zhao
1cfc483d8f Do not pass STUN servers when using ICE Lite (#634) 2022-04-20 00:29:57 -07:00
David Zhao
b821a0997d Use common logging init functions (#633)
* Use common logging init functions

* update protocol commit

* fix tests
2022-04-20 00:15:11 -07:00
David Zhao
431069af95 Rename StatsUpdateFrequency -> StatsUpdateInterval 2022-04-19 22:22:58 -07:00
Raja Subramanian
8535f3d5b9 Redis AdaptiveStream (#631)
* Redis AdaptiveStream

* Fix adaptive stream while tarnsferring from start session
2022-04-20 10:48:32 +05:30
David Zhao
282e2aed49 Increase frequency of status updates and longer availability threshold (#628)
* Increase frequency of status updates and longer avail. threshold.

* better fix.

* fix room close test failure due to slow peer connection Close

* Perform avg computation more frequently if data has changed
2022-04-19 22:18:00 -07:00
David Zhao
7a60278f64 Improve docker connectivity by using srflx candidates (#624)
When deployed via Docker and without using host networking, we'll be
assigned an IP behind NAT. By giving it STUN servers, it should be
connectable even without passing in `--node-ip` explicitly
2022-04-19 09:53:17 -07:00
Raja Subramanian
cf627d8bbe Send adaptive stream param in join (#626) 2022-04-19 16:45:35 +05:30
Raja Subramanian
e138ef3f55 Use error level to get some back trace (#625) 2022-04-19 13:06:47 +05:30
Raja Subramanian
75ec31f237 Support starting off with not forwarding video (#623) 2022-04-19 12:37:53 +05:30
Raja Subramanian
50bd08e551 ICE restart - dynacast settings were lost (#620)
* Prevent stats update if the deltas are empty

* increase force interval

* static check

* Change max delay to 30 seconds

* Restart the max subscribed quality timer on ICE restart.

Force an update after a restart to let clients apply dynacast settings.
Also, set the max expected layer to HIGH on restart so that stream
tracker starts up fast on a restart.

* fix test
2022-04-18 22:58:11 +05:30
Raja Subramanian
a19ca69f5f Prevent stats update if the deltas are empty (#619)
* Prevent stats update if the deltas are empty

* increase force interval

* static check

* Change max delay to 30 seconds
2022-04-18 22:51:34 +05:30
Raja Subramanian
2e9bccfeff Allow padding packets to stream tracker. (#618) 2022-04-18 10:20:52 +05:30
Raja Subramanian
ed2a0011d9 Lock to receiver report for senders (#616) 2022-04-17 08:43:50 +05:30
Raja Subramanian
a98d955284 Delta stats throughout (#615)
* Use delta stats throughout and avoid calculating deltas in telemetry

* Fix a few things after testing

* Remove debug

* Fix tests

* delete instead of setting to nil

* Point to the latest protocol
2022-04-16 21:11:32 +05:30
cnderrauber
7a3e446a65 run StartSession in a goroutine (#614) 2022-04-15 09:36:24 +08:00
Raja Subramanian
08c764c9bd Do not force an update on unmute. (#613)
Let the subs drive subscription quality update.
2022-04-14 15:35:17 +05:30
Brint E. Kriebel
f8ae219eab Add sort by option to node selector (#599)
* Add sort by option to node selector

Allow the final decision of a selected node to be based on different
sorting options rather than just random.

Add a `sysload`, `cpuload`, `rooms`, `clients`, `tracks`, and
`bytespersec` sorting options to select the appropriate room when
multiple are suitable for the chosen selector.

Add tests for sysload sort_by option

Closes: #598

* NodeSelector: rename "random" selector to "any"

Since the selector introduces limits but the final selection is now
based on the sort by value, the random selector name does not make
sense. Rename this selector to "any" to accurately reflect that it will
select any available no with no additional selection limits.

Allow the old setting "random" to point to the new selector name, but
print a deprecation warning message.
2022-04-14 01:25:36 -07:00
Raja Subramanian
587534d121 Count repeated NACK only on a hit (#611) 2022-04-13 18:01:59 +05:30
Raja Subramanian
ee7bb0a1ad Log both estimate and nack ratio when congestion detected (#608) 2022-04-10 12:09:11 +05:30
David Zhao
69d9cc19bc Switch back to reconnecting only on failure. (#604)
Sometimes peerconnection jumps to disconnected periodically even
when the underlying connection is ok. In these cases we are
triggering unnecessary connection restarts.

Given this, we'll leave the responsibility of early-detecting
disconnections to clients, where they have more control/knowledge
of networking conditions.
2022-04-07 23:11:11 -07:00
David Zhao
4475a028b6 Removed REMB references for publisher (#605) 2022-04-07 18:24:11 -07:00
cnderrauber
665e53aba8 rename log and comment (#601) 2022-04-07 17:28:33 +08:00
cnderrauber
f74144846b create new subscriber datatrack after migration (#600)
* use negotiated data channel in migration case

* create subscriber data track after migration

* fix participant state update

* add participant leave log

* update protocol
2022-04-07 15:43:24 +08:00
Raja Subramanian
93a2730128 Resync on mute to avoid sequence number jumps on unmute (#597) 2022-04-06 23:23:57 +05:30