1
0
Fork 0
forked from len0rd/rockbox

Possible crash fixed while crossfade is enabled.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6891 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Miika Pekkarinen 2005-06-27 07:06:58 +00:00
parent ff74e7f18b
commit deeeb33db1

View file

@ -520,17 +520,16 @@ void pcm_flush_buffer(size_t length)
crossfade_pos -= PCMBUF_SIZE; crossfade_pos -= PCMBUF_SIZE;
} }
if (length > 0) { while (length > 0) {
memcpy(&audiobuffer[audiobuffer_pos], buf, length); copy_n = MIN(length, PCMBUF_SIZE - (unsigned)audiobuffer_pos);
memcpy(&audiobuffer[audiobuffer_pos], buf, copy_n);
audiobuffer_fillpos = length; audiobuffer_fillpos = length;
goto try_flush; buf += copy_n;
} length -= copy_n;
} else { if (length > 0)
/* if (length == 0) {
pcm_flush_fillpos(); pcm_flush_fillpos();
audiobuffer_pos = 0; }
return ; }
} */
audiobuffer_fillpos += length; audiobuffer_fillpos += length;
@ -550,7 +549,6 @@ void pcm_flush_buffer(size_t length)
goto try_flush; goto try_flush;
} }
pcm_flush_fillpos(); pcm_flush_fillpos();
}
} }
bool pcm_insert_buffer(char *buf, size_t length) bool pcm_insert_buffer(char *buf, size_t length)