summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Pennequin <nicolas.pennequin@free.fr>2007-11-07 00:39:08 +0000
committerNicolas Pennequin <nicolas.pennequin@free.fr>2007-11-07 00:39:08 +0000
commit71b40994e0c58cb3cb97ac91a0f771dce182662f (patch)
tree2f5af8762d57c8032f75bc2842935d86d58705ba
parentd9a9801171d53d12fd5e6df96ae6496056096f7c (diff)
downloadrockbox-71b40994e0c58cb3cb97ac91a0f771dce182662f.tar.gz
rockbox-71b40994e0c58cb3cb97ac91a0f771dce182662f.zip
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
-rw-r--r--apps/buffering.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/apps/buffering.c b/apps/buffering.c
index ecca3872f8..8d44bbec27 100644
--- a/apps/buffering.c
+++ b/apps/buffering.c
@@ -987,10 +987,11 @@ static size_t prep_bufdata(const struct memory_handle *h, size_t size)
987 987
988 if (h->type == TYPE_PACKET_AUDIO && size > BUFFERING_DEFAULT_FILECHUNK) 988 if (h->type == TYPE_PACKET_AUDIO && size > BUFFERING_DEFAULT_FILECHUNK)
989 { 989 {
990 /* If more than a filechunk is requested, log it and provide no more
991 * than the amount of data on buffer or one file chunk */
992 logf("data request > filechunk"); 990 logf("data request > filechunk");
993 size = MAX(avail,BUFFERING_DEFAULT_FILECHUNK); 991 /* If more than a filechunk is requested, provide no more than the
992 amount of data on buffer or one file chunk, but without increasing
993 "size", which would be bad. */
994 size = MIN(size, MAX(avail, BUFFERING_DEFAULT_FILECHUNK));
994 } 995 }
995 996
996 if (h->filerem > 0 && avail < size) 997 if (h->filerem > 0 && avail < size)