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.tar.gz
rockbox-b71aad65f5b69e2c3212a3efdd3abca29516c450.zip
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 baed012ddf..fc34fe863f 100644
--- a/apps/playback.c
+++ b/apps/playback.c
@@ -264,7 +264,7 @@ static bool track_load_started = false;
264static bool codec_requested_stop = false; 264static bool codec_requested_stop = false;
265 265
266#ifdef HAVE_DISK_STORAGE 266#ifdef HAVE_DISK_STORAGE
267static size_t buffer_margin = 0; /* Buffer margin aka anti-skip buffer (A/C-) */ 267static size_t buffer_margin = 5; /* Buffer margin aka anti-skip buffer (A/C-) */
268#endif 268#endif
269 269
270/* Multiple threads */ 270/* Multiple threads */
@@ -776,7 +776,7 @@ int audio_get_file_pos(void)
776#ifdef HAVE_DISK_STORAGE 776#ifdef HAVE_DISK_STORAGE
777void audio_set_buffer_margin(int setting) 777void audio_set_buffer_margin(int setting)
778{ 778{
779 static const int lookup[] = {5, 15, 30, 60, 120, 180, 300, 600}; 779 static const unsigned short lookup[] = {5, 15, 30, 60, 120, 180, 300, 600};
780 buffer_margin = lookup[setting]; 780 buffer_margin = lookup[setting];
781 logf("buffer margin: %ld", (long)buffer_margin); 781 logf("buffer margin: %ld", (long)buffer_margin);
782 set_filebuf_watermark(); 782 set_filebuf_watermark();
@@ -830,15 +830,18 @@ static void set_filebuf_watermark(void)
830 if (!filebuf) 830 if (!filebuf)
831 return; /* Audio buffers not yet set up */ 831 return; /* Audio buffers not yet set up */
832 832
833#ifdef HAVE_FLASH_STORAGE 833#ifdef HAVE_DISK_STORAGE
834 int seconds = 1;
835#else
836 int seconds; 834 int seconds;
837 int spinup = ata_spinup_time(); 835 int spinup = storage_spinup_time();
838 if (spinup) 836 if (spinup)
839 seconds = (spinup / HZ) + 1; 837 seconds = (spinup / HZ) + 1;
840 else 838 else
841 seconds = 5; 839 seconds = 5;
840
841 seconds += buffer_margin;
842#else
843 /* flash storage */
844 int seconds = 1;
842#endif 845#endif
843 846
844 /* bitrate of last track in buffer dictates watermark */ 847 /* bitrate of last track in buffer dictates watermark */