summaryrefslogtreecommitdiff
path: root/apps/buffering.c (follow)
Commit message (Collapse)AuthorAge
* Cleanup unused functionMihail Zenkov2016-04-04
| | | | Change-Id: I10aac94906607a74f05a687cb3d0029cb6faea6e
* Remove I/O priority. It is harmful when used with the new file code.Michael Sevakis2014-08-30
| | | | | | | | | | HAVE_IO_PRIORITY was defined for native targets with dircache. It is already effectively disabled for the most part since dircache no longer lowers its thread's I/O priority. It existed primarily for the aforementioned configuration. Change-Id: Ia04935305397ba14df34647c8ea29c2acaea92aa
* buffering.c: Patch up some straggling strlcpy warningsMichael Sevakis2014-04-03
| | | | | | | | | Originating from 3661581 Some build clients finding their "standard" string.h's that don't declare strlcpy? Change-Id: I50d19c7cecf5ae96ee1855f77d3c2e1f42620108
* Apparently some builds still need string.h in buffering.cMichael Sevakis2014-04-02
| | | | Change-Id: I99b90ab7e5b7d074b1d2d1de72267f9f2eea975b
* Buffering: Remove buf_ridx and buf_widx; these data are verbose.Michael Sevakis2014-04-03
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It is trivial to obtain all required information from the allocated handles without maintaining global indexes. In fact, it is less complicated and increases general thread safety. Other miscellaneous changes (some are nice to do at this time due to required alterations, with some particularly more relevant than others): * Handle value 0 will no longer be returned as a valid handle but all failures will still return a negative value. Creates consistency with buflib and removes the need to explicitly initialize them. * Linking a new handle is delayed until explicitly added by the code that called add_handle, keeping it invisible until every operation succeeds, which is safer thread-wise. If anything fails, the handle itself may just be abandoned rather than reqiring it be freed. * Dump the special handling to slow buffering when the PCM buffer is low that calls PCM buffer functions. It doesn't seem to help much of anything these days and it's a bit of a nasty hack to directly tie those bits together. It can of course be put back (again!) if there really is a need for it. * Make data waiters ping the buffering thread more than just once if the request is taking too long. Somehow I figured out how the requests could get forgotten about but can't remember why months later after making the change in my branch. :-) * Neaten up some code by using (inline) functions and packing down parameters; remember handle allocation and movement attributes in the handle itself rather than figuring it out each time they're needed. Change-Id: Ibf863370da3dd805132fc135e0ad104953365183 Reviewed-on: http://gerrit.rockbox.org/764 Reviewed-by: Michael Sevakis <jethead71@rockbox.org> Tested: Michael Sevakis <jethead71@rockbox.org>
* SWCODEC Audio: Add some INIT_ATTR's to get a few bytes back.Michael Sevakis2013-06-29
| | | | Change-Id: Ie7b04ecf3b3535e0ed45a6e0e8d81af89e38378e
* Fix whitespaceMichael Sevakis2013-06-29
| | | | Change-Id: I2072c355f05b6e709a5c179512bc2b71756163a5
* Fix some lockup caused by handles not being initialized to < 0...Michael Sevakis2012-05-21
| | | | | | | | | | | | | | ...by default where they would be interpreted as valid but not actually be which would cause calls to buffering while it was not initialized. Add BUFFER_EVENT_BUFFER_RESET to inform users of buffering that the buffer is being reinitialized. Basically, this wraps all the functionality being provided by three events (...START_PLAYBACK, RECORDING_EVENT_START, RECORDING_EVENT_STOP) into one for radioart.c, the only user of those events (perhaps remove them?) and closes some loopholes. Change-Id: I99ec46b9b5fb4e36605db5944c60ed986163db3a
* Provide a reasonable fix for FS#12093 - Playback hanging after ↵Michael Sevakis2011-05-09
| | | | | | codec/playback rework. Also, get rid of an impossible buffering case (BUF_USED is always less than buffer_len) and remove a buffering API that is not used anywhere and shouldn't be needed (plugin API has to be incompatible). git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29849 a1c6a512-1295-4272-9138-f99709370657
* Commit FS#12069 - Playback rework - first stages. Gives as thorough as ↵Michael Sevakis2011-04-27
| | | | | | possible a treatment of codec management, track change and metadata logic as possible while maintaining fairly narrow focus and not rewriting everything all at once. Please see the rockbox-dev mail archive on 2011-04-25 (Playback engine rework) for a more thorough manifest of what was addressed. Plugins and codecs become incompatible. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29785 a1c6a512-1295-4272-9138-f99709370657
* Buffering should truncate if read() returns 0 since it's not a valid return ↵Michael Sevakis2011-03-21
| | | | | | there as there should be data left to read. The loop wouldn't break until there was a message in the queue. I just experienced the case with crosslinked files and read stopped making progress, returning 0 each time it was called. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29626 a1c6a512-1295-4272-9138-f99709370657
* Purge buffer and codec APIs existing exclusively in support of mpa.codec and ↵Michael Sevakis2011-03-16
| | | | | | fix that to not require them: buf_get_offset and ci.advance_buffer_loc. Sort APIs; everything must become incompatible. :( git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29595 a1c6a512-1295-4272-9138-f99709370657
* Use ringbuf_add in buffering when incrementing for initial allocation of ↵Michael Sevakis2011-03-13
| | | | | | non-wrapping data. The result of the shortcut would have been wrong if the handle used space exactly to the end of the buffer since buf_widx wouldn't have been properly wrapped to index 0. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29578 a1c6a512-1295-4272-9138-f99709370657
* Do the ridx > widx check where it should be done. A small rebuffering ↵Michael Sevakis2011-03-02
| | | | | | request must completely succeed before buffer can later shrink a handle or else it must reset the handle. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29491 a1c6a512-1295-4272-9138-f99709370657
* buffering: Unusual cases when a handle ridx is briefly seeked ahead of widx ↵Michael Sevakis2011-03-02
| | | | | | need to be handled properly. In the best case, buffer useful would be wrong and in the worst, a packet audio move_handle delta would be quite incorrect, causing the handle to be moved too far. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29490 a1c6a512-1295-4272-9138-f99709370657
* All kernel objects in code shared amongs targets (core, plugins, codecs) ↵Michael Sevakis2011-02-14
| | | | | | should be declared SHAREDBSS_ATTR as any core could potentially touch them even though they seem only to involve threads on one core. The exception is target code for particular CPUs where proper allocation is fixed. playlist.c was a little odd too-- use one mutex for the current playlist and a separate one for created playlists (still pondering the necessity of more than one). git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29305 a1c6a512-1295-4272-9138-f99709370657
* Code police buffering.c a little - use already predominant style - shorted ↵Michael Sevakis2011-02-14
| | | | | | lines over 80 cols. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29304 a1c6a512-1295-4272-9138-f99709370657
* Buffering: tin cup. Update threading structure and handle rebuffer more ↵Michael Sevakis2011-02-14
| | | | | | reliably on buffer thread using a single message send. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29303 a1c6a512-1295-4272-9138-f99709370657
* Leave a gap between all handles because ringbuf_add_cross interprets equal ↵Michael Sevakis2011-02-14
| | | | | | pointers as empty, corruption guard check could fail to detect overlap if buffering ran right up to the next handle and it gets asked to buffer again before freeing the following handles (adds a byte on average). Storage alignment on handle reset must at times avoid alignment increments if after a stopped rebuffer, the handle was shrunk too close to the next one or the reading position in a prior rebuffer. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29302 a1c6a512-1295-4272-9138-f99709370657
* Needed to do a few more things to have r29291 correct.Michael Sevakis2011-02-13
| | | | git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29294 a1c6a512-1295-4272-9138-f99709370657
* Change add_handle to never have side effects on the buffer if it fails. It ↵Michael Sevakis2011-02-13
| | | | | | actually seems ok and I'm not sure if's responsible for anything, but it's more sane and keeps buffer_handle from regressing buf_widx later if buffering cur_handle. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29291 a1c6a512-1295-4272-9138-f99709370657
* Oops. Put back some changes to go only with others.Michael Sevakis2011-02-12
| | | | git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29289 a1c6a512-1295-4272-9138-f99709370657
* Fix move_handle in buffering. Calculating wraps by buffer_len - 1 is ↵Michael Sevakis2011-02-12
| | | | | | incorrect. Switch handle movement to memmove calls exclusively. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29288 a1c6a512-1295-4272-9138-f99709370657
* buffering: Don't execute move-handle-ony case if handle is of metadata type ↵Michael Sevakis2011-02-10
| | | | | | (atomic) and must be kept fully buffered. Manage handle corruption guard and handle buffering with one set of logic which allows reading of the maximum amount of data without overflow. 'FIXME' regarding handle corruption guard is really part of expected operation when thread that does the handle closing hasn't yet performed the delegated task before rebuffering starts. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29270 a1c6a512-1295-4272-9138-f99709370657
* Disable buffering codecs (and code generally) on RaaA.Thomas Martitz2011-02-09
| | | | | | | It's not useful to do it since you need to write back the code to disk to be able to load it from memory, it also requires writing to an executable directory. Keep it for the simulator for the sake of simulating. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29261 a1c6a512-1295-4272-9138-f99709370657
* Embedded album art support in MP3/ID3v2 tags.Thomas Martitz2011-02-09
| | | | | | | | | | | - Support is limited to non-desync jpeg in id3v2 tags. Other formats (hopefully) follow in the future. - Embedded album art takes precedence over files in album art files. - No additional buffers are used, the jpeg is read directly from the audio file. Flyspray: FS#11216 Author: Yoshihisa Uchida and I git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29259 a1c6a512-1295-4272-9138-f99709370657
* Buffering should align itself and not rely on buffering_reset parameters ↵Michael Sevakis2011-02-09
| | | | | | when storage alignment matters so that wrapped reads maintain alignment. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29258 a1c6a512-1295-4272-9138-f99709370657
* buffering: Fix a case that could allow widx to fully wrap to ridx and ↵Michael Sevakis2011-02-09
| | | | | | overflow the ringbuffer. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29257 a1c6a512-1295-4272-9138-f99709370657
* Roll back unintentionally submitted file.Andree Buschmann2011-02-03
| | | | git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29200 a1c6a512-1295-4272-9138-f99709370657
* Submit FS#11918: Add 2 more codec types to be able to differentiate between ↵Andree Buschmann2011-02-03
| | | | | | AAC / AAC-HE and MPC SV7 / SV8. Additionally handle ATARI soundfiles in get_codec_base_type() as intended. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29199 a1c6a512-1295-4272-9138-f99709370657
* Clean up multiple definitions of RAM size. Remove -DMEM (make) and MEM ↵Andree Buschmann2011-02-02
| | | | | | (code), use the already defined MEMORYSIZE instead. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29189 a1c6a512-1295-4272-9138-f99709370657
* Fix FS#11586. Corrects rebuffering behaviour which did not allow to play ↵Andree Buschmann2010-08-30
| | | | | | several m4a files. Thanks to Magnus Holmgren. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27950 a1c6a512-1295-4272-9138-f99709370657
* Oops, committed before finishing the removal of "#include "memory.h""Thomas Martitz2010-08-12
| | | | git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27790 a1c6a512-1295-4272-9138-f99709370657
* Remove some redundant #include'sBertrik Sikken2010-06-29
| | | | git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27183 a1c6a512-1295-4272-9138-f99709370657
* playback.c: don't assume cacheline size is 16 bytesRafaël Carré2010-06-23
| | | | | | | | | | ideally all targets should define CACHEALIGN_BITS, for now we default it to 16 bytes if it's not specified Since the buffer is already aligned in playback.c no need to align it again in buffering.c git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27073 a1c6a512-1295-4272-9138-f99709370657
* Rockbox as an application: Replace many occurences of #ifdef SIMULATOR with ↵Thomas Martitz2010-06-21
| | | | | | | | | | | #if (CONFIG_PLATFORM & PLATFORM_HOSTED) (or equivalently). The simulator defines PLATFORM_HOSTED, as RaaA will do (RaaA will not define SIMULATOR). The new define is to (de-)select code to compile on hosted platforms generally. Should be no functional change to targets or the simulator. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27019 a1c6a512-1295-4272-9138-f99709370657
* fix: when move_handle() is successful, the return valueYoshihisa Uchida2010-05-24
| | | | | | corrects valid type. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26249 a1c6a512-1295-4272-9138-f99709370657
* FS#11263 - Radio Art support! %C and %Cl tags work in the radio screen and ↵Jonathan Gordon2010-05-16
| | | | | | | | | Base Skin when the radio is running. put your station images in .rockbox/fmpresets/<preset name>.bmp or .jpg. Must be in preset mode and the preset name must match the filename git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26078 a1c6a512-1295-4272-9138-f99709370657
* Eliminate %zd tag in printf format strings, replace them with %ld. The %z ↵Jeffrey Goode2010-05-15
| | | | | | formatter kept generating type mismatch warnings. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26040 a1c6a512-1295-4272-9138-f99709370657
* Hopefully the last warningFrank Gevaerts2010-05-14
| | | | git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26036 a1c6a512-1295-4272-9138-f99709370657
* Fix various size_t related warnings and errorsFrank Gevaerts2010-05-14
| | | | git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26035 a1c6a512-1295-4272-9138-f99709370657
* cast ssize_t to longRafaël Carré2010-05-14
| | | | git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26033 a1c6a512-1295-4272-9138-f99709370657
* Move c/h files implementing/defining standard library stuff into a new libc ↵Thomas Martitz2010-05-06
| | | | | | | | directory, also standard'ify some parts of the code base (almost entirely #include fixes). This is to a) to cleanup firmware/common and firmware/include a bit, but also b) for Rockbox as an application which should use the host system's c library and headers, separating makes it easy to exclude our files from the build. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25850 a1c6a512-1295-4272-9138-f99709370657
* Make storage alignement use cache alignement macrosRafaël Carré2010-03-25
| | | | | | | | | | Introduce STORAGE_ALIGN_DOWN, STORAGE_PAD (using new CACHE_PAD) and STORAGE_OVERLAP (using new CACHE_OVERLAP), make them useful only when PROC_NEEDS_CACHEALIGN and STORAGE_NEEDS_ALIGN are defined Modify PP and nano2g system-target.h accordingly git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25336 a1c6a512-1295-4272-9138-f99709370657
* Use a helpfer function to avoid ugly casting and correct some data types (no ↵Thomas Martitz2010-02-20
| | | | | | functional change). git-svn-id: svn://svn.rockbox.org/rockbox/trunk@24790 a1c6a512-1295-4272-9138-f99709370657
* Hopefully fix yellow now, I don't understand why %ld works for ssize_t but ↵Thomas Martitz2010-02-18
| | | | | | %lu not for size_t (and still no warnings on my system). git-svn-id: svn://svn.rockbox.org/rockbox/trunk@24757 a1c6a512-1295-4272-9138-f99709370657
* Fix yellow caused by signedness.Thomas Martitz2010-02-18
| | | | git-svn-id: svn://svn.rockbox.org/rockbox/trunk@24756 a1c6a512-1295-4272-9138-f99709370657
* Fix FS#11004 - Buffering crashes when skipping back from end of song.Thomas Martitz2010-02-18
| | | | git-svn-id: svn://svn.rockbox.org/rockbox/trunk@24755 a1c6a512-1295-4272-9138-f99709370657
* Convert RINGBUF_* macros to inline functions, saving binsize and improving ↵Thomas Martitz2010-02-12
| | | | | | type safety. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@24618 a1c6a512-1295-4272-9138-f99709370657
* Align addresses in the buffering code to STORAGE_ALIGN_MASK if the target ↵Torne Wuff2010-02-01
| | | | | | | | | | | | | | | has one. The PP502x DMA controller can only deal with doing DMA to 16-byte-aligned addresses because we have inadequate control over the cache to prevent interference. Other targets may also *prefer* cacheline aligned DMAs to reduce the number of cache operations required. Almost all disk reads in buffering.c will now be suitably aligned, allowing DMA to be used on PP502x. Original change from FS#9708 by Boris Gjenero (dreamlayers). git-svn-id: svn://svn.rockbox.org/rockbox/trunk@24440 a1c6a512-1295-4272-9138-f99709370657