Skip to content

Commit

Permalink
fixed: the memcpy in PAPlayer::AddPacketsToStream definitely has to b…
Browse files Browse the repository at this point in the history
…e a memmove

fixed: PAPlayer would busy wait on the audio device when no data could be added
  • Loading branch information
bobo1on1 committed Feb 2, 2011
1 parent fbd3ec3 commit 584ef84
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion xbmc/cores/paplayer/PAPlayer.cpp
Expand Up @@ -999,8 +999,14 @@ bool PAPlayer::AddPacketsToStream(int stream, CAudioDecoder &dec)
while (m_bufferPos[stream] >= (int)m_pAudioDecoder[stream]->GetChunkLen())
{
int rtn = m_pAudioDecoder[stream]->AddPackets(m_pcmBuffer[stream], m_bufferPos[stream]);
if (rtn == 0) //no pcm data added
{
Sleep(1);
continue;
}

m_bufferPos[stream] -= rtn;
memcpy(m_pcmBuffer[stream], m_pcmBuffer[stream] + rtn, m_bufferPos[stream]);
memmove(m_pcmBuffer[stream], m_pcmBuffer[stream] + rtn, m_bufferPos[stream]);
}

// something done
Expand Down

0 comments on commit 584ef84

Please sign in to comment.