Commit Graph

291 Commits

Author SHA1 Message Date
Raja Subramanian
170d4b8629 Seed snapshots (#1128)
* Seed snapshots

- For one cycle after seeding, delta snap shot can get a huge gap
because of snapshot iitializing from start if not present. Not
a huge deal sa it should not affect functionality, but saving/restoring
(at least with down track) snap shot is a big deal. So just do it.
- Have been seeing a bunch of cases of delta stats getting a lot of
packets due to out-of-order (what seems like) receiver report. So,
save the receiver report and log it when out-of-order is detected
to understand if they are closely spaced or something else could be
happening.

* Remove comment that does not apply anymore

* log current time and RR
2022-10-28 08:53:21 +05:30
cnderrauber
4783db34ef Remove DD extension when AV1 not preferred (#1129) 2022-10-27 15:51:50 +08:00
cnderrauber
7a7fc09372 Add fps calculator for VP8 and DependencyDescriptor (#1110)
* Add fps calculator for VP8 and DependencyDescriptor

* clean code

* unit test

* clean code

* solve comment
2022-10-26 09:28:28 +08:00
Raja Subramanian
222ce5d1a8 Notify max layer taking into account overshoot. (#1117)
* Notify max layer taking into account overshoot.

An attempt to handle case of FF stopping layer 0, but not layer 1.
When max subscribed layer is layer 0, server allows overshoot to layer 1
to ensure continued streaming when the channel is not congested.

But, dynacast could have reported maximum subscribed layer as layer 0.

This is a very simple attempt to address that by taking overshoot
into account. Needs testing if this works well or not.

NOTE: When subsriber/down track is unmuted, it will report
the max subscribed layer as the max required layer. In those cases,
if the client does not start layer 0, there will still be an issue.
IOW, server is not keeping track of client behaviour that the client
has stopped layer 0 and publishing only layer 1. Server is just
accommodating overshoot with this change.

* Fix a couple of tests and change reflect.DeepEqual -> require.Equal as
much as possible
2022-10-23 22:46:01 +05:30
Raja Subramanian
794c74360b Do not log duplicate packet error. (#1116)
Also, use bucket.Err* as it has been moved to mediatransportutil
2022-10-23 09:39:50 +05:30
Raja Subramanian
b9894ab014 Allocate packetMeta up front to reduce number of allocations. (#1108) 2022-10-20 14:31:19 +05:30
Raja Subramanian
4344af6fd3 Some misc changes (#1107)
- ticker.Stop always
- clean up timer func (if they are added) on participant close
- sequencer test enhancement to add a real packet after a pdding packet
2022-10-20 11:11:45 +05:30
Raja Subramanian
e43c72c91d Accept same highest sequence number as a puased track sends that (#1102) 2022-10-19 12:43:22 +05:30
Raja Subramanian
f854201101 Warn on out-of-order RTCP RR. (#1101)
Have been seeing a few instances of "too many packets expected in delta"
when trying to generate RTCP SR on down track. Actual sequence numbers
indicate that start is after the end.

As down track RTPStats are driven by receiver report, wondering if we
are getting RTCP_RR out-of-order somehow causing this to happen.
Cannot find any other reason for this.

So, accepting RTCP_RR based update only if the sequence number is higher
than existing and also logging a warning with sequence numbers if they
look out-of-order.
2022-10-19 11:21:43 +05:30
Raja Subramanian
08047eea60 Use pointers for packetMeta in sequencer to save memory. (#1100)
Padding packets do not need the full structure. They just
need a placeholder in the sequencer array. So, use pointers
(with padding slots filled by nil) to save some memory.

Also, don't need padding for audio (yet). As padding packets
are used only for probing and we do not probe using audio tracks (yet).
2022-10-19 09:37:32 +05:30
David Zhao
4161768530 Log Service API requests (#1091) 2022-10-17 00:16:54 -07:00
Raja Subramanian
573850261a Cache RTPStats and seed on re-use (#1080)
* Cache RTPStats and seed on re-use

When a cached down track is re-used, RTPStats was not cached.
This caused sender reports getting out-of-sync with the remote side.
Cache RTPStats and seed it on re-use.

* staticcheck
2022-10-12 09:10:17 +05:30
David Zhao
1019faa0e6 Cleanup pass through logging (#1073)
* added filtering for noisy pion logs
* demoted some logs to debug
* using consistent trackID / participant / publisher / subscriber terminology
* removed ice candidate log lines, deferring to combined log
2022-10-06 23:48:37 -07:00
Raja Subramanian
792349cc56 Split out mediatransportutil (#1071) 2022-10-06 23:55:59 +05:30
David Zhao
02537a121d Store initial track MimeType in TrackInfo (#1065) 2022-09-30 23:33:22 -07:00
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