[client] audio: move the memory copy into the pull function

This commit is contained in:
Geoffrey McRae
2022-01-19 10:29:49 +11:00
parent 99536eaf9d
commit 15f76339c8
4 changed files with 18 additions and 11 deletions

View File

@@ -220,14 +220,13 @@ static void pulseaudio_free(void)
static void pulseaudio_write_cb(pa_stream * p, size_t nbytes, void * userdata)
{
uint8_t * dst, * src;
uint8_t * dst;
pa_stream_begin_write(p, (void **)&dst, &nbytes);
int frames = nbytes / pa.sinkStride;
frames = pa.sinkPullFn(&src, frames);
frames = pa.sinkPullFn(dst, frames);
memcpy(dst, src, frames * pa.sinkStride);
pa_stream_write(p, dst, frames * pa.sinkStride, NULL, 0, PA_SEEK_RELATIVE);
}