276 Commits

Author SHA1 Message Date
Raja Subramanian 2a0a63e4be Increment NACK miss only if error is not EOF (#1061) 2022-09-30 11:26:45 +05:30
Raja Subramanian c93df27329 Accumulate spatial layers also for SVC codecs (#1053)
* Accumulate spatial layers also for SVC codecs

* Remove TODO

* include temporal layer 0
2022-09-29 12:41:52 +05:30
Raja Subramanian d70843bc5a Some logging tweaks (#1048) 2022-09-28 23:54:40 +05:30
cnderrauber 48588d7c3d code clean & fix h264 test fail (#1028) 2022-09-21 16:59:18 +08:00
Guru Govindan fc9d76c7a7 we need to consider SPS presence as keyframe indicator for simple NALU (#1016) 2022-09-21 16:03:36 +08:00
Raja Subramanian a523b929a9 Adding UT to cover case found with padding only packets (#1024)
Confirmed that it fails before change to fix it and it is good now.
2022-09-21 09:40:26 +05:30
Raja Subramanian 1e20786521 Store pure padding packets also in SnOffsets cache. (#1020) 2022-09-20 19:39:36 +05:30
Raja Subramanian 26e6024137 Log NACK information in stream allocator. (#1018) 2022-09-19 14:33:16 +05:30
Raja Subramanian c03003becf Logging some connection quality stuff to get some data. (#1008)
* Logging some connection quality stuff to get some data.

Setting it at 4.5 as normalised scores are higher.

* log average score
2022-09-15 17:16:59 +05:30
cnderrauber f1915feb1a keep mid unchange after migration for subscribed track (#995) 2022-09-09 17:39:09 +08:00
Raja Subramanian 93da599059 Return previous max layer. (#993)
Relay up track holds this value too. This is to prevent duplication.
2022-09-08 11:04:26 +05:30
cnderrauber 441053b7fa add participant id when client reconnect (#988) 2022-09-07 15:56:56 +08:00
Raja Subramanian d76f7811e9 An attempt to use consistent layer mapping (#986)
* WIP commit

* Consistent layers.

* slight re-arrangement of code

* log mime

* fix tests

* map -> array
2022-09-07 09:57:31 +05:30
Raja Subramanian 68fcd377fa Add exempt layer when not found AND exempt. (#984) 2022-09-05 22:22:41 +05:30
Raja Subramanian d8ae453fb9 Handle exempted layers (#983)
* WIP commit

* WIP commit

* Add tests

* remove debug
2022-09-05 18:42:59 +05:30
Raja Subramanian c75f38bce6 Protect against looking up dimensions for invalid spatial layer (#977)
Also use loss based scoring when track dimensions are not available.
2022-09-03 00:59:47 +05:30
Raja Subramanian df189984f3 Add resyn on next packet to buffer.Bucket (#968) 2022-08-30 12:58:10 +05:30
Raja Subramanian 032c3a1603 Fix track info available for down tracks. (#967)
Should have here in the first place. Brain damage :-(
2022-08-30 09:35:05 +05:30
Raja Subramanian aaa3a5b46e Transport restructure (#944)
* WIP commit

* WIP commit

* fix copy pasta

* setting PC with previous answer has to happen synchronously

* static check

* WIP commit

* WIP commit

* fixing transport tests

* fix tests and clean up

* minor renaming

* FIx test race

* log event when channel is full
2022-08-24 14:31:45 +05:30
cnderrauber c20a91d2b2 enable red by default (#940)
* enable red by default

* fix test case
2022-08-22 17:40:12 +08:00
cnderrauber a118d21af0 add red codec for opus (#938)
* opus/red codec

* panic

* forward red track to nonred subscriber

* config

* clean code

* solve comments
2022-08-22 12:32:27 +08:00
Raja Subramanian 26ba69c506 Log only on change and also don't log layer for audio (#934) 2022-08-20 10:04:21 +05:30
Raja Subramanian c9d16ea98c Use sampling only for closed pipe errors (#928) 2022-08-17 13:58:03 +05:30
Raja Subramanian df78179bbb Sample RTP write error logs. (#927)
* Sample RTP write error logs.

When a client goes away without notice, the media connection
will be severed. Writes will fail till connection is closed.
Avoid log spam in those scenarios. Just log one in 100 failures.

* Change reminder so that first failures gets logged

* log failure count
2022-08-17 13:38:08 +05:30
Raja Subramanian d9fdcf8c2b Promoting a few logs to Info (#921)
* Promoting a few logs to Info

Also, adding a couple of more info logs which I will remove later
after some debugging.

* mime type

* Protect pause/max layer

* notify even if not bound
2022-08-16 13:03:14 +05:30
Raja Subramanian 4f19866578 TrackInfo may not be available in Bind. (#918) 2022-08-15 21:18:22 +05:30
Raja Subramanian 9d22225e92 A few misc changes (#915)
- Do not update jitter on padding only packet.
Padding only packet may not have proper timestamp.
If it does, it probably has the time stamp of the
last packet with payload. That will also affect
jitter calculation, i. e. wall clock time is moving,
but RTP time is the same.
- Do not send `onMaxLayer` changed on bind.
It was probably racing with update when max layer
is updated when adaptive stream is off. There is
no need to send that update as the default would
be OFF. It will be enabled when adaptive stream
subscription turns it on or when max layer is
set when down track bind happens and adaptive stream
is off.
2022-08-15 15:57:19 +05:30
Raja Subramanian b5c023f986 Connection quality changes (#913)
* WIP commit

* Connection quality changes

- Fix Firefox showing poor quality
  o The issue was that we were using max available layer and
    calculating quality. The rationale being that even if
    server sends dynacast messages, client may not implement
    dynacast and still stream all layers. But, with Firefox
    (maybe a Firefox bug), it sends some small amount of
    data on layer 2 even when that layer is disabled.
    Guessing it is probing (or actually we might be using
    some small value for high layers as Firefox cannot turn off
    layers). That higher layer gets used in quality calculation.
    As the bit rate on that layer is extremely low, it yields low
    score.

    Fixed by considering the max expected layer. That is of most
    interest. Yes, clients may ignore dynacast and stream all layers,
    but, max expected is the one of interest. So, look for
    quality in the max expected layer and not max available layer.
- Lots of clean up around connection quality stuff
  o Use a dynamic scaling thing to ensure that we do not get bitten
    by absolute values. Calculate best possible scenario score and
    map that to maximum MOS score. This will ensure that different
    codecs, different settings do not mess up the scoring. For example,
    a client might use 1 Mbps for 720p, but a different client could
    use 2 Mbps for 720p. As an SFU/infrastructure middlebox, we do
    not have control over quality at those rates. We can only ensure
    that streaming happens smoothly at those rates. So, in that
    example, for client 1, 1 Mbps will map to MOS 5.0 and for client 2,
    2 Mbps will map to MOS 5.0. Any impairments after that will
    reflect in the score.
  o Penalise for missing target layer by one level for one layer missed.
  o Move tests to connection quality directory. The participant test
    was not super useful.

* Add missed file

* Remove debug code

* use more constants and initialise normalisation factor

* rtcscore pointer
2022-08-15 13:21:07 +05:30
Raja Subramanian dbcc53f04e Use media payload size in scoring. (#912)
* Use media payload size in scoring.

Subtract out header bytes when calculating score.
This does not seem to affect the score (under perfect conditions),
but, using header bytes will inflate the bit rate and
will affect scoring.

* Add header bytes to ToProto

* protocol pointer

* fix test
2022-08-14 13:22:58 +05:30
David Zhao f09885825e Return ServerInfo to clients on join (#904)
* checkpoint

* Return ServerInfo in join response

* also include node information

* less verbose quality score

* update go modules
2022-08-10 17:04:17 -07:00
Raja Subramanian 4d7df612ec Refactor DynacastQuality & MediaLossProxy into separate modules (#894)
* WIP commit

* Refactor media loss proxy

* Use DynacastQuality and MediaLossProxy from MediaTrack

* fix test

* Remove unused param

* Remove unused interfaces

* Move interface methods to local

* Split out DynacastManager

* have to add codec to dynacast manager

* RUnlock

* fix restart

* Adding API to force quality and also maintain closed state

* Address PR comments
2022-08-09 11:47:06 +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 0f074aeb98 Remove period from log (#863) 2022-08-03 00:41:34 +05:30
cnderrauber 997461a2b6 rtpstats add update last packet method (#858) 2022-07-29 15:29:36 +08:00
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
cnderrauber aee97c68bc retransmit dd extension (#837) 2022-07-18 13:06:33 +08:00
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
cnderrauber fcdff4f97a enable nack for audio track (#829) 2022-07-13 16:05:57 +08:00
cnderrauber cf88bdebc2 remove close check in downtrack.bind (#819)
* remove close check in downtrack.bind

* return nil but do nothing
2022-07-08 10:59:09 +08:00
Raja Subramanian 8315a547a8 Set layer state to stopped on pause. (#818)
* Set layer state to `stopped` on pause.

Previously, on pause, the worker was let run and declare
layer gone 1/2 a second (or whatever the stream tracker window
is set for) later.

But, when rapidly changing mute/unmute, the following cuold happen
and layer changes may be missed
- Available layers - 0, 1, 2
- Mute
- Before layer gone detected, unumute. Because of this layer gone
  is not reported and available layers stay at 0, 1, 2.
- Stream tracker is reset on unmute to enable quick detection of layer
  start.
- If all layers start back up, no issues.
- But, if the layers do not start back up, there is no layer start
  firing and the available layers are still 0, 1, 2 which is incorrect.

* exempt handling when paused
2022-07-07 22:52:45 +05:30
Raja Subramanian c15eeeff2b Run connection quality worker every 5 seconds. (#795)
With a small window, the quality is volatile even on small disturbances.
For example losing 2 audio packets in a 2 second window could
drop the quality metric.
2022-06-30 09:10:18 +05:30
Raja Subramanian 2c48eafd6e Retain previous audio score if number of packets is low (#793)
* Retain previous audio score if number of packets is low

* better comment and correct spelling
2022-06-29 14:48:06 +05:30
David Zhao b316698409 Release with GoReleaser. Allow start without key configuration (#788) 2022-06-26 12:27:43 -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
Raja Subramanian 20512151c6 Prevent subscribe renegotiation if tracks will be resumed. (#781) 2022-06-24 00:06:37 +05:30
Raja Subramanian 87c8ec25b9 Check that max layers are valid before allowing overshoot. (#775) 2022-06-21 23:14:06 +05:30
Raja Subramanian 45ed8ce85a Look for stable mex expected layer before calculating score. (#774) 2022-06-21 17:24:34 +05:30
Raja Subramanian ac1e55fa27 Use current layer for actual dimension when calculating quality of muxed (#773)
tracks.
2022-06-21 11:31:51 +05:30