DecoderThread: move code to destructor

This commit is contained in:
Max Kellermann
2013-01-04 22:02:52 +01:00
parent ac6803e7b7
commit 7267558ba1
3 changed files with 26 additions and 14 deletions

View File

@@ -24,10 +24,31 @@
#include "MusicBuffer.hxx"
#include "MusicChunk.hxx"
extern "C" {
#include "tag.h"
}
#include "input_stream.h"
#include <assert.h>
decoder::~decoder()
{
/* caller must flush the chunk */
assert(chunk == nullptr);
if (song_tag != nullptr)
tag_free(song_tag);
if (stream_tag != nullptr)
tag_free(stream_tag);
if (decoder_tag != nullptr)
tag_free(decoder_tag);
pcm_convert_deinit(&conv_state);
}
/**
* All chunks are full of decoded data; wait for the player to free
* one.