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

Fix nack buffer RTX issue #294

Merged
merged 1 commit into from
Dec 16, 2024
Merged

Fix nack buffer RTX issue #294

merged 1 commit into from
Dec 16, 2024

Conversation

kcaffrey
Copy link
Contributor

There was previously an issue with the nack buffer that would occur when an uploader was experiencing packet loss (or otherwise had reordering occur). lastAdded was getting set for every packet added to the buffer, but packets could get added out of order, causing lastAdded to go backwards. The impact was that packets at the end of the buffer were sometimes considered stale and cleared out. Consider the following sequence of packets being added to the buffer:

1, 2, 4, 3, 5, ...

When 4 is added, lastAdded would correctly be 4, but then when 3 arrived, lastAdded would go backwards to 3. This would cause two related problems: trying to get 4 from the buffer would fail (uint16(3 - 4) > Uint16SizeHalf), and then when we add 5, we would treat 4 as a gap between lastAdded (3) and seq (5) and thus release 4 from the buffer, such that even after 5 was added, we would still not be able to retrieve 4 from the buffer.

This PR modifies the logic to only move lastAdded forward if diff is "positive" (less than Uint16SizeHalf), meaning the new packet is newer than any packet received previously.

Copy link

codecov bot commented Dec 16, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 71.20%. Comparing base (9251977) to head (0c40de4).
Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #294      +/-   ##
==========================================
+ Coverage   71.14%   71.20%   +0.06%     
==========================================
  Files          80       80              
  Lines        4477     4477              
==========================================
+ Hits         3185     3188       +3     
+ Misses       1157     1155       -2     
+ Partials      135      134       -1     
Flag Coverage Δ
go 71.00% <100.00%> (-0.14%) ⬇️
wasm 69.35% <100.00%> (+0.13%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@boks1971 boks1971 left a comment

Choose a reason for hiding this comment

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

lgtm!

@kcaffrey kcaffrey merged commit 645dd64 into pion:master Dec 16, 2024
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants