forked from len0rd/rockbox
Change in function should be nearly zero, but change to proper naming and define use and allow a more liberal limit on bufgetdata to only ensure safety of wrapping, not the strict filechunk limit that I tried to impose earlier
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15535 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
da8f854d61
commit
1db4243379
1 changed files with 6 additions and 8 deletions
|
|
@ -975,7 +975,7 @@ int bufadvance(int handle_id, off_t offset)
|
||||||
* does not check the validity of the input handle. It does do range checks
|
* does not check the validity of the input handle. It does do range checks
|
||||||
* on size and returns a valid (and explicit) amount of data for reading */
|
* on size and returns a valid (and explicit) amount of data for reading */
|
||||||
static struct memory_handle *prep_bufdata(int handle_id, size_t *size,
|
static struct memory_handle *prep_bufdata(int handle_id, size_t *size,
|
||||||
bool filechunk_limit)
|
bool guardbuf_limit)
|
||||||
{
|
{
|
||||||
struct memory_handle *h = find_handle(handle_id);
|
struct memory_handle *h = find_handle(handle_id);
|
||||||
if (!h)
|
if (!h)
|
||||||
|
|
@ -990,14 +990,12 @@ static struct memory_handle *prep_bufdata(int handle_id, size_t *size,
|
||||||
if (*size == 0 || *size > avail + h->filerem)
|
if (*size == 0 || *size > avail + h->filerem)
|
||||||
*size = avail + h->filerem;
|
*size = avail + h->filerem;
|
||||||
|
|
||||||
if (filechunk_limit &&
|
if (guardbuf_limit && h->type == TYPE_PACKET_AUDIO && *size > GUARD_BUFSIZE)
|
||||||
h->type == TYPE_PACKET_AUDIO && *size > BUFFERING_DEFAULT_FILECHUNK)
|
|
||||||
{
|
{
|
||||||
logf("data request > filechunk");
|
logf("data request > guardbuf");
|
||||||
/* If more than a filechunk is requested, provide no more than the
|
/* If more than the size of the guardbuf is requested and this is a
|
||||||
amount of data on buffer or one file chunk, but without increasing
|
* bufgetdata, limit to guard_bufsize over the end of the buffer */
|
||||||
"size", which would be bad. */
|
*size = MIN(*size, buffer_len - h->ridx + GUARD_BUFSIZE);
|
||||||
*size = MIN(*size, MAX(avail, BUFFERING_DEFAULT_FILECHUNK));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (h->filerem > 0 && avail < *size)
|
if (h->filerem > 0 && avail < *size)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue