diff options
author | Daniel Schürmann <daschuer@mixxx.org> | 2019-10-03 11:55:08 +0200 |
---|---|---|
committer | Daniel Schürmann <daschuer@mixxx.org> | 2019-10-03 11:55:08 +0200 |
commit | 26dd7ce9c1fee7ef2bb5fa58e33f0de8e8d39e29 (patch) | |
tree | 6ca71346e67c2013985aabedc83c78e73476b457 /src | |
parent | d02ae6fb839ac032f7f51308c7fd79524b5a2a08 (diff) |
Reorder calls for a better documentation. Don't clean up chunks before a new track has been loaded.
Diffstat (limited to 'src')
-rw-r--r-- | src/engine/cachingreader.cpp | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/src/engine/cachingreader.cpp b/src/engine/cachingreader.cpp index 3dea1f0f53..baa54ab9bd 100644 --- a/src/engine/cachingreader.cpp +++ b/src/engine/cachingreader.cpp @@ -249,19 +249,23 @@ void CachingReader::process() { } } else { // State update (without a chunk) - // We have a new Track, discharge the chunks from the old track. - freeAllChunks(); - DEBUG_ASSERT(!m_mruCachingReaderChunk); - DEBUG_ASSERT(!m_lruCachingReaderChunk); - // Reset the readable frame index range - m_readableFrameIndexRange = update.readableFrameIndexRange(); if (update.status == TRACK_LOADED) { + // We have a new Track ready to go. + // Assert that we had STATE_TRACK_LOADING before and all old chunks + // in the m_readerStatusUpdateFIFO have been discarded. DEBUG_ASSERT(m_state.load() == STATE_TRACK_LOADING); + // now purge also the recently used chunk list from the old track. + freeAllChunks(); + DEBUG_ASSERT(!m_mruCachingReaderChunk); + DEBUG_ASSERT(!m_lruCachingReaderChunk); + // Reset the readable frame index range + m_readableFrameIndexRange = update.readableFrameIndexRange(); m_state.storeRelease(STATE_TRACK_LOADED); } else { DEBUG_ASSERT(update.status == TRACK_UNLOADED); // This message could be processed later when a new - // track is already loading! + // track is already loading! In this case the TRACK_LOADED will + // be the very next status update. if (!m_state.testAndSetRelease(STATE_TRACK_UNLOADING, STATE_IDLE)) { DEBUG_ASSERT(m_state.load() == STATE_TRACK_LOADING); } |