Commit Graph

1432 Commits

Author SHA1 Message Date
Benjamin Pracht
4244542840 Adopt WebRTCConfig from mediatransportutil (#1707)
This also adds support for inline fields in ToCLIFlagNames
2023-05-10 20:00:34 -07:00
Raja Subramanian
b61fad339f Handle time stamp increment across mute. (#1705)
* Handle time stamp increment across mute.

Two cases handled
1. Starting on mute could inject blank frame/padding packets.
These time stamps are randomly generated. So, when the publisher
unmutes, the time stamp was jumping ahead by only 1. Make it so
that they jump ahead by elapsed time since starting the blank frames/
padding packets.
2. When generating blank frames at the end of a down track, if
the track was muted at that time, the blank frame time stamps
could have been off (i. e. would have been pointing to time
after the last forwarded frame). Here also use current time
to adjust time stamp. Maybe, this could help in some cases where
we are seeing unflushed video buffer?

* remove unnecessary check

* address feedback and also maintain first synthesized time stamp
2023-05-10 18:31:49 +05:30
Raja Subramanian
4419cd56b8 Switch to rate since first time. (#1704)
With short term measurements, the adjustment itself was causing
some oscillations and drift tend to settle at some small value
and oscillated around it due to push/pull affecting small window
measurement.
2023-05-10 11:01:51 +05:30
Raja Subramanian
678cd06241 Infow -> Debugw (#1703) 2023-05-10 10:26:36 +05:30
David Colburn
2ccee369a6 update notifier (#1702) 2023-05-09 20:52:22 -07:00
David Colburn
0a3c22993e Remove deprecated egress client (#1701)
* remove deprecated egress client

* don't copy mutex
2023-05-09 16:54:32 -07:00
Raja Subramanian
f543e3f8d0 Send left over RTCP packets. (#1699) 2023-05-09 18:46:30 +05:30
Raja Subramanian
cf2a078579 Apply time stamp adjustment only at the start of a frame. (#1698)
It was possible that the adjustment applied in the middle
of a frame resulting in the same frame having multiple time stamps.
That would have caused video to pause/jump.

Apply the offset only at the start of the frame so that all
packets of a frame get the same offset.
2023-05-09 12:39:11 +05:30
Raja Subramanian
0e582ec82a fix the negative sign scope (#1696) 2023-05-09 00:13:01 +05:30
Raja Subramanian
153f02091c Use measurement in window instead of since start. (#1695)
This captues chnages within a measurement window.
2023-05-08 19:51:23 +05:30
Raja Subramanian
ddcb8342ef Fix Dervivative equation wrong brackets (#1693) 2023-05-07 18:36:26 +05:30
Raja Subramanian
14a2d06bcd RTCP sender reports every three seconds. (#1692)
* RTCP sender reports every three seconds.

Ideally, we should be sending this based on data rate.
But, increasing frequency a little as a lost sender report
means the client may not have sender report for 10 seconds
and that could affect sync. We do receiver reports once a second.
Thought of setting this to that level too, but not making a big change
from existing rate.

Also, simplifying the RTCP send loop. Don't need to hold and
do the processing after collecting all reports.

* consistent use of GetSubscribedTracks
2023-05-07 10:09:30 +05:30
Raja Subramanian
3fb93135f5 Experimental flag to try time stamp adjustment to control drift. (#1687)
* Experimental flag to try time stamp adjustment to control drift.

There is a config to enable this.

Using a PID controller to try and keep the sample rate at expected
value. Need to be seen if this works well. Adjustment are limited
to 25 ms max at a time to ensure there are no large jumps.
And it is applied when doing RTCP sender report which happens
once in 5 seconds currently for both audio and video tracks.

A nice introduction to PID controllers - https://alphaville.github.io/qub/pid-101/#/
Implementation borrowed from - https://github.com/pms67/PID

A few things TODO
1. PID controller tuning is a process. Have picked values from test from
   that implementation above. May not be the best. Need to try.
2. Can potentially run this more often. Rather than running it only when
   running RTCP sender report (which is once in 5 seconds now), can
   potentially run it every second and limit the amount of change to
   something like 10 ms max.

* remove unused variable

* debug log a bit more
2023-05-06 11:52:57 +05:30
David Zhao
0586009e0d Do not send hidden participants after resume (#1689) 2023-05-05 22:38:17 -07:00
Raja Subramanian
25d6fd751f Cleaning up smoothed OWD calculation for sender report. (#1684)
* Keep track of expected RTP time stamp and control drift.

- Use monotonic clock in RTCP Sender Report and packet times
- Keep the time stamp close to expected time stamp on layer/SSRC
  switches

* clean up

* fix test compile

* more test compile failures

* anticipatory clean up

* further clean up

* add received sender report logging
2023-05-05 13:14:12 +05:30
Raja Subramanian
28a8a808f2 Do not add empty video layers in stats. (#1685) 2023-05-05 08:59:08 +05:30
Raja Subramanian
15078eb9f4 Keep track of expected RTP time stamp and control drift. (#1681)
* Keep track of expected RTP time stamp and control drift.

- Use monotonic clock in RTCP Sender Report and packet times
- Keep the time stamp close to expected time stamp on layer/SSRC
  switches

* clean up

* fix test compile

* more test compile failures
2023-05-04 13:00:57 +05:30
cnderrauber
298ebaee78 Suppress error log of setPrefferedCodec for simulcast codec track (#1682) 2023-05-04 15:14:20 +08:00
David Zhao
5fcd682fb0 Refactor participant metadata updates to avoid duplication (#1679)
* Refactor participant metadata updates to avoid duplication

* generated fakes
2023-05-03 13:50:45 -07:00
Benjamin Pracht
11749eace9 Add support for creating WHIP ingress (#1674) 2023-05-02 13:26:47 -07:00
Raja Subramanian
00217c7af1 Logging delta of receiver report (#1676) 2023-05-02 22:43:37 +05:30
Paul Wells
87e2b2366e reduce log level of signal close errors (#1675)
* reduce log level of signal close errors

* update psrpc

* cleanup

* cleanup
2023-05-02 08:31:12 -07:00
Raja Subramanian
3070e976c3 Log received sender report of audio for debugging (#1673)
* Log received sender report of audio for debugging

* log OWD also

* add some more bits
2023-05-02 00:22:33 +05:30
Raja Subramanian
7dbd086c3e Calculating feed drift and log them for more clues. (#1671) 2023-05-01 11:55:27 +05:30
Raja Subramanian
08fd068511 logging feed side last report for clues (#1670) 2023-05-01 11:39:37 +05:30
Raja Subramanian
dfa3d77945 Misc changes (#1669) 2023-04-30 15:42:39 +05:30
Raja Subramanian
35b8319b08 Remove disallowed subscriptions on close. (#1668)
With subscription manager, there is no need to tell a publisher
about a subscriber going away. Before subscription manager,
the up track manager of a participant (i. e. the publisher side)
was holding a list of pending subscriptions for its published tracks
and that had to be cleaned up if one of the subscriber goes away.
That is not the case any more.

Also set publisherID early so that subscription permission update has
the right publisherID. In fact, saw an empty ID in the logs and saw
that we still have the disallowed subscription handling which is not
necessary any more.
2023-04-29 09:18:07 +05:30
Benjamin Pracht
a08cd23b6d Adopt pion logging initialization moving to protocol (#1667) 2023-04-28 10:51:41 -07:00
Raja Subramanian
1148d38978 hopefully more stable tests (#1665)
* hopefully more stable tests

* do eventual checks as some callbacks happen in go routines.

Needs a bit more work to ensure that some conditions do not happen.
But, with goroutines, the amount of wait is always tricky.``
2023-04-28 17:02:31 +05:30
Raja Subramanian
50ab72a5f8 DownTrack scoring when RR is not received. (#1664) 2023-04-28 14:50:06 +05:30
Raja Subramanian
3f3b02357c Check all transport connected for subscriber only properly. (#1661) 2023-04-27 23:06:15 +05:30
Paul Wells
fc09cacfce increase level for signal stream closed log messages (#1660)
* increase level for signal stream closed log messages

* ensure stream closes on signal close receipt

* cleanup
2023-04-27 08:30:40 -07:00
Raja Subramanian
c1c4e8aea0 Include packetsMissing field in string representation (#1659)
* Include packetsMissing field in string representation

* do not set stub directly
2023-04-27 14:39:05 +05:30
Paul Wells
f9f89cd7cf close signal with reliable message (#1658)
* close signal with reliable message

* update protocol
2023-04-26 22:59:39 -07:00
Paul Wells
11eedf4514 update participant to support signal broadcast skipping (#1657)
* update participant to support signal broadcast skipping

* cleanup

* lock

* feedback

* order

* update requireBroadcast in SetPermissions
2023-04-26 17:11:33 -07:00
Raja Subramanian
9db46bb866 Avoid divide-by-zero and NaN (#1656) 2023-04-26 21:29:25 +05:30
Raja Subramanian
8ed193b231 StreamAllocator - tracking more things (#1652)
* WIP commit

* Add a probe cluster mode

* better variable naming

* fix units

* WIP commit

* WIP commit

* WIP commit

* new file

* WIP commit

* Maintain history of a few things

* correct signal

* fix typo

* WIP commmit

* gofmt

* rate not sum

* adjust edges of rate monitor

* fmt

* remove debug
2023-04-25 07:31:22 +05:30
David Zhao
b4ea4de5c0 Skip room updates to participants unless they are active 2023-04-24 15:24:50 -07:00
Raja Subramanian
09c0b25787 Ensure that RR is not received for a while before running scorer on nil (#1653)
data.

Without the check, it was getting tripped by publisher not publishing
any data. Both conditions returned nil, but in one case, the receiver
report should have been received, but no movement in number of packets.
2023-04-24 23:39:30 +05:30
David Zhao
279b3604c3 Add back ServerRegion and ServerVersion (#1650)
clients are still dependent on them
2023-04-23 23:10:00 -07:00
David Zhao
3f64828a77 Send Room updates when participant counts change (#1647)
Reduces the number of unneeded generation with ProtoProxy
2023-04-22 21:08:59 -07:00
Paul Wells
745410bd69 only increment participant version after updates (#1646)
* only increment participant version after updates

* fix test util

* cleanup

* test uptrackmanager permission update version check
2023-04-22 17:48:10 -07:00
Paul Wells
a77eb2a07d add room node assignment check to signal relay (#1645) 2023-04-22 07:05:07 -07:00
David Colburn
ab6c994db4 update protocol/psrpc (#1643)
* update protocol/psrpc

* metadata references
2023-04-21 12:43:20 -07:00
Paul Wells
70041f004f create signalStats from out of order join (#1640) 2023-04-20 03:27:41 -07:00
cnderrauber
09af509edb Add subscription limits (#1629)
* Add subscription limits

* Add limit to ParticipantParams

* Don't change desired of subscription when reaching limits

* Add subscription limits config

* Revert comment

* solve comments
2023-04-20 14:15:30 +08:00
Paul Wells
422a28551e record signal read failure metrics (#1639) 2023-04-19 15:33:42 -07:00
Raja Subramanian
a11944f84d Restore VP8 munger state properly. (#1634)
* Restore VP8 munger state properly.

* clean up
2023-04-19 16:21:16 +05:30
Raja Subramanian
a9fe9f331c Run quality scorer when there are no streams. (#1633)
* Run quality scorer when there are no streams.

In the down stream direction, receiver report is used for scoring.
If there are no receiver reports, it should go to `dry` state and report
poor quality.

Update scorer on dry condition only when update score has not happened
for longer than some multiple of update interval. Cannot update on every
interval when there are no streams as receiver report might be just
missed. Waiting for longer to ensure that report is definitely not
received.

* update last stats time
2023-04-19 13:05:43 +05:30
cnderrauber
ab42aed360 Add flag to control candidate fallback when udp unstable (#1630)
* Add flag to control candidate fallback when udp unstable

* Don't close rtcpreader if downtrack will be resumed
2023-04-19 14:56:16 +08:00