summaryrefslogtreecommitdiff
path: root/apps/buffering.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/buffering.c')
-rw-r--r--apps/buffering.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/apps/buffering.c b/apps/buffering.c
index 1d1fca15ab..655e5cfdaf 100644
--- a/apps/buffering.c
+++ b/apps/buffering.c
@@ -975,7 +975,7 @@ int bufadvance(int handle_id, off_t offset)
975 * does not check the validity of the input handle. It does do range checks 975 * does not check the validity of the input handle. It does do range checks
976 * on size and returns a valid (and explicit) amount of data for reading */ 976 * on size and returns a valid (and explicit) amount of data for reading */
977static struct memory_handle *prep_bufdata(int handle_id, size_t *size, 977static struct memory_handle *prep_bufdata(int handle_id, size_t *size,
978 bool filechunk_limit) 978 bool guardbuf_limit)
979{ 979{
980 struct memory_handle *h = find_handle(handle_id); 980 struct memory_handle *h = find_handle(handle_id);
981 if (!h) 981 if (!h)
@@ -990,14 +990,12 @@ static struct memory_handle *prep_bufdata(int handle_id, size_t *size,
990 if (*size == 0 || *size > avail + h->filerem) 990 if (*size == 0 || *size > avail + h->filerem)
991 *size = avail + h->filerem; 991 *size = avail + h->filerem;
992 992
993 if (filechunk_limit && 993 if (guardbuf_limit && h->type == TYPE_PACKET_AUDIO && *size > GUARD_BUFSIZE)
994 h->type == TYPE_PACKET_AUDIO && *size > BUFFERING_DEFAULT_FILECHUNK)
995 { 994 {
996 logf("data request > filechunk"); 995 logf("data request > guardbuf");
997 /* If more than a filechunk is requested, provide no more than the 996 /* If more than the size of the guardbuf is requested and this is a
998 amount of data on buffer or one file chunk, but without increasing 997 * bufgetdata, limit to guard_bufsize over the end of the buffer */
999 "size", which would be bad. */ 998 *size = MIN(*size, buffer_len - h->ridx + GUARD_BUFSIZE);
1000 *size = MIN(*size, MAX(avail, BUFFERING_DEFAULT_FILECHUNK));
1001 } 999 }
1002 1000
1003 if (h->filerem > 0 && avail < *size) 1001 if (h->filerem > 0 && avail < *size)