ursus
03/16/2025, 11:49 AMval channel = Channel<ByteArray>(capacity = 10 <---------, onBufferOverflow = DROP_OLDEST)
launch {
while (isActive) {
val bytes = queryMicrophone()
channel.send(bytes)
}
channel.close()
}
How can I tweak the capacity empiraclly what effectively is a ring buffer?
I.e. I need to analyze if the overflow behavior happened, which is undesirable in my case. (It can happen but should not for ideal UX => increase buffer size)
is there some sort of channel.isFull
I can check before `send`ing?Youssef Shoaib [MOD]
03/16/2025, 11:53 AMYoussef Shoaib [MOD]
03/16/2025, 11:57 AMonUndeliveredElement
parameter that should help with your testing. It's called on every dropped element I believe, so you can count how often that happens and adjust the size accordinglyursus
03/16/2025, 12:11 PMursus
03/16/2025, 12:18 PM