Commit graph

132 commits

Author SHA1 Message Date
Brandon Low
2ecb3231c6 More residuals from 8077, sanitize chunk and watermark settings
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15452 a1c6a512-1295-4272-9138-f99709370657
2007-11-04 06:01:46 +00:00
Brandon Low
ebc981b233 More residuals from 8077 that should make buffering start up more smoothly and complete more completely
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15451 a1c6a512-1295-4272-9138-f99709370657
2007-11-04 05:57:48 +00:00
Brandon Low
3817acc682 Tweak the way the data_counters are calculated to make it more friendly to the potential read-during-write, probably has very little impact on the compiled code
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15448 a1c6a512-1295-4272-9138-f99709370657
2007-11-04 05:15:41 +00:00
Brandon Low
aabd6885bf More try to fix 8077, BUF_USED is not a good way to determine if the buffer is healthy any more, we'll need a enw way if we need to resurrect yield_codec later
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15447 a1c6a512-1295-4272-9138-f99709370657
2007-11-04 02:40:24 +00:00
Brandon Low
1c36a660ea Disable the already spinning optimization until it is written correctly
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15445 a1c6a512-1295-4272-9138-f99709370657
2007-11-04 00:23:22 +00:00
Brandon Low
9784f6b752 Make the use of signed int for buffer handles consistent and handle wrapping better. Number of handle_ids available is unchanged by this.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15442 a1c6a512-1295-4272-9138-f99709370657
2007-11-03 22:06:56 +00:00
Brandon Low
7b74dd7574 Attempt to fix FS#8077... again
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15441 a1c6a512-1295-4272-9138-f99709370657
2007-11-03 21:57:27 +00:00
Brandon Low
c2e1cc1e39 Revert recent changes that are broken
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15439 a1c6a512-1295-4272-9138-f99709370657
2007-11-03 21:48:08 +00:00
Brandon Low
acb3e9af22 Make handle id semantics more like file id. This may need to be revisited if we ever start storing long lived things on the buffer (if an item lives through 32k other items coming and going, there will be an id collision and things will break)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15437 a1c6a512-1295-4272-9138-f99709370657
2007-11-03 21:13:15 +00:00
Brandon Low
60d4e7c9c4 Buffering consistency improvements
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15436 a1c6a512-1295-4272-9138-f99709370657
2007-11-03 17:55:45 +00:00
Brandon Low
11a3661d73 Make atomic type work for even first track. Rework low buffer handling... uses a stateful variable because I'm a bitter old man and it works this way
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15425 a1c6a512-1295-4272-9138-f99709370657
2007-11-03 06:21:32 +00:00
Brandon Low
dc58c3d92e 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
2007-11-03 03:46:22 +00:00
Brandon Low
a042c720c3 Use a recursive depth-first shrinkage function, limit handles accordingly
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15414 a1c6a512-1295-4272-9138-f99709370657
2007-11-03 02:54:34 +00:00
Nicolas Pennequin
b838a62adf Make bufread and bufgetdata blocking. They now return when enough data is available or when EOF is reached. This improves the API and removes the need for several duplicate waiting loops.
Also fix a few logfqueue messages.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15412 a1c6a512-1295-4272-9138-f99709370657
2007-11-02 19:13:03 +00:00
Brandon Low
dcca586a9b Improve upon my hackity hack from before by separating audio into two types: that which may be large and can be streamed and that which is small and cannot be streamed. While modifying types, allow codecs to split across the buffer wrap and dig out/move around the code that reads a codec off of the buffer to facilitate that simple sounding change.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15408 a1c6a512-1295-4272-9138-f99709370657
2007-11-02 14:06:48 +00:00
Brandon Low
ff9cdb464a Temporary work around for the situation where a single codec request is for more data than a single file_chunk and that file gets stuck. This should be fixed differently as it could lead to unresponsive behavior from the buffering thread for the duration of a file load.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15390 a1c6a512-1295-4272-9138-f99709370657
2007-11-01 05:12:55 +00:00
Nicolas Pennequin
09bce70f17 Slight rework of the buffering logic:
* Don't rely only on ata_disk_is_active, and also do buffer filling after buffer handle requests. Should fix FS#8049.
* Shrink the handles at the last possible moment. This allows more seeking without rebuffering for long tracks and minimises buffer waste.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15377 a1c6a512-1295-4272-9138-f99709370657
2007-10-30 17:24:31 +00:00
Brandon Low
151b7c9038 Further improve the mistakes I made in add_handle (thanks Nico_P for not beating me with them)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15376 a1c6a512-1295-4272-9138-f99709370657
2007-10-30 15:09:52 +00:00
Nicolas Pennequin
4ff2f9f372 can_add_handle() can be removed, but its logic must remain: before adding a handle, we need to make sure the there'll be space left for the curent one to finish buffering. This should fix the audio dropout problems people were experiencing.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15374 a1c6a512-1295-4272-9138-f99709370657
2007-10-30 14:11:03 +00:00
Brandon Low
4649eecc79 Fix yellow, not sure how to properly specify this argument's nature so this is fine
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15363 a1c6a512-1295-4272-9138-f99709370657
2007-10-29 17:00:03 +00:00
Brandon Low
483dca99c4 Remove can_add_handle, its safety and benefit are both questionable. Make shrink_buffer a function to reduce code duplication. Change move_handle semantics so that the caller never loses track of the current position of h, even if the move fails.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15362 a1c6a512-1295-4272-9138-f99709370657
2007-10-29 16:48:16 +00:00
Nicolas Pennequin
d400e23e38 Prefix the error constants with ERR_
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15359 a1c6a512-1295-4272-9138-f99709370657
2007-10-29 14:15:59 +00:00
Brandon Low
4feab10a0c Improve move_handle's semantics. Shoudl have no functional impact
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15351 a1c6a512-1295-4272-9138-f99709370657
2007-10-28 20:18:59 +00:00
Brandon Low
94b133ad33 Comment improvements
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15350 a1c6a512-1295-4272-9138-f99709370657
2007-10-28 19:19:54 +00:00
Nicolas Pennequin
7807279eaf Add #defines for error values. Makes the code easier to read.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15348 a1c6a512-1295-4272-9138-f99709370657
2007-10-28 15:54:10 +00:00
Brandon Low
18c9aba4b4 Hopefully fix codec load and data abort problems by making add_handle and move_handle much better at wrapping the buffer smartly and not putting the wrong things on the wrap
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15330 a1c6a512-1295-4272-9138-f99709370657
2007-10-27 04:49:04 +00:00
Brandon Low
7104ad54d0 Whoops, that thread can't run until the linked list is initialized
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15329 a1c6a512-1295-4272-9138-f99709370657
2007-10-27 04:29:46 +00:00
Brandon Low
2c1e8283aa Create queue stuff before the thread that will use it
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15328 a1c6a512-1295-4272-9138-f99709370657
2007-10-27 04:19:17 +00:00
Brandon Low
14b6f437bb Make buffering initialization versus reset separate functions to avoid double initializing threads or mutexes more easily
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15327 a1c6a512-1295-4272-9138-f99709370657
2007-10-27 04:16:41 +00:00
Brandon Low
404c6fbdb2 Add some const keywords, improve some comments, add a safety check or two, should have no functional difference
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15326 a1c6a512-1295-4272-9138-f99709370657
2007-10-27 01:37:33 +00:00
Nicolas Pennequin
d08131a117 * Only call bufgetcodec once
* Fix/Improve some queue logf messages
* Complete buffering_init


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15325 a1c6a512-1295-4272-9138-f99709370657
2007-10-27 01:25:47 +00:00
Nicolas Pennequin
3e3c43c747 Finally commit Metadata on Buffer!
buffering.c and buffering.h implement the new buffering API. playback.c is translated to that API. For more information about the whole concept, see http://www.rockbox.org/wiki/MetadataOnBuffer.
There should be no major visible changes, but most existing bugs remain (though fixing them should be easier now that playback.c is a bit less complex) and there probably will be new ones. Please report any problem!
Next step is to adapt cuesheet support, which is partly disabled here, and of course fix as much bugs as possible.


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15306 a1c6a512-1295-4272-9138-f99709370657
2007-10-25 21:27:45 +00:00