Performance and memory allocations

I know this may be a lot to ask, but is it possible for you guys to make some performance and memory improvements in Photon Voice? Right now, it appears *everything* happens on the main thread and memory is allocated every time voice data is encoded/decoded.

First, I would ask that you *please* use some buffer pools rather than allocating memory since that can lead to some spikes every time someone speaks. I was going to add this myself, but I wasn't 100% sure if the sendFrame immediately uses the buffer (or copies it, or serializes it), or if it is queued to go out on another frame. If it is immediate, then I can acquire a buffer, send the frame and then release the buffer. If it goes out "later", then it gets more complicated.

Second, would it be possible to move the encode/decode calls from the Opus wrapper to a background thread? I know this introduces some added complexity, but since this is happening on the main thread, it can eat up ~9ms everytime voice data needs to encode. For most people, that may not seem like a big deal, but we're working on a VR app and need to maintain at least 90fps.

All of these little spikes and wasted ms add up and these improvements would help significantly. I can probably make these changes myself, but it will make future integrations more of a pain.

Thanks!
Mike

Comments

  • vadimvadim ✭✭✭
    Hi,

    Can you please point at the code which is subject to allocation optimizations? We did exactly such optimization in latest release (1.7) and are really curious what else could be done.
Sign In or Register to comment.