CachingReader block the player thread while it is caching
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Mixxx |
Fix Released
|
Critical
|
RJ Skerry-Ryan |
Bug Description
In the current implementation of CachingReader run() take the lock and process the whole queue of chunks to cache in a single go. If the queue is large enough this eventually block the playback thread because it need the lock to read data from the cache.
Ideally the CachingReader should be made such that reading access is non blocking as long as the data is in the cache. However as it mean a near complete re-write I first tried a workaround that can be found in the attached patch. It simply change the caching thread to release the lock and yield between each read. This give a chance
to the playing thread to get at its data in a reasonable time.
I also changed the data type for the chunk queue from a QSet to a QList to make sure that the queued chunks are kept in the order they were inserted.
Additionally it should be noted that the ReadAheadManager request quiet a lot of data in advance, up to several seconds as far as i can tell. Combined with the above problem this lead to audio skips on every track load or seek with slower machines. So I also reduced the pre-read blocks from 64 to 4, again this is just a workaround, ideally the number of blocks should be computed to give a fix time amount.
This seems to be the problem behind bug #666052, and this patch allow me to use mixxx on my netbook again :)
Changed in mixxx: | |
status: | New → Confirmed |
importance: | Undecided → Critical |
assignee: | nobody → Alban (albeu) |
Changed in mixxx: | |
milestone: | none → 1.10.0 |
Changed in mixxx: | |
status: | Confirmed → Triaged |
Changed in mixxx: | |
status: | Fix Committed → Fix Released |
Even on my fast system this patch lets me cut the latency nearly in half. I'll keep testing, and Bill will want to take a look I'm sure, but this is very promising.