Skip to content

Commit 72d7edc

Browse files
committed
FLACDecoderFoxen begin() reset memory
1 parent daee734 commit 72d7edc

File tree

1 file changed

+8
-11
lines changed

1 file changed

+8
-11
lines changed

src/AudioTools/AudioCodecs/CodecFLACFoxen.h

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -34,24 +34,21 @@ class FLACDecoderFoxen : public AudioDecoder {
3434
bool begin() {
3535
TRACEI();
3636
is_active = false;
37-
if (flac == nullptr) {
38-
size_t foxen_size = fx_flac_size(max_block_size, max_channels);
39-
if (foxen_size > 0) {
40-
foxen_data.resize(foxen_size);
41-
}
42-
if (foxen_data.data() != nullptr) {
43-
flac = fx_flac_init(foxen_data.data(), max_block_size, max_channels);
44-
}
37+
size_t foxen_size = fx_flac_size(max_block_size, max_channels);
38+
foxen_data.resize(foxen_size);
39+
40+
if (foxen_data.data() != nullptr) {
41+
flac = fx_flac_init(foxen_data.data(), max_block_size, max_channels);
4542
}
43+
4644
if (flac != nullptr) {
4745
is_active = true;
46+
write_buffer.resize(in_buffer_size);
47+
out.resize(out_buffer_size);
4848
} else {
4949
LOGE("not enough memory");
5050
if (is_stop_on_error) stop();
5151
}
52-
53-
write_buffer.resize(in_buffer_size);
54-
out.resize(out_buffer_size);
5552

5653
return is_active;
5754
}

0 commit comments

Comments
 (0)