diff options
Diffstat (limited to 'apps/buffering.c')
-rw-r--r-- | apps/buffering.c | 25 |
1 files changed, 3 insertions, 22 deletions
diff --git a/apps/buffering.c b/apps/buffering.c index 1e643c5771..d715456efb 100644 --- a/apps/buffering.c +++ b/apps/buffering.c | |||
@@ -56,11 +56,7 @@ | |||
56 | #include "albumart.h" | 56 | #include "albumart.h" |
57 | #endif | 57 | #endif |
58 | 58 | ||
59 | #if MEM > 1 | ||
60 | #define GUARD_BUFSIZE (32*1024) | 59 | #define GUARD_BUFSIZE (32*1024) |
61 | #else | ||
62 | #define GUARD_BUFSIZE (8*1024) | ||
63 | #endif | ||
64 | 60 | ||
65 | /* Define LOGF_ENABLE to enable logf output in this file */ | 61 | /* Define LOGF_ENABLE to enable logf output in this file */ |
66 | /*#define LOGF_ENABLE*/ | 62 | /*#define LOGF_ENABLE*/ |
@@ -88,11 +84,9 @@ | |||
88 | #endif | 84 | #endif |
89 | 85 | ||
90 | /* default point to start buffer refill */ | 86 | /* default point to start buffer refill */ |
91 | #define BUFFERING_DEFAULT_WATERMARK (1024*512) | 87 | #define BUFFERING_DEFAULT_WATERMARK (1024*128) |
92 | /* amount of data to read in one read() call */ | 88 | /* amount of data to read in one read() call */ |
93 | #define BUFFERING_DEFAULT_FILECHUNK (1024*32) | 89 | #define BUFFERING_DEFAULT_FILECHUNK (1024*32) |
94 | /* point at which the file buffer will fight for CPU time */ | ||
95 | #define BUFFERING_CRITICAL_LEVEL (1024*128) | ||
96 | 90 | ||
97 | #define BUF_HANDLE_MASK 0x7FFFFFFF | 91 | #define BUF_HANDLE_MASK 0x7FFFFFFF |
98 | 92 | ||
@@ -173,7 +167,6 @@ enum { | |||
173 | Q_BASE_HANDLE, /* Set the reference handle for buf_useful_data */ | 167 | Q_BASE_HANDLE, /* Set the reference handle for buf_useful_data */ |
174 | 168 | ||
175 | /* Configuration: */ | 169 | /* Configuration: */ |
176 | Q_SET_WATERMARK, | ||
177 | Q_START_FILL, /* Request that the buffering thread initiate a buffer | 170 | Q_START_FILL, /* Request that the buffering thread initiate a buffer |
178 | fill at its earliest convenience */ | 171 | fill at its earliest convenience */ |
179 | Q_HANDLE_ADDED, /* Inform the buffering thread that a handle was added, | 172 | Q_HANDLE_ADDED, /* Inform the buffering thread that a handle was added, |
@@ -555,7 +548,7 @@ static void update_data_counters(void) | |||
555 | static inline bool buffer_is_low(void) | 548 | static inline bool buffer_is_low(void) |
556 | { | 549 | { |
557 | update_data_counters(); | 550 | update_data_counters(); |
558 | return data_counters.useful < BUFFERING_CRITICAL_LEVEL; | 551 | return data_counters.useful < (conf_watermark / 2); |
559 | } | 552 | } |
560 | 553 | ||
561 | /* Buffer data for the given handle. | 554 | /* Buffer data for the given handle. |
@@ -1313,8 +1306,7 @@ size_t buf_used(void) | |||
1313 | 1306 | ||
1314 | void buf_set_watermark(size_t bytes) | 1307 | void buf_set_watermark(size_t bytes) |
1315 | { | 1308 | { |
1316 | LOGFQUEUE("buffering > Q_SET_WATERMARK %ld", (long)bytes); | 1309 | conf_watermark = bytes; |
1317 | queue_post(&buffering_queue, Q_SET_WATERMARK, bytes); | ||
1318 | } | 1310 | } |
1319 | 1311 | ||
1320 | static void shrink_buffer_inner(struct memory_handle *h) | 1312 | static void shrink_buffer_inner(struct memory_handle *h) |
@@ -1386,17 +1378,6 @@ void buffering_thread(void) | |||
1386 | base_handle_id = (int)ev.data; | 1378 | base_handle_id = (int)ev.data; |
1387 | break; | 1379 | break; |
1388 | 1380 | ||
1389 | case Q_SET_WATERMARK: | ||
1390 | LOGFQUEUE("buffering < Q_SET_WATERMARK"); | ||
1391 | conf_watermark = (size_t)ev.data; | ||
1392 | if (conf_watermark < BUFFERING_DEFAULT_FILECHUNK) | ||
1393 | { | ||
1394 | logf("wmark<chunk %ld<%d", | ||
1395 | (long)conf_watermark, BUFFERING_DEFAULT_FILECHUNK); | ||
1396 | conf_watermark = BUFFERING_DEFAULT_FILECHUNK; | ||
1397 | } | ||
1398 | break; | ||
1399 | |||
1400 | #ifndef SIMULATOR | 1381 | #ifndef SIMULATOR |
1401 | case SYS_USB_CONNECTED: | 1382 | case SYS_USB_CONNECTED: |
1402 | LOGFQUEUE("buffering < SYS_USB_CONNECTED"); | 1383 | LOGFQUEUE("buffering < SYS_USB_CONNECTED"); |