summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2017-03-25 14:57:24 +0100
committerBent Bisballe Nyeng <deva@aasimon.org>2017-03-25 14:57:24 +0100
commita56b3d5eac05d0f51757d510553ad2d23b60235b (patch)
treef5c485d022c914e3da92925634780d28c49af877
parent6c5b062ba00388951b67dc1ea555dc6ad8af4ede (diff)
Fix crash on multiple stop/start command due to invalid pointer returned to the engine from the diskstreamer.
-rw-r--r--src/audiocache.cc4
-rw-r--r--src/audiocache.h1
2 files changed, 3 insertions, 2 deletions
diff --git a/src/audiocache.cc b/src/audiocache.cc
index a5fb0db..a366423 100644
--- a/src/audiocache.cc
+++ b/src/audiocache.cc
@@ -168,7 +168,6 @@ sample_t* AudioCache::next(cacheid_t id, size_t& size)
}
c.localpos += framesize;
-
return s;
}
@@ -255,10 +254,11 @@ void AudioCache::setFrameSize(size_t framesize)
// NOTE: Not threaded...
//std::lock_guard<AudioCacheIDManager> id_manager_lock(id_manager);
- if(framesize > this->framesize)
+ if(framesize > nodata_framesize)
{
delete[] nodata;
nodata = new sample_t[framesize];
+ nodata_framesize = framesize;
for(size_t i = 0; i < framesize; ++i)
{
diff --git a/src/audiocache.h b/src/audiocache.h
index 5a4577f..d0be509 100644
--- a/src/audiocache.h
+++ b/src/audiocache.h
@@ -106,6 +106,7 @@ public:
private:
size_t framesize{0};
sample_t* nodata{nullptr};
+ size_t nodata_framesize{0};
size_t number_of_underruns{0};
AudioCacheIDManager id_manager;