Skip to content

Commit

Permalink
AESinkPULSE: Fixup blocked write to be more failsafe
Browse files Browse the repository at this point in the history
  • Loading branch information
fritsch committed Nov 9, 2019
1 parent 90d88b4 commit 60f2b8a
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion xbmc/cores/AudioEngine/Sinks/AESinkPULSE.cpp
Expand Up @@ -1092,8 +1092,18 @@ unsigned int CAESinkPULSE::AddPackets(uint8_t **data, unsigned int frames, unsig
unsigned int length = 0;
void *buffer = data[0]+offset*m_format.m_frameSize;
// care a bit for fragmentation
while ((length = pa_stream_writable_size(m_Stream)) < m_periodSize)
length = pa_stream_writable_size(m_Stream);
while (length < m_periodSize)
{
pa_threaded_mainloop_wait(m_MainLoop);
unsigned int old_length = length;
length = pa_stream_writable_size(m_Stream);
// if we don't get more space in the device
// between two callbacks, we leave the loop
// without space to write we stay in here
if ((length != 0) && (length == old_length))
break;
}

length = std::min(length, available);

Expand Down

0 comments on commit 60f2b8a

Please sign in to comment.