Does ringbuf.js support infinite input stream?
guest271314 opened this issue · comments
Contribute
Please do (just open an issue or send a PR).
I am currently beginning with 3 seconds storage in a WebAssembly.Memory
instance and calling grow()
when data arrives in a ReadableStream
the form of Uint8Array
from WebTransport.incomingUnidirectionalStreams.getReader()
(Uint8Array(512)
=> Uint16Array(Uint8Array.buffer)
=> Float32Array(128)
) for AudioWorklet
process()
.
Ideally I want to begin with the same 3 seconds of memory allocation https://github.com/guest271314/webtransport/blob/4de2842fed22b98cc8c7fd813b27219aa5f1b666/webTransportAudioWorkletWebAssemblyMemoryGrow.js#L8 (if necessary N seconds or N minutes of storage can be allocated) and overwrite the same 3 seconds when the last frame of initial 3 seconds is set at outputs
to implement an infinite stream without the current approach of writing to maximum
of WebAssembly.Memory
(SharedArrayBuffer
), for an infinite stream, a proof-of-concept radio station.
Does ringbuf.js provide the means for the above use case?
If yes, can an example be published in this repository?
It's a ring buffer, so yes. The existing example is essentially that, writing a sine wave continuously to the buffer from the main thread and reading from the worklet thread.