-
Notifications
You must be signed in to change notification settings - Fork 19
Prepare public API for variable render quantum size #242
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
Prepare public API for variable render quantum size #242
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
5fa5bc8
to
20e6a6f
Compare
This comment was marked as outdated.
This comment was marked as outdated.
@@ -75,9 +75,12 @@ impl AllocInner { | |||
|
|||
/// Render thread channel buffer |
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.
AudioRenderQuantumChannel
now has no public methods, except the Deref(Mut) to [f32]
|
@@ -135,10 +138,10 @@ impl AudioRenderQuantumChannel { | |||
use std::ops::{Deref, DerefMut}; | |||
|
|||
impl Deref for AudioRenderQuantumChannel { |
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 here is the motivation of the PR. We stop hardcoding the length of the render quantum to 128, but leave it unspecified (we return a slice, instead of an array).
This incurs a small performance hit (a percent, looking at the benchmarks) because more bound checks need to be performed at runtime.
However, this opens the way for the "dynamic render quantum size" feature without breaking the current API. With this PR merged, the RENDER_QUANTUM_SIZE
(or, the value 128) is no longer present in the API surface
In preparation of 'variable render quantum size', it is important to never explicitly expose the buffer size in the public API. This has a small performance hit though because the new deref signature forces more bound checks at runtime. It is in the order of a few percent for some benchmarks.
In the future `RENDER_QUANTUM_SIZE` will not be a constant, but a property of the BaseAudioContext instead that is based on the `render_size_hint`
f7b914c
to
a5bcf86
Compare
|
Ok I think I see the idea, looks good to me! |
I think we have settled on most of the public API surface. However in preparation of #217 I think one more modification must be made: remove the constant
RENDER_QUANTUM_SIZE
.Relatest to #76 and #140
Might have performance impact. I will add more benchmarks