Make sure buffer is large enough to handle all the frames. Patch from Jindrich Makovicka, bug 2799116.

This commit is contained in:
Steve Checkoway
2009-09-13 14:18:26 +00:00
parent 6a222c173b
commit 48361720d4
@@ -54,8 +54,17 @@ bool RageSoundDriver_ALSA9_Software::GetData()
return false; return false;
static int16_t *buf = NULL; static int16_t *buf = NULL;
static int bufsize = 0;
if( buf && bufsize < frames_to_fill )
{
delete[] buf;
buf = NULL;
}
if( !buf ) if( !buf )
buf = new int16_t[g_iMaxWriteahead*samples_per_frame]; {
buf = new int16_t[frames_to_fill*samples_per_frame];
bufsize = frames_to_fill;
}
const int64_t play_pos = m_pPCM->GetPlayPos(); const int64_t play_pos = m_pPCM->GetPlayPos();
const int64_t cur_play_pos = m_pPCM->GetPosition(); const int64_t cur_play_pos = m_pPCM->GetPosition();