mirror of
https://github.com/Shpoike/Quakespasm.git
synced 2025-04-21 18:50:44 +00:00
bgmusic.c (BGM_UpdateStream): avoid a possible endless loop.
(just a paranoid safeguard, shouldn't happen in real life.) git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@1311 af15c1b1-3010-417e-b628-4374ebc0bcbd
This commit is contained in:
parent
0ff9c26db7
commit
623f8c6698
1 changed files with 10 additions and 0 deletions
|
@ -366,6 +366,7 @@ void BGM_Resume (void)
|
|||
|
||||
static void BGM_UpdateStream (void)
|
||||
{
|
||||
qboolean did_rewind = false;
|
||||
int res; /* Number of bytes read. */
|
||||
int bufferSamples;
|
||||
int fileSamples;
|
||||
|
@ -415,11 +416,19 @@ static void BGM_UpdateStream (void)
|
|||
bgmstream->info.width,
|
||||
bgmstream->info.channels,
|
||||
raw, bgmvolume.value);
|
||||
did_rewind = false;
|
||||
}
|
||||
else if (res == 0) /* EOF */
|
||||
{
|
||||
if (bgmloop)
|
||||
{
|
||||
if (did_rewind)
|
||||
{
|
||||
Con_Printf("Stream keeps returning EOF.\n");
|
||||
BGM_Stop();
|
||||
return;
|
||||
}
|
||||
|
||||
res = S_CodecRewindStream(bgmstream);
|
||||
if (res != 0)
|
||||
{
|
||||
|
@ -427,6 +436,7 @@ static void BGM_UpdateStream (void)
|
|||
BGM_Stop();
|
||||
return;
|
||||
}
|
||||
did_rewind = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue