-
Notifications
You must be signed in to change notification settings - Fork 50
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
rx register rewrite #348
rx register rewrite #348
Conversation
davibe
commented
Sep 13, 2023
- separate nack and RR generation
- remove misorder delay
- remove probation period
- simplify handing nack to avoiding unnecessary operations
9ebbee8
to
1b61c7e
Compare
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.
Overall looks good.
- I don't like the name
ReceptionRegister
, because it's just some jitter calculation. - Let's not make a separate module. Rename
register/mod.rs
back toregister.rs
and mergeReceptionRegister
(and rename it) intoregister.rs
- You can have the nack in a separate. Call it something like
register_nack.rs
to tie them together by name.
1b61c7e
to
5b1d8fe
Compare
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.
Some assorted thoughts, mostly just nitpicks and potential performance improvements
src/streams/register_nack.rs
Outdated
return None; | ||
} | ||
|
||
let mut nacks = vec![]; |
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.
ReportList
is designed to have a fixed size so it seems wasteful to allocate here. Instead we can use ReportList::new
and then ReportList::push
.
Also the result of this method gets pushed onto a &mut VecDeque<Rtcp>
that is allocated a single time in Session
. We could entirely avoid allocating here if we changed the signature to
pub fn nack_report(&mut self, on_nack: F)
where
F: FnMut(nack: Nack)
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.
Since this is tightly coupled to the RTCP type, I don't mind making it produce the specific type directly.
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.
So
pub fn nack_report(&mut self, on_nack: F)
where
F: FnMut(rtcp: Rtcp)
?
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.
Either the way we collect feedback through the rest of handle_timeout
pub fn nack_report(&mut self, feedback: &mut VecDeque<Rtcp>) { … }
or
pub fn nack_report(&mut self) -> Option<Rtcp> { … }
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.
Aight, I guess the former is slightly more flexible since nack_report
could, in theory, produce two instances of Rtcp
. But I guess we might not want to cause that much NACKing anyway
assert_update(&mut reg, 10, true, true, 10..10); | ||
|
||
// packet before window start is ignored | ||
assert_update(&mut reg, 9, false, false, 10..10); |
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.
Does this means we could lose out on some packets if we get unlucky with re-ordering at the start of an RTP stream? e.g. if packets 11, 10, 9 arrive in quick succession in that order we'd ignore 10 and 9. At the start of a video stream these are also likely to be part of a keyframe so their loss is particularly problematic.
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.
Correct
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.
This was already the case, so it's not better or worse.
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.
Is it something we want to address long term?
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.
Could we detect and warn!
to see how much better it'd be?
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.
@k0nserv we would not ignore packets as you wrote. The comment there is from the perspective of nacking. We would not consider them for nacking.
So 11, 10, 9
is fine (no loss). An issue would be if we receive 11, 9
at the start because we would not nack 10
. However even if we received 11, 10
, we would not nack 9
because .. how far back should we go without knowing ?
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.
Ah right, this is just about nacking. Is it generally true that if the browser sends a group of packets that correspond to a frame with the sequence numbers n..=n+20
if n + 5
arrives first we will never NACK n
, n + 1
, n + 2
, n + 3
, n + 4
, so if any of those are lost they are lost forever?
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.
yes. also what i said before is not 100% accurate, because we also don't flush them out in RTP mode (based on the fact that the register does not return is_new: true
).
Needs more thought.
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.
I have made it so that the active window extends back if the packet is within capacity, or warn!
otherwise
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.
There are issues with this, I have ideas how to solve but I put it in a separate PR.
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.
If we are merging everything together again, I want the name register.rs
:)
src/streams/register_nack.rs
Outdated
return None; | ||
} | ||
|
||
let mut nacks = vec![]; |
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.
Since this is tightly coupled to the RTCP type, I don't mind making it produce the specific type directly.
8cac017
to
8a2e6d4
Compare
- separate nack and RR generation - remove misorder delay - remove probation period - simplify handing nack to avoiding unnecessary operations
8a2e6d4
to
c10efc5
Compare
c10efc5
to
35449b6
Compare
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.
LGTM! ✨