aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/decoder/plugins/FaadDecoderPlugin.cxx26
1 files changed, 16 insertions, 10 deletions
diff --git a/src/decoder/plugins/FaadDecoderPlugin.cxx b/src/decoder/plugins/FaadDecoderPlugin.cxx
index 7025536d6..1fdc7def0 100644
--- a/src/decoder/plugins/FaadDecoderPlugin.cxx
+++ b/src/decoder/plugins/FaadDecoderPlugin.cxx
@@ -360,17 +360,11 @@ faad_get_file_time(InputStream &is)
}
static void
-faad_stream_decode(Decoder &mpd_decoder, InputStream &is)
+faad_stream_decode(Decoder &mpd_decoder, InputStream &is,
+ DecoderBuffer *buffer, const NeAACDecHandle decoder)
{
- DecoderBuffer *buffer =
- decoder_buffer_new(&mpd_decoder, is,
- FAAD_MIN_STREAMSIZE * MAX_CHANNELS);
const float total_time = faad_song_duration(buffer, is);
- /* create the libfaad decoder */
-
- const NeAACDecHandle decoder = faad_decoder_new();
-
while (!decoder_buffer_is_full(buffer) && !is.LockIsEOF() &&
decoder_get_command(mpd_decoder) == DecoderCommand::NONE) {
adts_find_frame(buffer);
@@ -383,8 +377,6 @@ faad_stream_decode(Decoder &mpd_decoder, InputStream &is)
AudioFormat audio_format;
if (!faad_decoder_init(decoder, buffer, audio_format, error)) {
LogError(error);
- NeAACDecClose(decoder);
- decoder_buffer_free(buffer);
return;
}
@@ -448,6 +440,20 @@ faad_stream_decode(Decoder &mpd_decoder, InputStream &is)
(size_t)frame_info.samples * 2,
bit_rate);
} while (cmd != DecoderCommand::STOP);
+}
+
+static void
+faad_stream_decode(Decoder &mpd_decoder, InputStream &is)
+{
+ DecoderBuffer *buffer =
+ decoder_buffer_new(&mpd_decoder, is,
+ FAAD_MIN_STREAMSIZE * MAX_CHANNELS);
+
+ /* create the libfaad decoder */
+
+ const NeAACDecHandle decoder = faad_decoder_new();
+
+ faad_stream_decode(mpd_decoder, is, buffer, decoder);
/* cleanup */