Create two separate ways for a handle buffer request to be sent. One is when the buffer has gotten low, in this case, we want to start a buffer fill. The other is when the buffer itself requests a buffer as part of a running fill. Obviously this is not a new fill start

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15480 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Brandon Low 2007-11-05 17:51:55 +00:00
parent 76f9bfa945
commit 86830b6566

View file

@ -174,8 +174,7 @@ enum {
/* Configuration: */ /* Configuration: */
Q_SET_WATERMARK, Q_SET_WATERMARK,
Q_SET_CHUNKSIZE, Q_START_FILL, /* Request that the buffering thread initiate a buffer
Q_FILL_BUFFER, /* Request that the buffering thread initiate a buffer
fill at its earliest convenience */ fill at its earliest convenience */
}; };
@ -1089,11 +1088,8 @@ ssize_t buf_handle_offset(int handle_id)
void buf_request_buffer_handle(int handle_id) void buf_request_buffer_handle(int handle_id)
{ {
LOGFQUEUE("buffering >| Q_FILL_BUFFER"); LOGFQUEUE("buffering >| Q_START_FILL %d",handle_id);
queue_send(&buffering_queue, Q_FILL_BUFFER, 0); queue_send(&buffering_queue, Q_START_FILL, handle_id);
LOGFQUEUE("buffering >| Q_BUFFER_HANDLE %d", handle_id);
queue_send(&buffering_queue, Q_BUFFER_HANDLE, handle_id);
} }
void buf_set_base_handle(int handle_id) void buf_set_base_handle(int handle_id)
@ -1188,19 +1184,20 @@ void buffering_thread(void)
switch (ev.id) switch (ev.id)
{ {
case Q_FILL_BUFFER: case Q_START_FILL:
LOGFQUEUE("buffering < Q_FILL_BUFFER"); LOGFQUEUE("buffering < Q_START_FILL");
/* Call buffer callbacks here because this is one of two ways /* Call buffer callbacks here because this is one of two ways
* to begin a full buffer fill */ * to begin a full buffer fill */
call_buffer_low_callbacks(); call_buffer_low_callbacks();
shrink_buffer(); shrink_buffer();
queue_reply(&buffering_queue, 1); queue_reply(&buffering_queue, 1);
filling |= buffer_handle((int)ev.data);
break; break;
case Q_BUFFER_HANDLE: case Q_BUFFER_HANDLE:
LOGFQUEUE("buffering < Q_BUFFER_HANDLE"); LOGFQUEUE("buffering < Q_BUFFER_HANDLE");
queue_reply(&buffering_queue, 1); queue_reply(&buffering_queue, 1);
filling |= buffer_handle((int)ev.data); buffer_handle((int)ev.data);
break; break;
case Q_RESET_HANDLE: case Q_RESET_HANDLE: