-
Notifications
You must be signed in to change notification settings - Fork 137
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
No convenient way of rebasing AudioData timestamp #505
Comments
If the copy is synchronous it would be even more convenient and useful. |
A nice way of doing this is to allow stealing the data from a buffer, and constructing a new buffer. Since audio buffers are more or less always in regular memory, this allows a zero copy path. This is discussed here: #287 |
Thanks for the link! Assuming there is an let old_data = ... let new_data_init = { timestamp: new_timestamp, numberOfChannels: old_data.channels, numberOfFrames: old_data.frames, sampleRate: old_data.sampleRate, format: old_data.format, } new_data_init.data = old_data.CloseAndTransfer(); let new_data = new AudioData(new_data_init); Which seems clunky from an ergonomics point of view. Is there precedent for an actual transfer constructor on the web? Such as let new_data = new AudioData( *[* old_data *]* , { timestamp: new_timestamp }); If we had
Users could still pass in Until #287 resolves, the constructor would make a copy internally before closing. Once #287 is resolved, it would transfer internally (assuming RefPtr::HasOneRef() etc). |
I had to do this by utilizing the |
audioData.timestamp
is immutable, by design. There is however no convenient way of creating a new AudioData object with a different timestamp. Currently, users have to copy out data (plane by plane) and pass in the samesampleRate
,numberofFrames
,numberOfChannels
parameters.This issue tracks a proposal to add a new AudioData constructor, which mirrors VideoFrame's "copy constructor".
The new constructor would copy all the data and metadata from the passed in
audioData
, and replace the original timestamp with the one passed in theAudioDataCopyInit
.The text was updated successfully, but these errors were encountered: