Add a new thread ("bufopen") that just adds files. Rename the playback thread codec...
commit55a3b176e053bac87cf4614471cf7bcf55b1b4af
authorNicolas Pennequin <nicolas.pennequin@free.fr>
Fri, 3 Aug 2007 13:20:16 +0000 (3 15:20 +0200)
committerNicolas Pennequin <nicolas.pennequin@free.fr>
Fri, 3 Aug 2007 13:20:16 +0000 (3 15:20 +0200)
treedff8587194dc1a065139cf42ea96dbec766177cb
parentc4a10f859134fda1293c9f65512a02a6e513de56
Add a new thread ("bufopen") that just adds files. Rename the playback thread codec thread. Fix bugs.

The bufopen thread will try adding a new file to the buffer every 8 seconds. There can now be between 0 and all the files on the buffer at the same time, which is much more interesting than only one.
The playback thread is now actually much closer to the real-life codec thread than the playback thread (though it's a very simple codec), so now is a good time to rename it.

Bugfixes:
* When adding a handle fails, close the file descriptor that was opened to get the file's size.
* When moving a handle, the alignment should be done backwards, or else we risk losing some data, and free_buffer() needs to check whether the movng succeeded.
* Before aligning the buffer write position to add a new handle, it's better to check whether we have enough space to do that.
* When we see we can't allocate enough space for the whole file, we need to make sure we take enough off the asked size, or else there might be a confusion between the empty and full states of the main buffer.
testplugin.c