Circular BufferedSink using Okio

416 Views Asked by At

I'm using an Okio Pipe to read and send audio bytes from Android device mic, and I'd like to have a kind of fixed size pre-buffer of audio, removing the first received bytes when the buffer is full and adding the new ones. Does anybody know if I can achieve this using Pipe's BufferedSink? I've tried like this:

Pipe pipe = new Pipe(8192);
BufferedSink sink = Okio.buffer(pipe.sink());

When I receive new data I write to sink:

 sink.write(data);

But when the sink internal buffer size is 8192, sink get blocked and I can't add more data to it.

0

There are 0 best solutions below