Skip to content

Commit

Permalink
FLACDecoder begin() check state
Browse files Browse the repository at this point in the history
  • Loading branch information
pschatzmann committed Jun 20, 2024
1 parent 9ce1898 commit cc4ed39
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/AudioCodecs/CodecFLAC.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ class FLACDecoder : public StreamingDecoder {

bool begin() {
TRACEI();
is_active = false;
if (decoder == nullptr) {
if ((decoder = FLAC__stream_decoder_new()) == NULL) {
LOGE("ERROR: allocating decoder");
Expand All @@ -70,9 +71,9 @@ class FLACDecoder : public StreamingDecoder {
}

// if it is already active we close it
if (is_active){
auto state = FLAC__stream_decoder_get_state(decoder);
if (state != FLAC__STREAM_DECODER_UNINITIALIZED){
FLAC__stream_decoder_finish(decoder);
is_active = false;
}

// deactivate md5 checking
Expand Down

0 comments on commit cc4ed39

Please sign in to comment.