[client] audio: move the memory copy into the pull function
This commit is contained in:
1 parent
99536eaf9d
commit
15f76339c8
4 files changed
+18
-11
No files matched your search
+13
-2
@@ -131,10 +131,21 @@ void playbackStopNL(void)
|
||||
}
|
||||
}
|
||||
|
||||
static int playbackPullFrames(uint8_t ** data, int frames)
|
||||
static int playbackPullFrames(uint8_t * dst, int frames)
|
||||
{
|
||||
if (audio.playback.buffer)
|
||||
*data = ringbuffer_consume(audio.playback.buffer, &frames);
|
||||
{
|
||||
frames = min(frames, ringbuffer_getCount(audio.playback.buffer));
|
||||
for(int fetched = 0; fetched < frames; )
|
||||
{
|
||||
int copy = frames - fetched;
|
||||
uint8_t * src = ringbuffer_consume(audio.playback.buffer, ©);
|
||||
|
||||
memcpy(dst, src, copy * audio.playback.stride);
|
||||
dst += copy * audio.playback.stride;
|
||||
fetched += copy;
|
||||
}
|
||||
}
|
||||
else
|
||||
frames = 0;
|
||||
|
||||
|
||||
Reference in new issue
Block a user