fixed crash when switching streams

This commit is contained in:
badaix 2016-02-06 12:51:20 +01:00
parent 060e52aeee
commit 3a5af32d98
5 changed files with 14 additions and 2 deletions

View file

@ -50,6 +50,7 @@ FlacDecoder::FlacDecoder() : Decoder()
FlacDecoder::~FlacDecoder()
{
std::lock_guard<std::mutex> lock(mutex_);
delete flacChunk;
delete decoder;
}
@ -57,6 +58,7 @@ FlacDecoder::~FlacDecoder()
bool FlacDecoder::decode(msg::PcmChunk* chunk)
{
std::lock_guard<std::mutex> lock(mutex_);
cacheInfo_.reset();
pcmChunk = chunk;
flacChunk->payload = (char*)realloc(flacChunk->payload, chunk->payloadSize);