mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-13 18:17:39 -04:00
Remove conf_filechunk, it should never have been a setting and its implementation doesn't do what it claims any way
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15478 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
03dd35db0e
commit
3379440a4b
19 changed files with 13 additions and 70 deletions
|
@ -133,8 +133,6 @@ static volatile size_t buf_ridx; /* current reading position */
|
|||
|
||||
/* Configuration */
|
||||
static size_t conf_watermark = 0; /* Level to trigger filebuf fill */
|
||||
static size_t conf_filechunk = 0; /* Bytes-per-read for buffering (impacts
|
||||
responsiveness of buffering thread) */
|
||||
#if MEM > 8
|
||||
static size_t high_watermark = 0; /* High watermark for rebuffer */
|
||||
#endif
|
||||
|
@ -167,7 +165,8 @@ static struct {
|
|||
|
||||
/* Messages available to communicate with the buffering thread */
|
||||
enum {
|
||||
Q_BUFFER_HANDLE = 1, /* Request buffering of a handle */
|
||||
Q_BUFFER_HANDLE = 1, /* Request buffering of a handle, this should not be
|
||||
used in a low buffer situation. */
|
||||
Q_RESET_HANDLE, /* (internal) Request resetting of a handle to its
|
||||
offset (the offset has to be set beforehand) */
|
||||
Q_CLOSE_HANDLE, /* Request closing a handle */
|
||||
|
@ -552,7 +551,7 @@ static bool buffer_handle(int handle_id)
|
|||
while (h->filerem > 0)
|
||||
{
|
||||
/* max amount to copy */
|
||||
size_t copy_n = MIN( MIN(h->filerem, conf_filechunk),
|
||||
size_t copy_n = MIN( MIN(h->filerem, BUFFERING_DEFAULT_FILECHUNK),
|
||||
buffer_len - h->widx);
|
||||
|
||||
/* stop copying if it would overwrite the reading position */
|
||||
|
@ -1101,23 +1100,10 @@ size_t buf_used(void)
|
|||
return BUF_USED;
|
||||
}
|
||||
|
||||
void buf_set_conf(int setting, size_t value)
|
||||
void buf_set_watermark(size_t bytes)
|
||||
{
|
||||
int msg;
|
||||
switch (setting)
|
||||
{
|
||||
case BUFFERING_SET_WATERMARK:
|
||||
msg = Q_SET_WATERMARK;
|
||||
break;
|
||||
|
||||
case BUFFERING_SET_CHUNKSIZE:
|
||||
msg = Q_SET_CHUNKSIZE;
|
||||
break;
|
||||
|
||||
default:
|
||||
return;
|
||||
}
|
||||
queue_post(&buffering_queue, msg, value);
|
||||
LOGFQUEUE("buffering > Q_SET_WATERMARK %ld", bytes);
|
||||
queue_post(&buffering_queue, Q_SET_WATERMARK, bytes);
|
||||
}
|
||||
|
||||
bool register_buffer_low_callback(buffer_low_callback func)
|
||||
|
@ -1228,22 +1214,11 @@ void buffering_thread(void)
|
|||
case Q_SET_WATERMARK:
|
||||
LOGFQUEUE("buffering < Q_SET_WATERMARK");
|
||||
conf_watermark = (size_t)ev.data;
|
||||
if (conf_watermark < conf_filechunk)
|
||||
if (conf_watermark < BUFFERING_DEFAULT_FILECHUNK)
|
||||
{
|
||||
logf("wmark<chunk %ld<%ld", conf_watermark, conf_filechunk);
|
||||
conf_watermark = conf_filechunk;
|
||||
}
|
||||
break;
|
||||
|
||||
case Q_SET_CHUNKSIZE:
|
||||
LOGFQUEUE("buffering < Q_SET_CHUNKSIZE");
|
||||
conf_filechunk = (size_t)ev.data;
|
||||
if (conf_filechunk == 0)
|
||||
conf_filechunk = BUFFERING_DEFAULT_FILECHUNK;
|
||||
if (conf_filechunk > conf_watermark)
|
||||
{
|
||||
logf("chunk>wmark %ld>%ld", conf_filechunk, conf_watermark);
|
||||
conf_watermark = conf_filechunk;
|
||||
logf("wmark<chunk %ld<%d",
|
||||
conf_watermark, BUFFERING_DEFAULT_FILECHUNK);
|
||||
conf_watermark = BUFFERING_DEFAULT_FILECHUNK;
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -1308,7 +1283,6 @@ void buffering_thread(void)
|
|||
void buffering_init(void) {
|
||||
mutex_init(&llist_mutex);
|
||||
|
||||
conf_filechunk = BUFFERING_DEFAULT_FILECHUNK;
|
||||
conf_watermark = BUFFERING_DEFAULT_WATERMARK;
|
||||
|
||||
queue_init(&buffering_queue, true);
|
||||
|
|
|
@ -117,7 +117,7 @@ enum {
|
|||
BUFFERING_SET_WATERMARK = 1,
|
||||
BUFFERING_SET_CHUNKSIZE,
|
||||
};
|
||||
void buf_set_conf(int setting, size_t value);
|
||||
void buf_set_watermark(size_t bytes);
|
||||
|
||||
|
||||
/* Debugging */
|
||||
|
|
|
@ -124,7 +124,6 @@ enum codec_status codec_main(void)
|
|||
/* Generic codec initialisation */
|
||||
ci->configure(DSP_SET_STEREO_MODE, STEREO_NONINTERLEAVED);
|
||||
ci->configure(DSP_SET_SAMPLE_DEPTH, 28);
|
||||
ci->configure(CODEC_SET_FILEBUF_CHUNKSIZE, 1024*128);
|
||||
|
||||
next_track:
|
||||
if (codec_init()) {
|
||||
|
|
|
@ -53,7 +53,6 @@ enum codec_status codec_main(void)
|
|||
unsigned char c = 0;
|
||||
|
||||
/* Generic codec initialisation */
|
||||
ci->configure(CODEC_SET_FILEBUF_CHUNKSIZE, 1024*16);
|
||||
ci->configure(CODEC_SET_FILEBUF_WATERMARK, 1024*512);
|
||||
|
||||
ci->configure(DSP_SET_STEREO_MODE, STEREO_NONINTERLEAVED);
|
||||
|
|
|
@ -55,7 +55,6 @@ enum codec_status codec_main(void)
|
|||
/* Generic codec initialisation */
|
||||
/* we only render 16 bits */
|
||||
ci->configure(DSP_SET_SAMPLE_DEPTH, 16);
|
||||
/*ci->configure(CODEC_SET_FILEBUF_CHUNKSIZE, 1024*256);*/
|
||||
|
||||
next_track:
|
||||
DEBUGF("ADX: next_track\n");
|
||||
|
|
|
@ -65,7 +65,6 @@ enum codec_status codec_main(void)
|
|||
/* Generic codec initialisation */
|
||||
ci->configure(DSP_SET_SAMPLE_DEPTH, 28);
|
||||
ci->configure(CODEC_SET_FILEBUF_WATERMARK, 1024*512);
|
||||
ci->configure(CODEC_SET_FILEBUF_CHUNKSIZE, 1024*256);
|
||||
|
||||
next_track:
|
||||
if (codec_init()) {
|
||||
|
|
|
@ -43,7 +43,6 @@ enum codec_status codec_main(void)
|
|||
|
||||
/* Generic codec initialisation */
|
||||
ci->configure(CODEC_SET_FILEBUF_WATERMARK, 1024*512);
|
||||
ci->configure(CODEC_SET_FILEBUF_CHUNKSIZE, 1024*128);
|
||||
|
||||
ci->configure(DSP_SET_STEREO_MODE, STEREO_NONINTERLEAVED);
|
||||
ci->configure(DSP_SET_SAMPLE_DEPTH, ALAC_OUTPUT_DEPTH-1);
|
||||
|
|
|
@ -147,7 +147,6 @@ enum codec_status codec_main(void)
|
|||
|
||||
/* Generic codec initialisation */
|
||||
ci->configure(CODEC_SET_FILEBUF_WATERMARK, 1024*512);
|
||||
ci->configure(CODEC_SET_FILEBUF_CHUNKSIZE, 1024*128);
|
||||
|
||||
ci->configure(DSP_SET_SAMPLE_DEPTH, APE_OUTPUT_DEPTH-1);
|
||||
|
||||
|
|
|
@ -422,7 +422,6 @@ enum codec_status codec_main(void)
|
|||
|
||||
/* Generic codec initialisation */
|
||||
ci->configure(CODEC_SET_FILEBUF_WATERMARK, 1024*512);
|
||||
ci->configure(CODEC_SET_FILEBUF_CHUNKSIZE, 1024*128);
|
||||
|
||||
ci->configure(DSP_SET_SAMPLE_DEPTH, FLAC_OUTPUT_DEPTH-1);
|
||||
|
||||
|
|
|
@ -79,7 +79,6 @@ enum codec_status codec_main(void)
|
|||
/* Create a decoder instance */
|
||||
|
||||
ci->configure(DSP_SET_SAMPLE_DEPTH, MAD_F_FRACBITS);
|
||||
ci->configure(CODEC_SET_FILEBUF_CHUNKSIZE, 1024*16);
|
||||
|
||||
next_track:
|
||||
status = CODEC_OK;
|
||||
|
|
|
@ -78,7 +78,6 @@ enum codec_status codec_main(void)
|
|||
int retval = CODEC_OK;
|
||||
|
||||
ci->configure(DSP_SET_SAMPLE_DEPTH, 28);
|
||||
ci->configure(CODEC_SET_FILEBUF_CHUNKSIZE, 1024*16);
|
||||
|
||||
/* Create a decoder instance */
|
||||
reader.read = read_impl;
|
||||
|
@ -133,14 +132,12 @@ next_track:
|
|||
/* Resume to saved sample offset. */
|
||||
if(samplesdone > 0) {
|
||||
/* hack to improve seek time if filebuf goes empty */
|
||||
ci->configure(CODEC_SET_FILEBUF_CHUNKSIZE, 1024*512);
|
||||
if (mpc_decoder_seek_sample(&decoder, samplesdone)) {
|
||||
ci->set_elapsed(samplesdone/frequency);
|
||||
} else {
|
||||
samplesdone = 0;
|
||||
}
|
||||
/* reset chunksize */
|
||||
ci->configure(CODEC_SET_FILEBUF_CHUNKSIZE, 1024*16);
|
||||
}
|
||||
|
||||
/* This is the decoding loop. */
|
||||
|
@ -149,7 +146,6 @@ next_track:
|
|||
/* Complete seek handler. */
|
||||
if (ci->seek_time) {
|
||||
/* hack to improve seek time if filebuf goes empty */
|
||||
ci->configure(CODEC_SET_FILEBUF_CHUNKSIZE, 1024*512);
|
||||
mpc_int64_t new_offset = (ci->seek_time - 1)*frequency;
|
||||
if (mpc_decoder_seek_sample(&decoder, new_offset)) {
|
||||
samplesdone = new_offset;
|
||||
|
@ -157,7 +153,6 @@ next_track:
|
|||
}
|
||||
ci->seek_complete();
|
||||
/* reset chunksize */
|
||||
ci->configure(CODEC_SET_FILEBUF_CHUNKSIZE, 1024*16);
|
||||
|
||||
}
|
||||
#else
|
||||
|
|
|
@ -46,7 +46,6 @@ enum codec_status codec_main(void)
|
|||
|
||||
/* Generic codec initialisation */
|
||||
ci->configure(CODEC_SET_FILEBUF_WATERMARK, 1024*512);
|
||||
ci->configure(CODEC_SET_FILEBUF_CHUNKSIZE, 1024*128);
|
||||
|
||||
ci->configure(DSP_SET_STEREO_MODE, STEREO_NONINTERLEAVED);
|
||||
ci->configure(DSP_SET_SAMPLE_DEPTH, SHN_OUTPUT_DEPTH-1);
|
||||
|
|
|
@ -1215,7 +1215,6 @@ enum codec_status codec_main(void)
|
|||
|
||||
/* Generic codec initialisation */
|
||||
ci->configure(CODEC_SET_FILEBUF_WATERMARK, 1024*512);
|
||||
ci->configure(CODEC_SET_FILEBUF_CHUNKSIZE, 1024*256);
|
||||
|
||||
next_track:
|
||||
if (codec_init()) {
|
||||
|
|
|
@ -117,11 +117,6 @@ enum codec_status codec_main(void)
|
|||
* they should be set differently based on quality setting
|
||||
*/
|
||||
|
||||
/* The chunk size below is magic. If set any lower, resume
|
||||
* doesn't work properly (ov_raw_seek() does the wrong thing).
|
||||
*/
|
||||
ci->configure(CODEC_SET_FILEBUF_CHUNKSIZE, 1024*256);
|
||||
|
||||
/* We need to flush reserver memory every track load. */
|
||||
next_track:
|
||||
if (codec_init()) {
|
||||
|
|
|
@ -227,7 +227,6 @@ enum codec_status codec_main(void)
|
|||
/* Generic codec initialisation */
|
||||
ci->configure(DSP_SET_SAMPLE_DEPTH, 28);
|
||||
ci->configure(CODEC_SET_FILEBUF_WATERMARK, 1024*512);
|
||||
ci->configure(CODEC_SET_FILEBUF_CHUNKSIZE, 1024*256);
|
||||
|
||||
next_track:
|
||||
if (codec_init()) {
|
||||
|
|
|
@ -43,7 +43,6 @@ enum codec_status codec_main(void)
|
|||
|
||||
/* Generic codec initialisation */
|
||||
ci->configure(CODEC_SET_FILEBUF_WATERMARK, 1024*512);
|
||||
ci->configure(CODEC_SET_FILEBUF_CHUNKSIZE, 1024*128);
|
||||
|
||||
ci->configure(DSP_SET_SAMPLE_DEPTH, 28);
|
||||
|
||||
|
|
|
@ -317,7 +317,6 @@ enum codec_status codec_main(void)
|
|||
|
||||
/* Generic codec initialisation */
|
||||
ci->configure(CODEC_SET_FILEBUF_WATERMARK, 1024*512);
|
||||
ci->configure(CODEC_SET_FILEBUF_CHUNKSIZE, 1024*128);
|
||||
|
||||
ci->configure(DSP_SET_SAMPLE_DEPTH, 30);
|
||||
|
||||
|
|
|
@ -35,7 +35,6 @@ enum
|
|||
enum
|
||||
{
|
||||
CODEC_SET_FILEBUF_WATERMARK = 1,
|
||||
CODEC_SET_FILEBUF_CHUNKSIZE,
|
||||
DSP_SWITCH_CODEC,
|
||||
DSP_SET_FREQUENCY,
|
||||
DSP_SWITCH_FREQUENCY,
|
||||
|
|
|
@ -90,8 +90,6 @@
|
|||
|
||||
/* default point to start buffer refill */
|
||||
#define AUDIO_DEFAULT_WATERMARK (1024*512)
|
||||
/* amount of data to read in one read() call */
|
||||
#define AUDIO_DEFAULT_FILECHUNK (1024*32)
|
||||
/* amount of guess-space to allow for codecs that must hunt and peck
|
||||
* for their correct seeek target, 32k seems a good size */
|
||||
#define AUDIO_REBUFFER_GUESS_SIZE (1024*32)
|
||||
|
@ -1036,7 +1034,7 @@ static void set_filebuf_watermark(int seconds, size_t max)
|
|||
|
||||
bytes = seconds?MAX(curtrack_id3.bitrate * seconds * (1000/8), max):max;
|
||||
bytes = MIN(bytes, filebuflen / 2);
|
||||
buf_set_conf(BUFFERING_SET_WATERMARK, bytes);
|
||||
buf_set_watermark(bytes);
|
||||
}
|
||||
|
||||
const char * get_codec_filename(int cod_spec)
|
||||
|
@ -1659,10 +1657,6 @@ static void codec_configure_callback(int setting, intptr_t value)
|
|||
set_filebuf_watermark(buffer_margin, value);
|
||||
break;
|
||||
|
||||
case CODEC_SET_FILEBUF_CHUNKSIZE:
|
||||
buf_set_conf(BUFFERING_SET_CHUNKSIZE, value);
|
||||
break;
|
||||
|
||||
default:
|
||||
if (!dsp_configure(setting, value)) { logf("Illegal key:%d", setting); }
|
||||
}
|
||||
|
@ -2289,8 +2283,7 @@ static bool audio_load_track(int offset, bool start_play)
|
|||
int last_codec = current_codec;
|
||||
|
||||
set_current_codec(CODEC_IDX_AUDIO);
|
||||
buf_set_conf(BUFFERING_SET_WATERMARK, AUDIO_DEFAULT_WATERMARK);
|
||||
buf_set_conf(BUFFERING_SET_CHUNKSIZE, AUDIO_DEFAULT_FILECHUNK);
|
||||
buf_set_watermark(AUDIO_DEFAULT_WATERMARK);
|
||||
dsp_configure(DSP_RESET, 0);
|
||||
set_current_codec(last_codec);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue