unify all audio format handlers
[paraslash.git] / aac_afh.c
index f29e55b..338b782 100644 (file)
--- a/aac_afh.c
+++ b/aac_afh.c
@@ -209,8 +209,10 @@ static char *aac_read_chunk(long unsigned current_chunk, ssize_t *len)
        *len = 0;
        if (current_chunk >= num_chunks)
                return NULL;
        *len = 0;
        if (current_chunk >= num_chunks)
                return NULL;
-       pos = chunk_table[current_chunk];
        *len = chunk_table[current_chunk + 1] - chunk_table[current_chunk];
        *len = chunk_table[current_chunk + 1] - chunk_table[current_chunk];
+       if (!*len) /* nothing to send for this run */
+               return inbuf;
+       pos = chunk_table[current_chunk];
        if (inbuf_size < *len) {
                PARA_INFO_LOG("increasing inbuf for chunk #%lu/%zu to %zd bytes\n",
                        current_chunk, num_chunks, *len);
        if (inbuf_size < *len) {
                PARA_INFO_LOG("increasing inbuf for chunk #%lu/%zu to %zd bytes\n",
                        current_chunk, num_chunks, *len);