Fix a flaw in prep_bufdata() that would lead to all kinds of problems with codecs that used bufread (MPC is one).

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15501 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Nicolas Pennequin 2007-11-07 00:39:08 +00:00
parent d9a9801171
commit 71b40994e0

View File

@ -987,10 +987,11 @@ static size_t prep_bufdata(const struct memory_handle *h, size_t size)
if (h->type == TYPE_PACKET_AUDIO && size > BUFFERING_DEFAULT_FILECHUNK)
{
/* If more than a filechunk is requested, log it and provide no more
* than the amount of data on buffer or one file chunk */
logf("data request > filechunk");
size = MAX(avail,BUFFERING_DEFAULT_FILECHUNK);
/* If more than a filechunk is requested, provide no more than the
amount of data on buffer or one file chunk, but without increasing
"size", which would be bad. */
size = MIN(size, MAX(avail, BUFFERING_DEFAULT_FILECHUNK));
}
if (h->filerem > 0 && avail < size)