summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Gjenero <dreamlayers@rockbox.org>2009-04-19 19:38:56 +0000
committerBoris Gjenero <dreamlayers@rockbox.org>2009-04-19 19:38:56 +0000
commitb71aad65f5b69e2c3212a3efdd3abca29516c450 (patch)
tree886bd3bf0f3f8d8082398b167fe804d4b4717de7
parent4bff30a77f713b5f310534e093a39292b7b809f8 (diff)
downloadrockbox-b71aad65f5b69e2c3212a3efdd3abca29516c450.zip
rockbox-b71aad65f5b69e2c3212a3efdd3abca29516c450.tar.gz
rockbox-b71aad65f5b69e2c3212a3efdd3abca29516c450.tar.bz2
rockbox-b71aad65f5b69e2c3212a3efdd3abca29516c450.tar.xz
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
-rw-r--r--apps/playback.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/apps/playback.c b/apps/playback.c
index baed012..fc34fe8 100644
--- a/apps/playback.c
+++ b/apps/playback.c
@@ -264,7 +264,7 @@ static bool track_load_started = false;
static bool codec_requested_stop = false;
#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
/* Multiple threads */
@@ -776,7 +776,7 @@ int audio_get_file_pos(void)
#ifdef HAVE_DISK_STORAGE
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];
logf("buffer margin: %ld", (long)buffer_margin);
set_filebuf_watermark();
@@ -830,15 +830,18 @@ static void set_filebuf_watermark(void)
if (!filebuf)
return; /* Audio buffers not yet set up */
-#ifdef HAVE_FLASH_STORAGE
- int seconds = 1;
-#else
+#ifdef HAVE_DISK_STORAGE
int seconds;
- int spinup = ata_spinup_time();
+ int spinup = storage_spinup_time();
if (spinup)
seconds = (spinup / HZ) + 1;
else
seconds = 5;
+
+ seconds += buffer_margin;
+#else
+ /* flash storage */
+ int seconds = 1;
#endif
/* bitrate of last track in buffer dictates watermark */