Commit Graph

1771 Commits

Author SHA1 Message Date
Paul Wells
a6ede46adc add bounds check to dependency descriptor loop (#2214) 2023-11-01 18:04:04 -07:00
Raja Subramanian
f38a5794a0 fallback to vp8 if no viable codec (#2211) 2023-11-02 00:03:47 +05:30
cnderrauber
9399fb2bfe Only select alternative codec for video (#2210)
* Only select alternative codec for video

* Filter out empty mime
2023-11-01 19:45:44 +08:00
Raja Subramanian
4fa60247c1 Reduce log level (#2209) 2023-11-01 16:30:49 +05:30
Raja Subramanian
45346d7c76 Clean up condition that is not happening (#2207) 2023-11-01 15:17:09 +05:30
Raja Subramanian
c93a88bd9b Log starts on metadata cache overflow. (#2206) 2023-11-01 10:55:07 +05:30
Paul Wells
de7532b5a1 split room and participant services (#2205)
* merge

* tidy

* deps
2023-10-31 21:28:21 -07:00
Raja Subramanian
33a629065d Fix pre-extended value on wrap back restart. (#2202)
When wrapping back on a restart, was not setting pre-extended
values properly. It was missing a cycle. That caused rare large
sequence number gap.
2023-10-31 01:10:47 +05:30
Raja Subramanian
dc9f16f350 Do not block on down track close with flush. (#2201)
* Do not block on down track close with flush.

When publisher removes all subscribers, publisher side should
not be blocked for long. With close with flush, it could happen
if there a lot of bunch of subscribers.

So, when is expected, run it in a goroutine like it is done in
subscription manager.

Not moving the entire `RemoveSubscriber` bit to subscription manager as
there are two bits which are not tracked now
- mime type
- willBeResumed
Those two would have to be tracked in track manager and notified to
subscription manager so that it can act for that mine and if the track
will be resumed or not. As that touch more parts and could get
complicated, doing the simpler thing of cloning behaviour from
subscription manager for now.

* clean up

* code readability
2023-10-30 12:31:00 +05:30
Raja Subramanian
7578f9cbf5 Mark packet relevant only when current layer is valid. (#2200)
* Mark packet relevant only when current layer is valid.

Else, it introduces a large sequence number gap.

* fix tests
2023-10-30 00:34:17 +05:30
Raja Subramanian
b5dd020ff7 Forgot to commit change from last PR discussion (#2198)
* Forgot to commit change from last PR discussion

* fix test case

---------

Co-authored-by: cnderrauber <zengjie9004@gmail.com>
2023-10-27 15:36:09 +05:30
Raja Subramanian
a64bd23b6d Do server PLI when sync is required. (#2197)
* Do server PLI when sync is required.

A few changes
- Run key frame requester goroutine always. Runs every 200 ms which is
  not bad.
- Post a key frame request when server knows it needs one, like after an
  allocation. This ensures that the initial request is not delayed.
- Periodic check will ensure PLI for cases like all frame chains of a
  dependency descriptor being broken.

* simplify
2023-10-27 15:16:39 +05:30
cnderrauber
3633dfe39e Disable h264 for android firefox (#2190)
* Disable H.264 for android firefox

* Fix syntax error for rule

* lower case

* Remove disabled codec from AddTrackRequest

* Consistent handling of enabled codecs

Mainly cleaning up where we are doing codec filtering.

There's also behavior change of how we handle codec compatibility. If a client doesn't support the client's desired codec, we'll pick a backup automatically
instead of rejecting the client's request.

Requires an update on multi-codec simulcast handling.

* fix alternative codec selection

---------

Co-authored-by: David Zhao <dz@livekit.io>
2023-10-27 14:47:36 +08:00
cnderrauber
1f0ba21854 Fix svc: Drop frame is earlier than current keyframe (#2196)
* Fix svc: Drop frame is earlier than current keyframe

* Log detail of dependencydescriptor
2023-10-27 13:57:03 +08:00
David Colburn
60c78affda clean up ioInfo (#2195) 2023-10-26 13:32:31 -07:00
Raja Subramanian
8b16db2270 Log PLI requests. (#2194)
A few things
- Log PLI requests from client.
- Pass in marker to RTP munger as SVC can insert marker.
- Adjusting first packet time should be aware of SVC as there is single
  stream in SVC
2023-10-26 21:07:36 +05:30
Raja Subramanian
ce8f64176a Log correct time difference (#2192) 2023-10-26 15:34:49 +05:30
cnderrauber
514e86eac4 Don't filter out ipv6 address for client don't support prflx over relay (#2193)
candidate
2023-10-26 17:05:22 +08:00
Raja Subramanian
490b9f4f4c No sync when starting from nothing (#2191)
When starting from scratch (like mute -> unmute), it is possible
that the check sync does not detect a broken chain. That results
in PLIs not being sent and the video frozen till a gratuitous key
frame arrives.

Unclear why there are not PLIs from client side. That is something else to
dig into.
2023-10-26 13:39:11 +05:30
Raja Subramanian
30a4581045 DD debug logs to check forwarding path. (#2189) 2023-10-26 10:39:59 +05:30
Paul Wells
a5abf61a56 update psrpc (#2188) 2023-10-25 20:20:49 -07:00
Raja Subramanian
047a4ac870 Apply repair to the newest cached report (#2186) 2023-10-26 03:43:52 +05:30
Raja Subramanian
d8e4933dd1 Reference time stamp for SVC. (#2185)
SVC has only one stream and when calculating reference time stamp,
irrespective of reference layer, reference time stamp will be the
same as the given time stamp as there is only one stream and no offset.

TODO: Need better all around SVC handling.
2023-10-25 23:27:43 +05:30
Raja Subramanian
fa01297d96 Slight sequencer tweaks. (#2184)
The buffer is not for padding packets. So, calculate
adjusted sequence numbers before comparing against size.

Also, it is possible that invalidated slot is accessed
due to not being able to exclude padding range. This was
causing time stamp reset to 0. Will remove the error log
after this goes out and the condition does not show up
for a few days.
2023-10-25 23:12:14 +05:30
cnderrauber
0296a5bd86 Remove un-preferred codecs for android firefox (#2183)
* Remove un-preferred codecs for android firefox

Android firefox don't comply with the codec order in answer sdp and
has problem to publish h.264, remove other codecs to fix this.

* false(false) is true
2023-10-25 16:59:37 +08:00
Paul Wells
48dba9d589 reduce closing signal stream log level (#2182) 2023-10-24 17:46:07 -07:00
David Colburn
b8ac836b9b Only launch room egress once (#2175)
* only launch room egress once

* regenerate fakes
2023-10-24 13:05:23 -07:00
Paul Wells
f80e87b216 skip psrpc service registration unless the config is enabled (#2181) 2023-10-24 11:41:52 -07:00
Raja Subramanian
66750e4ba8 Fix deadlock (#2180)
* Fix deadlock

My previous PR to wrap layer notifier post in bind lock was
problematic as `onBinding` callback happens within that lock
and that onBinding callback can call set max layer which will
post to channel. Use a separate mutex.

* RUnlock
2023-10-24 22:12:38 +05:30
Raja Subramanian
d6ad857506 Do not post to closed channels. (#2179)
* Do not post to closed channels.

Perils of atomics. Hard to imagine, but I guess it could happen.
The postMaxLayerNotifier checked for closed and down track was not
closed. But, between that check and posting to channel (which is
a very small window), the down track could have been closed and
the channel (maxLayerNotiferCh) is closed.

Protect that channel post + close with the bind lock.

* reduce the change

* Check for closed inside lock
2023-10-24 18:21:59 +05:30
Raja Subramanian
df9d6ee0f4 Update protocol. (#2177) 2023-10-24 12:59:25 +05:30
cnderrauber
1ee808ec7d Fix frame chain can't detect broken if currentLayer is not valid (#2176) 2023-10-24 14:09:40 +08:00
Raja Subramanian
f4a3618000 Log error on 0 time stamp. (#2174)
Need backtrace for source of it.
Also, do not reset start if 0, that is incorrect.
2023-10-23 23:00:03 +05:30
David Colburn
0f27dda281 move CreateEgress call (#2168) 2023-10-23 09:15:18 -07:00
Raja Subramanian
f622fc2490 Sample clock skew down by an order of magnitude (#2173) 2023-10-23 16:58:02 +05:30
cnderrauber
eca32792b8 Add configuration to limit MaxBufferedAmount for data channel (#2170)
* Add configuration to limit MaxBufferedAmount for data channel

* comment

* Fix generate flags

* fix test

* Don't disconnect slow subscriber
2023-10-23 15:03:58 +08:00
Paul Wells
0bc932e57e fix config typo (#2172)
* fix config typo

* tidy

* add sample config

* cleanup
2023-10-22 23:43:03 -07:00
Paul Wells
325e5ca753 add psrpc room service (#2171)
* add psrpc room service

* update deps

* disable by default

* feedback

* config

* test
2023-10-22 22:49:38 -07:00
Raja Subramanian
08997c96b0 Drop not relevant packet only if contiguous. (#2167)
The probing + munging has not been set up to drop packets that follow
a gap. Dropping such a packet leads to padding packet sequence numbers
overlapping with regular packets.

This change does two things though.
- The not relevant packet will still not be sent over the wire. That could
create holes in the sequence number leading to NACKs
- Would the hole cause decode issues? Unclear as making this condition is hard.
Simulating it is not showing issues, but that may not be producing the bad
sequence if any.

Will look at the ability to drop a packet after a gap later.
2023-10-22 00:08:41 +05:30
Raja Subramanian
3e9450c774 Log more details in warns. (#2166)
Logging more details in warns so that we do not have to enable Infow
for some logs later.
2023-10-21 11:02:34 +05:30
Raja Subramanian
b591c56aa3 Logging reduction. (#2165)
Move some to Debugw and add sampling for a few.
2023-10-21 10:26:30 +05:30
Raja Subramanian
39edfab2b5 Fix extended TS calculated during retransmit. (#2164)
May have caused the large time stamp jump in sender reports.
2023-10-21 02:25:03 +05:30
Raja Subramanian
4f8bbdbaab Keeping revert of debug logs ready (#2163) 2023-10-21 01:47:50 +05:30
Raja Subramanian
0407eb4833 Log audio packets in forwarding path. (#2162)
Seeing a time stamp jump that I am not able to explain.
Basically, it looks like the time stamp doubles at some
point. There is no code which doubles the timestamp.
Can understand an erroneous roll over/wrap around, but
doubling is very strange.

So, logging only audio packets. Will disable as soon
as I have some smaples from canary.
2023-10-21 01:37:30 +05:30
Raja Subramanian
5bf2e5fd4a Log clock deviations in sender report. (#2161)
Seeing some unexplained jumps in sender report time stamp
in canary. Wonder if the calculated clock rate is way off
during some interval. Logging clock deviations to understand
better.
2023-10-20 23:06:34 +05:30
Raja Subramanian
43a0ca57b5 Clear flags in packet metadata cache before setting them. (#2160)
Not sure if this could have resulted in bad FPS calculation,
but could have contributed to it.
2023-10-20 12:13:29 +05:30
Raja Subramanian
0d7477178e More fine grained filtering NACKs after a key frame. (#2159)
* More fine grained filtering NACKs after a key frame.

There are applications with periodic key frame.
So, a packet lost before a key frame will not be retransmitted.
But, decoder could wait (jitter buffer, play out time) and cause
a stutter.

Idea behind disabling NACKs after key frame was another knob to
throttle retransmission bit rate. But, with spaced out retransmissions
and max retransmissions per sequence number, there are throttles.
This would provide more throttling, but affects some applications.
So, disabling filtering NACKs after a key frame.

Introducing another flag to disallow layers. This would still be quite
useful, i. e. under congestion the stream allocator would move the
target lower. But, because of congestion, higher layer would have lost
a bunch of packets. Client would NACK those. Retransmitting those higher
layer packets would congest the channel more. The new flag (default
enabled) would disallow higher layers retransmission. This was happening
before this change also, just splitting out the flag for more control.

* split flag
2023-10-20 00:44:39 +05:30
Raja Subramanian
e461e9cd79 Log skew in clock rate. (#2158)
* Log skew in clock rate.

Remember seeing sender report time stamp moving backward
across mute with replaceTrack(null). Not able to reproduce
it in JS sample app, but have seen it elsewhere.

Logging to understand it better. Wondering if the sender report
should be reset on time stamp moving backward or if we should drop
backwards moving reports.

* set threshold at 20%
2023-10-19 13:58:50 +05:30
Raja Subramanian
f653efcf10 Do not update highest time on padding packet. (#2157)
* Error log of padding updating highest time to get backtrace.

* Do not update highest time on padding packet.

Padding packets use time stamp of last packet sent.
Padding packets could be sent when probing much after last packet
was sent. Updating highest time on that screws up sender report
calculations. We have ways of making sure sender reports do not
get too out-of-whack, but it logs during that repair.
That repair should be unnecessary unless the source is behaving weird
(things like publisher sending all packets at the same time, publisher
sample rate is incorrect, etc.)
2023-10-19 12:01:48 +05:30
David Colburn
b290c233ea fix CreateEgress not completing (#2156) 2023-10-18 23:18:53 -07:00