1
0
Fork 0
forked from len0rd/rockbox

Add anti-skip buffer time when calculating watermark. This fixes the "Anti-Skip Buffer" setting. Since the minimum and default value is 5 seconds, this is relevant even when that setting isn't changed. It prevents playback pauses on the 5G iPod, and it should also prevent pauses on other SWCODEC hard drive based players, including FS#10115.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20747 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Boris Gjenero 2009-04-19 19:38:56 +00:00
parent 4bff30a77f
commit b71aad65f5

View file

@ -264,7 +264,7 @@ static bool track_load_started = false;
static bool codec_requested_stop = false; static bool codec_requested_stop = false;
#ifdef HAVE_DISK_STORAGE #ifdef HAVE_DISK_STORAGE
static size_t buffer_margin = 0; /* Buffer margin aka anti-skip buffer (A/C-) */ static size_t buffer_margin = 5; /* Buffer margin aka anti-skip buffer (A/C-) */
#endif #endif
/* Multiple threads */ /* Multiple threads */
@ -776,7 +776,7 @@ int audio_get_file_pos(void)
#ifdef HAVE_DISK_STORAGE #ifdef HAVE_DISK_STORAGE
void audio_set_buffer_margin(int setting) void audio_set_buffer_margin(int setting)
{ {
static const int lookup[] = {5, 15, 30, 60, 120, 180, 300, 600}; static const unsigned short lookup[] = {5, 15, 30, 60, 120, 180, 300, 600};
buffer_margin = lookup[setting]; buffer_margin = lookup[setting];
logf("buffer margin: %ld", (long)buffer_margin); logf("buffer margin: %ld", (long)buffer_margin);
set_filebuf_watermark(); set_filebuf_watermark();
@ -830,15 +830,18 @@ static void set_filebuf_watermark(void)
if (!filebuf) if (!filebuf)
return; /* Audio buffers not yet set up */ return; /* Audio buffers not yet set up */
#ifdef HAVE_FLASH_STORAGE #ifdef HAVE_DISK_STORAGE
int seconds = 1;
#else
int seconds; int seconds;
int spinup = ata_spinup_time(); int spinup = storage_spinup_time();
if (spinup) if (spinup)
seconds = (spinup / HZ) + 1; seconds = (spinup / HZ) + 1;
else else
seconds = 5; seconds = 5;
seconds += buffer_margin;
#else
/* flash storage */
int seconds = 1;
#endif #endif
/* bitrate of last track in buffer dictates watermark */ /* bitrate of last track in buffer dictates watermark */