Give lowmem targets or targets with broken ATA implementations more buffering opportunities. Fix part of hcs' long standing SPC bug by filling if the useful data is equal to the watermark as well as less than

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15417 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Brandon Low 2007-11-03 03:46:22 +00:00
parent 8b8785b541
commit dc58c3d92e

View file

@ -1226,7 +1226,7 @@ void buffering_thread(void)
update_data_counters(); update_data_counters();
/* If the buffer is low, call the callbacks to get new data */ /* If the buffer is low, call the callbacks to get new data */
if (num_handles > 0 && data_counters.useful < conf_watermark) if (num_handles > 0 && data_counters.useful <= conf_watermark)
{ {
call_buffer_low_callbacks(); call_buffer_low_callbacks();
} }
@ -1237,23 +1237,24 @@ void buffering_thread(void)
queue_empty(&buffering_queue)) queue_empty(&buffering_queue))
{ {
if (data_counters.remaining > 0 && if (data_counters.remaining > 0 &&
data_counters.buffered < high_watermark) data_counters.buffered <= high_watermark)
{ {
fill_buffer(); fill_buffer();
update_data_counters(); update_data_counters();
} }
if (num_handles > 0 && data_counters.useful < high_watermark) if (num_handles > 0 && data_counters.useful <= high_watermark)
{ {
call_buffer_low_callbacks(); call_buffer_low_callbacks();
} }
} }
#endif #endif
if (ev.id == SYS_TIMEOUT && queue_empty(&buffering_queue)) if ((ev.id == SYS_TIMEOUT || ev.id == Q_BUFFER_HANDLE) &&
queue_empty(&buffering_queue))
{ {
if (data_counters.remaining > 0 && if (data_counters.remaining > 0 &&
data_counters.useful < conf_watermark) data_counters.useful <= conf_watermark)
{ {
/* Recursively shrink the buffer, depth first */ /* Recursively shrink the buffer, depth first */
shrink_buffer(first_handle); shrink_buffer(first_handle);