On Wed Jul 10 14:34:41 2024 +0000, Arek Hiler wrote:
I've been looking into this when originally implementing the function. I had another look now. The only shared parts that I think we could extract are
new_bufsize_frames = ceil((stream->duration / 10000000.) * new_ss.rate); size = new_bufsize_frames * 2 * pa_frame_size(&stream->ss); if (NtAllocateVirtualMemory(GetCurrentProcess(), (void **)&new_buffer, zero_bits, &size, MEM_COMMIT, PAGE_READWRITE)) hr = E_OUTOFMEMORY;
but I couldn't make it not overly awkward, mostly because of when the variables have to be set and the failure paths / cleanup. I can do two helpers, one for `bufsize_frames` and `size` each unless you have a more detailed suggestion.
@huw What do you think?