Skip to content

Skip allocations when reusing VP9 packets#364

Merged
kcaffrey merged 1 commit into
pion:mainfrom
kcaffrey:master
Jul 2, 2026
Merged

Skip allocations when reusing VP9 packets#364
kcaffrey merged 1 commit into
pion:mainfrom
kcaffrey:master

Conversation

@kcaffrey

@kcaffrey kcaffrey commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

If a caller reuses codecs.VP9Packet (after resetting the state appropriately), then reuse already allocated slices if they are of sufficient length instead of unconditionally allocating. Add tests to verify that reuse is safe and is zero allocations.

@kcaffrey kcaffrey requested review from JoTurk and Sean-Der July 2, 2026 17:59
@codecov

codecov Bot commented Jul 2, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 82.68%. Comparing base (77ebb16) to head (2a16a81).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #364      +/-   ##
==========================================
+ Coverage   82.64%   82.68%   +0.04%     
==========================================
  Files          28       28              
  Lines        3440     3448       +8     
==========================================
+ Hits         2843     2851       +8     
  Misses        427      427              
  Partials      170      170              
Flag Coverage Δ
go 82.68% <100.00%> (+0.04%) ⬆️

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

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@kcaffrey kcaffrey force-pushed the master branch 2 times, most recently from 51264ee to 9c9dfe1 Compare July 2, 2026 18:08

@JoTurk JoTurk left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Change looks good, thank you.
just two nits.

Comment thread codecs/vp9_packet.go Outdated
Comment thread codecs/vp9_packet.go Outdated
If a caller reuses `codecs.VP9Packet` (after resetting the state
appropriately), then reuse already allocated slices if they are of
sufficient length instead of unconditionally allocating. Add tests to
verify that reuse is safe and is zero allocations.

@JoTurk JoTurk left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

thank you.

@kcaffrey kcaffrey merged commit ac0f586 into pion:main Jul 2, 2026
18 checks passed
@kcaffrey

kcaffrey commented Jul 2, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for the review @JoTurk. Any chance you can create a new release with this? I saw the workflow for releasing but I don't have access to run it.

@JoTurk

JoTurk commented Jul 2, 2026

Copy link
Copy Markdown
Member

@kcaffrey you do have access. Just tag v1.10.3 off main and push it and it will create the release :)

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.

2 participants