-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Set up RTP Receivers synchronously #2087
Conversation
2a290be
to
199675b
Compare
Codecov Report
@@ Coverage Diff @@
## master #2087 +/- ##
==========================================
+ Coverage 76.98% 76.99% +0.01%
==========================================
Files 85 85
Lines 8737 8778 +41
==========================================
+ Hits 6726 6759 +33
- Misses 1602 1609 +7
- Partials 409 410 +1
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
Fantastic fix, thank you @boks1971! Really appreciate you grabbing this. Receive is ORTC/would be a breaking change to modify the behavior. Do you think there is a way we can keep the old behavior/add setupReceive as a private? I am afk for a bit, can’t look deeper until tonight. |
Thank you @Sean-Der . I don't fully understand all the bits yet :-) There is also some Plan B test failing. I am still working on it. Will check on oRTC behaviour. |
@Sean-Der I do not know ORTC spec. So, what I tried to do here is probably not the right thing - 31f6bc2. I just created two private functions I was thinking of a further change too, i. e. handle tracks with SSRCs also just like the RID case, i. e. do a |
31f6bc2
to
4fec81a
Compare
@boks1971 That sounds like a great code improvement! Simulcast is bolted on (at best). I wasn't even aware Simulcast was a thing when we designed all of these internals. I would love to have it all re-written with that being something considered day one. The only thing I would suggest is making a list of all the edge cases/behaviors that we support. Most things are covered by tests and I can help with that. The end of |
peerconnection.go
Outdated
@@ -1288,17 +1359,67 @@ func (pc *PeerConnection) startRTPReceivers(incomingTracks []trackDetails, curre | |||
unhandledTracks = append(unhandledTracks, filteredTracks[i]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@boks1971 Is this a problem?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Forgot to clean this up. This is used if remoteIsPlanB
. I could not get PlanB
test to work properly by splitting the setup and start of receivers. I will try it again today and post exactly what the issue is.
The end of Maybe the duplication is ok. The thing that makes me uncomfortable is how many checks/conditionals we have, don't even like how it was before complexity wise. |
What do you think of The more I read the code I understand the flow a bit more, but the naming throws me off. |
@Sean-Der Will change name from Will also look at consolidating common code between |
8d6534e
to
cad043c
Compare
cad043c
to
f0a41f6
Compare
1641378
to
eb506ad
Compare
Do the set up of RTP receivers synchronously so that they are ready to receive media as soon as signalling to remote side is sent. Once signalling to remote side is sent, the remote can send media at any time and receiver has to be ready. Like the bug mentions, a negotiation quickly followed by a renegotiation left the RTP receivers of the tracks in the second offer not set up. If the tracks in the renegotiation happen to be simulcast tracks, they are missed as browsers send RID only in the first few packets. The problem can be reproduced by introducing a 1 second delay in Downstream direction in Network Link Conditioner and using a modified version of LiveKit JS SDK sample app to force a double negotiation spaced closely. With this change, onTrack fires, but the unhandled warning from RTCP for the highest layer still happens. But, the track fires almost immediately following that warning (less than 5 ms later). So, all the simulcast layers are available. Resolves #2054
eb506ad
to
0fcb9b7
Compare
References - #2054
Do the set up of RTP receivers synchronously so that they
are ready to receive media as soon as signalling to remote
side is sent. Once signalling to remote side is sent, the
remote can send media at any time and receiver has to be ready.
Like the bug mentions, a negotiation quickly followed by
a renegotiation left the RTP receivers of the tracks in the
second offer not set up. If the tracks in the renegotiation
happen to be simulcast tracks, they are missed as browsers
send RID only in the first few packets.
The problem can be reproduced by introducing a 1 second
delay in Downstream direction in Network Link Conditioner
and using a modified version of LiveKit JS SDK sample app to
force a double negotiation spaced closely.
With this change, onTrack fires, but the unhandled warning
from RTCP for the highest layer still happens. But, the
track fires almost immediately following that warning
(less than 5 ms later). So, all the simulcast layers
are available.
Description
Reference issue
Fixes #...