fix up infinite loop at EOF

This commit is contained in:
Glenn Maynard
2006-11-30 21:04:51 +00:00
parent c0cb096899
commit ffac3acbca
@@ -194,7 +194,7 @@ bool RageSoundReader_SpeedChange::Step()
{ {
/* We're at EOF. Flush the remaining data, if any. */ /* We're at EOF. Flush the remaining data, if any. */
m_iUncorrelatedPos = m_Channels[0].m_iCorrelatedPos; m_iUncorrelatedPos = m_Channels[0].m_iCorrelatedPos;
return m_iUncorrelatedPos < m_iDataBufferAvailFrames; return true;
} }
/* Starting at our preferred position (m_iUncorrelatedPos), within GetToleranceFrames(), /* Starting at our preferred position (m_iUncorrelatedPos), within GetToleranceFrames(),
@@ -247,8 +247,9 @@ int RageSoundReader_SpeedChange::Read( char *buf, unsigned iLen )
if( iCursorAvail == 0 ) if( iCursorAvail == 0 )
{ {
if( !Step() ) Step();
return 0; if( !GetCursorAvail() )
return 0; // EOF
continue; continue;
} }