On Tue Jul 9 19:55:30 2024 +0000, Davide Beatrici wrote:
Since the operations are more or less the same as in `pulse_create_stream()`, could you create a helper function in a separate commit (that will be first in the list), please?
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
```c 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.