|
12216 | Rockbox | Bugs | Operating System/Drivers | Low | Dircache shuts down when closing a file that was opened ... | 2011-08-03 | |
Task Description
The dircache shuts down (resets dircache_initialized to false) when it encounters files it does not know about, assuming a dircache inconsistency. One of the reasons for shutting down the dircache is when it encounters a file handle it doesn’t know about. To prevent this from happening, the dircache maintains a mapping between file handles and file names, which is maintained even when the dircache is not fully operating yet during the boot phase (by way of a small temporary cache array).
The problem is that this scheme has a few holes that allow files to be open without the dircache knowing about it: 1. When dircache_initializing is not set, the temporary cache is not maintained and newly opened files will slip through. 2. When the dircache is disabled and later re-enabled, open-file mappings that were active during the first dircache instance are not carried over to the new instance.
Both cases occur frequently when reloading the dircache after updating the database, which defaults to disabling the dircache and using the dircache buffer for its commit phase, and then reloading the dircache. The most common case I see is when playback is active during the automatic DB update (Resume Playback is my startup screen). When I wait for the DB update and dircache reload to complete and then start a new playlist from the database, the playlist-control file (I believe) is closed. The new dircache instance does not know that this file was open before and shuts down (in update_filesize). (With current SVN, this later causes the DB browser to crash, but that’s a different story.)
I’m wondering what the best way to keep the dircache online would be. Some ideas:
* When the dircache shuts down, save the current list of bindings to the temporary cache, to be reloaded when the new instance starts up. Also set dircache_initializing = true, and reset it only when the temporary cache overflows). This would require a few more entries in the temporary cache than the current two.
* Recover the bindings from the FAT filesystem layer, or maybe even generally store them there. This layer already has a list of open files, but currently does not store a file-descriptor binding. Unfortunately, this solution does not work for hosted platforms.
* Make the dircache resilient against unknown file-descriptor bindings. It’s somewhat unclear to me how that could work, as each handle-based update that we ignore and just pass through to the filesystem creates a dircache inconsistency.
Thoughts?
|
|
12179 | Rockbox | Bugs | Simulator | Low | Simulator build fails when using "configure --sdl-threa ... | 2011-07-04 | |
Task Description
I get the following build error:
CC apps/pcmbuf.c /home/mhohmuth/priv/src/rockbox/rockbox/apps/pcmbuf.c: In function ‘pcmbuf_fade’: /home/mhohmuth/priv/src/rockbox/rockbox/apps/pcmbuf.c:1122:9: warning: implicit declaration of function ‘thread_set_priority’ LD rockboxui /home/mhohmuth/priv/src/rockbox/rockbox/build.sim/apps/pcmbuf.o: In function `pcmbuf_fade’: /home/mhohmuth/priv/src/rockbox/rockbox/apps/pcmbuf.c:1122: undefined reference to `thread_set_priority’ /home/mhohmuth/priv/src/rockbox/rockbox/apps/pcmbuf.c:1143: undefined reference to `thread_set_priority’ collect2: ld returned 1 exit status
The offending source-code lines were introduced as part of the audio-mixer commit, r30097.
|
|
12178 | Rockbox | Bugs | Build environment | Low | make reconf in simulator build directory forgets config ... | 2011-07-04 | |
Task Description
In a simulator build directory set up with “../tools/configure –sdl-threads”, a “make reconf” forgets the –sdl-threads setting and configures the build to use sigaltstack threads instead.
|
|
12132 | Rockbox | Patches | Database | Low | tagnavi: Support "basename" in formats and conditions; ... | 2011-05-28 | 10 |
Task Description
This patch set (in patch 0006) adds support to the tagnavi.config syntax for using a file’s basename (path name without directories) in display formats and conditions.
Patch 0007 changes the database’s default title format to display a file’s basename rather than “<Untagged>” if no title tag is present in the file.
In passing, patch 0001 fixes two bugs introduced with r26192 ( FS#10976 - make the <Untagged> string translatable):
* The translation was done too early: before the tagnavi format clauses were checked. This prevented comparisons against “<Untagged>” when a non-English translation was active. * The code overwrote the buffer containing the constant string “<Untagged>” with the translation. This is neither safe nor necessary: The result pointer simply can be swapped with a pointer to the translation.
Patches 0002–0005 contain various minor DB cleanups the other patches rely on. (I’ll commit the fixes and cleanups separately from the basename feature after some testing.)
Patches relative to r29928.
|
|
12107 | Rockbox | Patches | Database | Low | Remove track-number generation heuristic from database | 2011-05-10 | 1 |
Task Description
The database has a feature that generates a track number from a track’s file name in case that information is missing from the tags. This track number is used solely in the database for displaying and sorting views displaying collections of tracks (such as album views).
The track number is assumed to be the last pair of digits in the file’s basename (sans the filename extension after the last “.”). I find this heuristic rather problematic for two reasons: Given there’s no track-number tag, (1) it assigns spurious track numbers for titles including multiple digits, and (2) typically I’d expect the track number to appear at the beginning of the filename, not at its end.
The attached experimental patch removes the track-number generation feature entirely. In result, tracks without a track-number tag are displayed without a track number and alphanumerically sorted by track title (not filename!).
This has the following effects:
* For tracks that do have a track number in their tags, nothing changes.
* For tracks that have no track number in either the tags or the file name, no spurious track number is generated and used for displaying / sorting. These tracks are now sorted by track title (the tagnavi.config default).
* For tracks that do have a track number in their file name (but not in their tags), this information is not used any longer and the tracks are now sorted by track title as well.
Arguably, tracks without a track-number tag by default could be sorted by the pathname of files, which often are organized and named in the intended track order. But this could be confusing as well and seems like just a another heuristic that’s prone to break. Also, users can use the file browser or define their own filename-based %format sort in tagnavi.conf. I’d argue against making this the default for DB views.
Please comment on which behavior you find most desirable. Thanks!
|
|
12095 | Rockbox | Patches | Database | Low | Logical-or operator for tagnavi conditionals | 2011-05-03 | 2 |
Task Description
This patch adds a logical-or operator (”|”) for tagnavi conditionals.
Logical-and (”&”) always takes precedence over logical-or. (Brackets are not supported.)
Example:
“Unfinished Podcasts” → album ? filename ^ “/<microSD1>/PODCASTS” & playcount == “0” | filename ^ “/<microSD1>/PODCASTS” & lastoffset > “0” → title = “fmt_title”
|
|
12073 | Rockbox | Patches | Database | Low | Dynamically add files to database as they are played | 2011-04-18 | 2 |
Task Description
These experimental patches dynamically add new tracks to the database when they are played. This allows users who (for various reasons [1]) prefer to not fully initialize the database to take advantage of database-based features such as autoresume (remember a resume position for each file), runtime statistics, or track ratings.
The current patch set is only a prototype. It's still somewhat inefficient because it does a full database commit and reload for each new track that is played.
The actual database-extension patch (patch 0002) works by refactoring tagcache_build to create a new interface, tagcache_add_file, that adds a single file to the database. This new function runs in the database thread and takes a dircache_entry pointer, which is provided by way of a Q_UPDATE event. The audio thread generates this event in tagtree_buffer_event when the initial DB lookup fails, and later checks the database again in tagtree_track_finish_event. If the DB commit and reload have succeeded in the meantime, this second lookup will succeed and the runtime information the user is interested in (stats, resume info) can be stored in the DB.
Patch 0001 changes the DB commit's buffer-allocation preference from using the dircache buffer to using the RAM DB's buffer. (This used to be the preference until r10003 reversed it, supposedly because the dircache buffer typically is bigger. I don't know yet how valid this argument is today.) This reversal avoids needlessly flushing and refilling the dircache and makes the Q_UPDATE event-passing mechanism more robust (because in-flight update events contain dircache_entry pointers, which would have to be invalidated when the dircache is flushed – which is not done yet).
Current limitations/caveats: * Requires dircache and Load-DB-to-RAM enabled (and only works on targets that include these features) * tagcache_add_file does not respect any database.[un]ignore files in the directory hierarchy above the added new file. * DB needs to be initialized to begin with. There's no UI function for a basic DB initialization (without scanning and adding all files) yet. * Not very thoroughly tested (mostly in simulator, with small file sets)
Possible improvements: * Delay committing DB changes if more track-add events are in the tagcache queue * Incremental commit: Could be optimized for add-one-track case * Incremental load_tagcache: Avoid flushing and reloading full database * Add function to initialize an empty DB
Comments welcome!
Footnote: [1] Reasons for not using the database, or not keeping it up to date, include: metadata parser instability; prefer not keep tags up to date; prefer file browser over database browser
|
|
12054 | Rockbox | Patches | Database | Low | Highlight each album's last-played track in database vi... | 2011-04-07 | 3 |
Task Description
The attached proof-of-concept patch highlights (places the cursor at) each album's last-played track in database views. The intention is to allow easy resuming of multi-track audiobooks or podcasts where they were last left off. This works best when autoresume has also been enabled.
The patch relies on runtime statistics gathering being enabled (and the DB needs to be enables as well, of course).
The current patch has some caveats that I plan to address in future revisions:
Right now, it's unconditionally enabled for all database-based track views. We might consider allowing to turn this off for regular music albums.
When the last-played track has been completed (played through to its end), we should actually highlight the next track (or the first track if the last-played track was the final track of the album). [EDIT: fixed – see latest patch in comments section]
It would be great if a similar feature was available for the file browser. I'd find it acceptable if that would require the DB as well (as that's the place where the last-played info is stored). It could benefit from an add-to-DB-as-files-are-played feature (aka FS#12073).
Comments?
[EDIT: Clarified summary. Fixed a rather severe bug in the patch to make it actually work. :) ] [ EDIT 2: Linked to FS#12073. Addressed one caveat. ]
|
|
12003 | Rockbox | Bugs | Build environment | Low | langtool.pl --deprecate is broken | 2011-03-09 | 1 |
Task Description
“langtool.pl –deprecate” does not deprecate strings correctly. Currently, it replaces each string with “none” (without the quotes) and deletes value of the “user:” attribute. Doing it this way effectively removes the string ID and renumbers all subsequent IDs. This definitely is wrong for the english.lang (master) file, as it breaks voice files and compiled translations. (I’m not sure whether it’s a good thing to do for any other lang file.)
As per IRC wisdom, the correct way to deprecate a lang ID seems to be to change each string to “”“” (the double-quoted empty string). In this case, genlang also requires a value in the “user:” attribute, so I suggest not deleting this value.
(Apparently, changing the strings to “deprecated” used to be supported as well, but that is currently rejected by genlang.)
|
|
12001 | Rockbox | Bugs | Drivers | Medium | Rockbox USB on ClipV2 conflicts with r29169 | 2011-03-08 | 2 |
Task Description
Enabling Rockbox USB on the ClipV2 (with attached patch 0001) has been very stable for me recently (since r29146, to be exact). I also do not need the hard-reset workaround from FS#11664 .
But… for reasons I do not understand, r29169 (AMSv2 SD: Fix card insert lockups in USB mode; by jhMikeS) breaks USB for me, and I had to back this change out. Interestingly, the code in question addresses an SD-card issue, but the ClipV2 does not have an SD-card slot.
The symptom is occasional SCSI errors on my Linux host trying to read certain sectors. fsck.vfat fails with an I/O error attempting to read a high-numbered sector (possibly the MBR backup sector).
For the convenience of users who’d like to try Rockbox USB on the ClipV2, the attached patches enable USB (patch 0001) and revert r29169 (patch 0002).
|
|
11991 | Rockbox | Bugs | Codecs | Medium | MP4 playback broken | 2011-03-04 | |
Task Description
Rockbox on my ClipV2 cannot play back (at least certain) MPEG-4 audio files. When these files are encountered in the playlist, playback skips over them. In that instant I can see that the track metadata is displayed correctly in the WPS, and it is also correct in the database.
Sometimes skipping over the “broken” tracks even hangs playback totally, with a subsequent non-mp4 file stuck at 0:00, requiring a stop + resume. Sometimes, I see a “codec error” splash for a couple of milliseconds when the files are skipped.
I have tested various revisions between SVN current and r28308 (a pre-3.7 revision), and all show the same behavior.
Here are two files I’ve encountered this problem with: (warning, large podcast tracks)
http://www.club-autonomic.com/podcast/autonomic_podcast_layer_11.m4a
http://www.club-autonomic.com/podcast/autonomic_podcast_layer_12.m4a
These files seem to play fine in the simulator.
However, one really strange thing I’ve encountered is that the simulator pauses playback after playing back the file for a few minutes. I can then manually unpause to resume playback of the track. This may be a related or totally unrelated problem.
This mailing-list report may be related:
http://www.rockbox.org/mail/archive/rockbox-archive-2011-03/0011.shtml
|
|
11977 | Rockbox | Patches | User Interface | Low | autoresume: Add option to prevent accidental rewind to ... | 2011-03-01 | 1 |
Task Description
Split out from FS#11748 .
This patch adds an option to prevent rewinding to the beginning of a track to avoid losing the current playback and resume position by accidentally pressing the Left key. Instead, Left always directly skips back to the previous track. This behavior can be enabled for all tracks or only for those tracks that can be autoresumed on automatic track change (which already is separately configurable).
I'm dropping this patch here for now because I see little chance right now of this being accepted into the trunk. Some developers have complained about the considerable configuration complexity of autoresume as it is, and although this additional behavior can be convenient, there is no ultimate need for it because the resume position prior to the rewind to 0:00 is preserved as long as another skip occurs within the first 15 seconds of the rewound track's playback (for example, by pressing Left again to skip to the previous track).
This change was originally contributed by Dave Slusher in FS#11748 . I just added the configuration logic.
Patch relative to r29484.
|
|
11975 | Rockbox | Patches | User Interface | Low | Apply "Backlight on first keypress" only for certain ke... | 2011-02-28 | 1 |
Task Description
I didn't like that the "Backlight on first keypress" function ignores the first keypress no matter which key was pressed. For example, I want the volume keys to work normally even when the backlight is off (that is, they should turn on the backlight *and* change the volume).
This patch restricts "Backlight on first keypress" to certain buttons only. in other words, these buttons work normally only when the backlight is on; otherwise, they just turn on the backlight. As a proof of concept, it changes the Clip and Clip+ behavior to filter out only the Home key when the backlight is off, allowing the other keys to function normally.
It works by allowing button-target.h to define the buttons that are filtered by the "Backlight on first keypress" function. If left undefined, the function filters all buttons when the backlight is off, as in the status quo.
[EDIT: Clarified that there is no overlap with FS#9305 - Context sensitive backlight on key press]
|
|
11915 | Rockbox | Bugs | Drivers | Low | Background noise with Sansa ClipV2 | 2011-01-31 | 8 |
Task Description
[EDIT: Attached patch for experimenting with AS3543 settings.]
When playing back audio on a Sansa ClipV2 player, there is a regular background noise that’s audible with sensitive headphones and that’s quite annoying during quite music passages. The background noise is a hissing sound that repeats about 4 times per second. The noise can be heard when there is no disk activity and even at very low volume or when playback is muted. It stops as soon as audio is paused.
The noise is not present in the original firmware (OF).
This is a long-known issue, but hasn’t been formally tracked before. It is related to FS#11907, but different in that the background noise is present when there’s no disk (SD) activity. However, I did have the impression that disk activity intensifies the noise.
This item serves to collect the various approaches people have tried to eliminate the noise, and ideas for future exploration.
I ran a series of experiments on the assumption that the audio hardware is misconfigured is some way. I worked through various settings of the AS3543 component based on its datasheet. Here is what I have tried; but nothing helped to eliminate the noise:
* Higher-quality audio settings as proposed in FS#11304 (AUDIOSET2_HPH_QUALITY_HIGH, Disabled DAC gain control Bypassed mixer and disabled mixer gain control (HPH_OUT_R_HP_OUT_DAC, AUDIOSET2_AGC_off, Mute SDI data Enable and control DAC attenuation Disable common mode buffer (phantom ground) Disabled various unused mixer components (AUDIOSET3_MICMIX_off, AUDIOSET3_ADCMIX_off, Used external clock source for DAC Enable headphone detection Resetting all reserved audio registers to 0
[EDIT: I have attached a patch that allows experimenting with these settings by uncommenting the relevant source lines at compile time or extending the provided debug function to toggle the setting at run time.]
Possible next steps (suggested by various people on IRC):
* As the noise is not present on the other AMSv2 targets (Clip+, FuzeV2), a dump of the AS3543 settings (as3514_regs[] array) on these targets would be helpful. I have attached a patch that adds a debug-menu function for doing this (needs a logf build).
* Someone with a JTAG could read the AS3543 configuration set by the OF.
* The issue could be unrelated to the AS3543; it could be a power-management or frequency-scaling issue.
Also attached: A dump of as3514_regs[] (logf.txt; all values in I’ve removed the patch to dump these settings; see a later comment in this task for a more up-to-date patch to do this.]
Other ideas?
|
|
11908 | Rockbox | Bugs | Drivers | Low | Sansa ClipV2: Panic: Unhandled masked IRQ for INT_USB | 2011-01-26 | |
Task Description
Observed with r29143 with enabled USB driver ( FS#11664 ):
During an USB transfer, my ClipV2 shows:
*PANIC* Unhandled masked IRQ 03: INT_USB (status 0x00000008).
I suspect that r29130 is to blame. I'll run without this patch for a few days and see what happens.
|
|
11885 | Rockbox | Patches | Operating System/Drivers | Low | Whitespace fixes | 2011-01-17 | 3 |
Task Description
Here are fixes for various whitespace errors I’ve encountered in my journeys through the source code. I find the first one especially nasty. The second one is rather benign, the third one is somewhat misleading.
Patches relative to r29071 attached.
|
|
11883 | Rockbox | Patches | Operating System/Drivers | Low | Close all files and safely unmount disks before enterin... | 2011-01-16 | 5 |
Task Description
The attached patch implements a clean disk unmount by way of the following changes:
Patch 1: Allow disk_unmount_all to close all files and flush dirty buffers when unmounting a filesystem. (Before, we've been calling disk_unmount, which does not flush buffers because it's written to handle user-ejected storage media that aren't accessible any more.)
Patch 2: Call disk_unmount_all in the power-down and reboot paths.
Patch 3: Fix write to detect a bad file handle.
(Split out from FS#11877, in which I first theorized that an unclean filesystem may be responsible for some filesystem corruption I'm seeing, but which turned out to be a deeper problem. Related to r28693 / FS#11774 , in which we introduced disk unmounting before entering USB mode.)
|
|
11880 | Rockbox | Patches | Build environment | Low | Include git commit ID in version string | 2011-01-16 | 1 |
Task Description
Better version reporting for git-tracked repositories: Include the git commit ID in the version string, much like is done for repos tracked with bzr.
|
|
11877 | Rockbox | Bugs | Operating System/Drivers | Low | Filesystem corruption after entering USB mode | 2011-01-14 | 2 |
Task Description
Various users on IRC recently reported cases of filesystem corruption. I have seen them as well, especially when using USB mode (I'm using a Sansa ClipV2, USB-enabled through FS#11664 ).
One strangeness I've experienced is that when my system has detected filesystem corruption, it is often enough to remove the player from USB and then replug it, without repairing the filesystem and without rebooting Rockbox; on the next USB mount, the filesystem is clean. This might indicate that some buffer is flushed too late for the USB host to see.
[EDIT: Removed previously attached patch, which is now tracked separately as FS#11883.]
|
|
11873 | Rockbox | Bugs | Operating System/Drivers | Low | shutdown_hw waits for disk spindown twice | 2011-01-13 | |
Task Description
SVN r29045
firmware/powermgmt.c:shutdown_hw() contains the following code snippet twice:
while (storage_disk_is_active())
sleep(HZ/10);
This looks bogus to me.
|
|
11774 | Rockbox | Bugs | Drivers | Low | Unmount all disks before entering USB slave mode to pre ... | 2010-11-24 | 2 |
Task Description
I recently enabled Rockbox-native USB slave mode on my Sansa ClipV2 through the patch provided in FS#11664 - Workaround for usb random failures on amsv2. Ever since then, I have had very stable USB connections, but regular filesystem corruption on the player’s flash drive. This had never happened before, when I still was had to boot into the OF to use its USB support.
As I allow Rockbox to write to my disk for various reasons, such as scrobbler logging and database statistics updates. Also, my flash drive is fairly full, leading to frequent disk-block reallocation. Thus I suspected that either (1) the filesystem wasn’t fully flushed when USB slave mode was entered, or (2) that Rockbox was using stale filesystem data after returning from USB slave mode that would later lead to filesystem corruption. I slightly lean towards explanation 2, because I never observed filesystem corruption when powering off Rockbox (to use the OF’s USB support) even though the shutdown code does not unmount the disks either, AFAIK.
As an experiment, I added support for unmounting all disks before entering USB slave mode – see attached patch. I’ve been running with this patch for a week now, and I haven’t seen any filesystem corruption since then.
Comments?
|
|
11748 | Rockbox | Patches | Music playback | Low | Automatic multi-resume feature: Remember and restore re ... | 2010-11-11 | 25 |
Task Description
Testers / comments wanted!
This experimental patch adds an automatic multi-resume feature that supports complex listening habits, such as skipping back and forth among multiple half-played tracks. It automatically remembers and restores a resume position for each track without user intervention, without relying on the bookmarking system and without requiring any special navigation; resuming works whichever way a track is found (file browser, database, playlist).
The feature is modeled after the podcast/audiobook resume feature of the Sansa ClipV2 / Clip+, IMHO the sole feature of the original Sansa firmware that was better than what Rockbox has. This implementation is more generic, though, and works for all tracks.
In summary, it works like this: Whenever playback of a track is stopped, the current playback offset is stored in the tag database. (The offset is reset if a track is played all the way to its end.) The offset is restored whenever a track is played back again, except for short tracks in case of an automatic song change.
This patch is experimental as it hard-codes some of the behavior and isn’t factored out terribly well. Although I have thoroughly tested the feature, I seem to never have triggered execution of some parts of the patch, especially the changes to tagcache_fill_tags and build_numeric_indices. I am requesting feedback on whether these changes make any sense at all.
Furthermore, this patch relies on a few bug fixes to the tag database (see FS#11721 , FS#11722 , and FS#11723 ). I am attaching to this report another patch that fixes all three bugs for your convenience.
Caveats:
* Only works if runtime statistics have been enabled. Ideally the resume feature would be independent from runtime statistics; perhaps it should be implemented as a separate consumer of the PLAYBACK_EVENT_TRACK_BUFFER and PLAYBACK_EVENT_TRACK_FINISH events.
* Always resumes tracks if possible (under the condition mentioned in the next caveat). If a resume is unwanted, the user can always press the “skip back” button to play the track from the beginning. This should be configurable (always/never/ask user).
* Hard-coded resume behavior: On automatic track change, the next track will be resumed at its resume position if the track is longer than 20 minutes (assuming it is a partially played podcast/audiobook); otherwise, the track will be started anew (assuming a mid-track playback stop for an album track). This feature and its threshold should be configurable.
|
|
11723 | Rockbox | Bugs | Database | Low | Tagcache returns stale numeric (runtime statistics) dat ... | 2010-11-04 | 2 |
Task Description
The problem is that tagcache_update_numeric queues database updates using tagcache.c’s command_queue, whereas tagcache_get_numeric consults the database directly without consulting the command_queue. This can lead to lost updates when pending changes have not yet been processed and committed.
I was able to reproduce this problem with my Sansa ClipV2, but not with the simulator, presumably because of a different thread schedule due to my PC’s better horsepower.
To reproduce, I have been jumping back and forth between two tracks of a playlist. The following slightly edited logf output shows the buffer and unbuffer events (“be:”, “ube:”) logged by tagtree_buffer_event and tagtree_track_finish_event, respectively, along with the playcount read from and written to the tagcache by these functions:
be:/PODCASTS/foo.mp3
-> 3
[...]
ube:/PODCASTS/foo.mp3
-> 4
[...]
be:/PODCASTS/bar.mp3
-> 4
[...]
ube:/PODCASTS/bar.mp3
-> 5
[...]
be:/PODCASTS/foo.mp3
-> 3
[...]
ube:/PODCASTS/foo.mp3
-> 4
[...]
be:/PODCASTS/bar.mp3
-> 4
[...]
ube:/PODCASTS/bar.mp3
-> 5
[...]
As you can see, tagtree_track_finish_event increments the playcount each time, but the next tagtree_buffer_event for the same track reads the old, stale playcount again.
I have considered three solutions to this problem:
1. Flush the command queue in tagcache_get_numeric with a call to run_command_queue(true).
2. Update the in-memory database synchronously in tagcache_update_numeric, and queue only updates to the on-disk database in the command_queue.
3. Store-to-load forwarding: In tagcache_get_numeric, consult the command queue for uncommitted updates to the tag being read.
Solution 1, while simple, also is the most inefficient one as it delays all tagcache reads until all writes have been committed. Also, I encountered the occasional lockup during background database updates – not quote sure why, though.
I was able to implement Solution 2 after some refactoring. Unfortunately, this solution is incomplete: It depends on the in-memory database, and it can fail if the tag being updated has not been loaded into memory yet.
I ended up with Solution 3 (patch attached). It may not be the shortest solution, but it is the most elegant one, as it does not alter the tagcache’s update policy and is complete nonetheless.
(You may wonder why I am so interested in tagcache accuracy (see also FS#11721 and FS#11722 ) – after all, this is only statistics data? The answer is that I am working on another use case for the tag cache that requires accuracy: I am using the tagcache as the ultimate resume database, which allows resuming every track at its last-played position, independent of the navigation mechanism used to access the track (no file browser / bookmarking system needed).)
|
|
11722 | Rockbox | Bugs | Database | Low | Runtime statistics data not gathered for first song pla ... | 2010-11-04 | 1 |
Task Description
The reason is that, depending on the thread scheduling, the tagtree_buffer_event function may attempt to access the tagcache before it is initialized.
I could reproduce this problem on my Sansa ClipV2, but not with the simulator, which had a slightly different schedule during startup.
When problem occurs, the debug logfiles shows this:
load track: /PODCASTS/foo.mp3
codec < Q_CODEC_LOAD_DISK
be:/PODCASTS/foo.mp3
tc stat: not found: /PODCASTS/foo.mp3
[...]
loading tagcache to ram...
tagcache loaded into ram!
[...]
Request new track
codec >| audio Q_AUDIO_CHECK_NEW_TRACK
audio < Q_AUDIO_CHECK_NEW_TRACK
No tagcache index pointer found
As you can see, the tagcache is initialized after the first song is buffered. The “tc stat: not found” message is generated by tagtree_buffer_event, and the “No tagcache index pointer found” message is generated by tagtree_track_finish_event.
The attached patch fixes the problem by deferring the use of the tagcache until it has been initialized.
|
|
11721 | Rockbox | Bugs | Database | Low | Runtime statistics data not gathered when playback stop ... | 2010-11-04 | 3 |
Task Description
Runtime data gathering in tagtree_buffer_event / tagtree_track_finish_event (tagtree.cc) relies on the PLAYBACK_EVENT_TRACK_BUFFER and PLAYBACK_EVENT_TRACK_FINISH events. The latter event is generated only on a song change, but not when playback stops (user stops playback, poweroff, or end of playlist). This leads to statistics not being updated and old statistics data being loaded again next time a previously stopped song is played.
To reproduce, turn on logf and observe the “be:” (buffer event) and “ube:” (unbuffer event) messages in the debug log. Stopping playback does not generate a “ube:” message.
The attached patch fixes this behavior by generating the PLAYBACK_EVENT_TRACK_FINISH event from the audio_stop_playback function as well.
|