diff options
author | Bent Bisballe Nyeng <deva@aasimon.org> | 2015-04-12 08:25:39 +0200 |
---|---|---|
committer | Bent Bisballe Nyeng <deva@aasimon.org> | 2016-01-20 13:23:12 +0100 |
commit | b54e3f4433fb6c74db1f1451babf0650afdcab14 (patch) | |
tree | 4f631d6bddc493fefda0be180634224e26f2b4b2 /src/cachemanager.cc | |
parent | 6bf5332db34b4e76f52ef321fcf70d67872782dd (diff) |
Fix bad buffer pointers.
Diffstat (limited to 'src/cachemanager.cc')
-rw-r--r-- | src/cachemanager.cc | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/cachemanager.cc b/src/cachemanager.cc index 9288ed1..0f84f8c 100644 --- a/src/cachemanager.cc +++ b/src/cachemanager.cc @@ -116,7 +116,7 @@ sample_t *CacheManager::open(AudioFile *file, size_t initial_samples_needed, int localcache[id] = c.front; if(initial_samples_needed < file->size) { - event_t e = createLoadNextEvent(id, c.pos, &c.back); + event_t e = createLoadNextEvent(id, c.pos, &id2cache[id].back); pushEvent(e); } @@ -144,12 +144,13 @@ void CacheManager::close(cacheid_t id) CacheManager::cache_t CacheManager::getNextCache(cacheid_t id) { MutexAutolock l(m_caches); - cache_t c = id2cache[id]; + cache_t &c = id2cache[id]; - sample_t *tmp = id2cache[id].front; - id2cache[id].front = c.back; - id2cache[id].back = tmp; - id2cache[id].pos += CHUNKSIZE; + sample_t *tmp = c.front; + c.front = c.back; + c.back = tmp; + + c.pos += CHUNKSIZE; return c; } @@ -173,7 +174,7 @@ sample_t *CacheManager::next(cacheid_t id, size_t &size) localcache[id] = c.front; if(c.pos < c.file->size) { - event_t e = createLoadNextEvent(id, c.pos + CHUNKSIZE, &c.back); + event_t e = createLoadNextEvent(id, c.pos + CHUNKSIZE, &id2cache[id].back); pushEvent(e); } |