diff options
author | waker <wakeroid@gmail.com> | 2011-09-29 20:42:46 +0200 |
---|---|---|
committer | waker <wakeroid@gmail.com> | 2011-09-29 20:42:46 +0200 |
commit | 67e0b16133168fda24f6bbe5899583e22a37a58a (patch) | |
tree | 11168bbe02a3bedfe5d50b5909a76673ed720bc6 | |
parent | dc25cec68337330d8d40de84c8081d07184ee519 (diff) |
fixed aac_read to avoid mp4ff_read_sample calls after EOF
-rw-r--r-- | plugins/aac/aac.c | 6 | ||||
-rw-r--r-- | streamer.c | 2 |
2 files changed, 5 insertions, 3 deletions
diff --git a/plugins/aac/aac.c b/plugins/aac/aac.c index 5416c924..f42b9d2f 100644 --- a/plugins/aac/aac.c +++ b/plugins/aac/aac.c @@ -21,7 +21,6 @@ #include <stdio.h> #include <unistd.h> #include <neaacdec.h> -#include <assert.h> #ifdef HAVE_CONFIG_H #include "../../config.h" #endif @@ -694,6 +693,10 @@ aac_free (DB_fileinfo_t *_info) { static int aac_read (DB_fileinfo_t *_info, char *bytes, int size) { aac_info_t *info = (aac_info_t *)_info; + if (info->eof) { + trace ("aac_read: received call after eof\n"); + return 0; + } int samplesize = _info->fmt.channels * _info->fmt.bps / 8; if (!info->file->vfs->is_streaming ()) { if (info->currentsample + size / samplesize > info->endsample) { @@ -815,7 +818,6 @@ aac_read (DB_fileinfo_t *_info, char *bytes, int size) { unsigned char *buffer = NULL; int buffer_size = 0; #ifdef USE_MP4FF - assert (!info->eof); int rc = mp4ff_read_sample (info->mp4file, info->mp4track, info->mp4sample, &buffer, &buffer_size); if (rc == 0) { info->eof = 1; @@ -1828,7 +1828,7 @@ streamer_read_async (char *bytes, int size) { } else { // that means EOF -// trace ("streamer: EOF! buns: %d, bytesread: %d, buffering: %d, bufferfill: %d\n", bytes_until_next_song, bytesread, streamer_buffering, streamer_ringbuf.remaining); + // trace ("streamer: EOF! buns: %d, bytesread: %d, buffering: %d, bufferfill: %d\n", bytes_until_next_song, bytesread, streamer_buffering, streamer_ringbuf.remaining); // in case of decoder error, or EOF while buffering - switch to next song instantly if (bytesread < 0 || (bytes_until_next_song >= 0 && streamer_buffering && bytesread == 0) || bytes_until_next_song < 0) { |