Playback: Move internal track list onto buffer

Does away the statically-allocated track list which frees quite
a fair amount of in-RAM size.

There's no compile-time hard track limit.

Recommended TODO (but not right away): Have data small enough use
the handle structure as its buffer data area. Almost the entire
handle structure is unused for simple allocations without any
associated filesystem path.

Change-Id: I74a4561e5a837e049811ac421722ec00dadc0d50
This commit is contained in:
Michael Sevakis 2017-12-08 13:01:25 -05:00
parent e86ea6bdb9
commit c1a01beded
4 changed files with 534 additions and 380 deletions

View file

@ -43,6 +43,8 @@
/* #define LOGF_ENABLE */
#include "logf.h"
#define BUF_MAX_HANDLES 384
/* macros to enable logf for queues
logging on SYS_TIMEOUT can be disabled */
#ifdef SIMULATOR
@ -1120,6 +1122,10 @@ bool bufclose(int handle_id)
return true;
}
#endif
if (handle_id <= 0) {
return true;
}
LOGFQUEUE("buffering >| Q_CLOSE_HANDLE %d", handle_id);
return queue_send(&buffering_queue, Q_CLOSE_HANDLE, handle_id);
}

View file

@ -36,6 +36,7 @@ enum data_type {
TYPE_ATOMIC_AUDIO,
TYPE_CUESHEET,
TYPE_BITMAP,
TYPE_RAW_ATOMIC,
};
/* Error return values */
@ -74,8 +75,6 @@ bool buffering_reset(char *buf, size_t buflen);
* NOTE: Tail operations are only legal when the end of the file is buffered.
****************************************************************************/
#define BUF_MAX_HANDLES 256
int bufopen(const char *file, size_t offset, enum data_type type,
void *user_data);
int bufalloc(const void *src, size_t size, enum data_type type);

File diff suppressed because it is too large Load diff

View file

@ -97,6 +97,11 @@ int get_cpu_boost_counter(void);
#define MAX(a, b) (((a)>(b))?(a):(b))
#endif
#ifndef SGN
#define SGN(a) \
({ typeof (a) ___a = (a); (___a > 0) - (___a < 0); })
#endif
/* return number of elements in array a */
#define ARRAYLEN(a) (sizeof(a)/sizeof((a)[0]))