Skip to content
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

Save old TCC feedback timestamps, in case of packet reordering. #218

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

JonathanLennox
Copy link
Member

bbaldino
bbaldino previously approved these changes Feb 12, 2020
Copy link
Member

@bbaldino bbaldino left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

// Start new feedback packet, cull old packets.
packetArrivalTimes.entries.removeIf {
entry -> entry.key < tccSeqNum &&
timestamp - entry.value >= BACK_WINDOW_MS
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a bit concerning because:

  1. The map will usually contain ~500ms worth of packets (~150-200 packets).
  2. removeIf is linear
  3. removeIf will execute once per sent TCC feedback

Are any of my premises wrong?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think they are. I'll try profiling it and see what I find.

Chrome does the same thing (it uses an explicit for loop with an iterator rather than a lambda but the semantic is the same) but of course it's only sending one source, so presumably less media, and also the computational cost compared to a browser is relatively much less than an SFU.

In theory if we used an explicit loop we could terminate the search by entry.key, but I'm pretty sure that in the normal cases this wouldn't be much of a win since tccSeqNum will be greater than any previous key anyway.

@JonathanLennox
Copy link
Member Author

Here's the performance of TccGeneratorNode.observe() before and after my patch:
Screen Shot 2020-02-18 at 4 50 01 PM
Screen Shot 2020-02-18 at 4 50 15 PM

So it is a noticable relative increase, but not that large an absolute increase as a percentage of the total bridge time.

Based on libwebrtc's equivalent code (as used in Chrome).
@JonathanLennox
Copy link
Member Author

Since most of this PR ended up in #222, I've rebased this one to have just the remaining part.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants