diff options
Diffstat (limited to 'apps')
-rw-r--r-- | apps/buffering.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/apps/buffering.c b/apps/buffering.c index 31db7f640c..d6dc84caa8 100644 --- a/apps/buffering.c +++ b/apps/buffering.c | |||
@@ -1226,7 +1226,7 @@ void buffering_thread(void) | |||
1226 | update_data_counters(); | 1226 | update_data_counters(); |
1227 | 1227 | ||
1228 | /* If the buffer is low, call the callbacks to get new data */ | 1228 | /* If the buffer is low, call the callbacks to get new data */ |
1229 | if (num_handles > 0 && data_counters.useful < conf_watermark) | 1229 | if (num_handles > 0 && data_counters.useful <= conf_watermark) |
1230 | { | 1230 | { |
1231 | call_buffer_low_callbacks(); | 1231 | call_buffer_low_callbacks(); |
1232 | } | 1232 | } |
@@ -1237,23 +1237,24 @@ void buffering_thread(void) | |||
1237 | queue_empty(&buffering_queue)) | 1237 | queue_empty(&buffering_queue)) |
1238 | { | 1238 | { |
1239 | if (data_counters.remaining > 0 && | 1239 | if (data_counters.remaining > 0 && |
1240 | data_counters.buffered < high_watermark) | 1240 | data_counters.buffered <= high_watermark) |
1241 | { | 1241 | { |
1242 | fill_buffer(); | 1242 | fill_buffer(); |
1243 | update_data_counters(); | 1243 | update_data_counters(); |
1244 | } | 1244 | } |
1245 | 1245 | ||
1246 | if (num_handles > 0 && data_counters.useful < high_watermark) | 1246 | if (num_handles > 0 && data_counters.useful <= high_watermark) |
1247 | { | 1247 | { |
1248 | call_buffer_low_callbacks(); | 1248 | call_buffer_low_callbacks(); |
1249 | } | 1249 | } |
1250 | } | 1250 | } |
1251 | #endif | 1251 | #endif |
1252 | 1252 | ||
1253 | if (ev.id == SYS_TIMEOUT && queue_empty(&buffering_queue)) | 1253 | if ((ev.id == SYS_TIMEOUT || ev.id == Q_BUFFER_HANDLE) && |
1254 | queue_empty(&buffering_queue)) | ||
1254 | { | 1255 | { |
1255 | if (data_counters.remaining > 0 && | 1256 | if (data_counters.remaining > 0 && |
1256 | data_counters.useful < conf_watermark) | 1257 | data_counters.useful <= conf_watermark) |
1257 | { | 1258 | { |
1258 | /* Recursively shrink the buffer, depth first */ | 1259 | /* Recursively shrink the buffer, depth first */ |
1259 | shrink_buffer(first_handle); | 1260 | shrink_buffer(first_handle); |