Skip to content

Commit 0fcd938

Browse files
committed
pulseaudio: Rework enough bytes written bytes or not enough bytes to read
Rework we have written enough bytes to output or we don't have enough bytes to read in pulseaudio
1 parent adbf810 commit 0fcd938

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

src/hostapi/pulseaudio/pa_linux_pulseaudio_cb.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -365,6 +365,18 @@ static int _PaPulseAudio_ProcessAudio(PaPulseAudio_Stream *stream,
365365
*/
366366
PA_PULSEAUDIO_IS_ERROR( stream, paStreamIsStopped )
367367

368+
/* If we have written enough bytes (If output if enabled)
369+
* or there is no enouhg bytes to be for input
370+
* break out from loop
371+
*/
372+
373+
if( (isInputCb &&
374+
PaUtil_GetRingBufferReadAvailable(&stream->inputRing) < pulseaudioInputBytes) ||
375+
pulseaudioOutputWritten >= length )
376+
{
377+
break;
378+
}
379+
368380
if( stream->outputStream )
369381
{
370382
PaPulseAudio_updateTimeInfo( stream->outputStream,

0 commit comments

Comments
 (0)