[client] audio: don't lock when consuming frames from the buffer

This commit is contained in:
Geoffrey McRae 2022-01-19 00:25:52 +11:00
parent d6bbc4f89c
commit 4b080f7610

View File

@ -133,8 +133,6 @@ void playbackStopNL(void)
static int playbackPullFrames(uint8_t ** data, int frames)
{
LG_LOCK(audio.playback.lock);
if (audio.playback.buffer)
*data = ringbuffer_consume(audio.playback.buffer, &frames);
else
@ -142,9 +140,11 @@ static int playbackPullFrames(uint8_t ** data, int frames)
if (audio.playback.state == STREAM_STATE_DRAIN &&
ringbuffer_getCount(audio.playback.buffer) == 0)
{
LG_LOCK(audio.playback.lock);
playbackStopNL();
LG_UNLOCK(audio.playback.lock);
LG_UNLOCK(audio.playback.lock);
}
return frames;
}