]> git.tuebingen.mpg.de Git - paraslash.git/blobdiff - mp3dec_filter.c
mp3dec: Only proceed decoding if at least 16K are available.
[paraslash.git] / mp3dec_filter.c
index d3265d4ff84c2b804ec9fd421f7e4694b70cf9f1..e9d84c1baf366ef4390082bca5e8f27c289e7008 100644 (file)
@@ -35,7 +35,7 @@ static ssize_t mp3dec(char *inbuffer, size_t len, struct filter_node *fn)
        struct private_mp3dec_data *pmd = fn->private_data;
        size_t copy = PARA_MIN(len, 4096);
 
-       if (fn->loaded > fn->bufsize * 4 / 5)
+       if (fn->loaded + 16384 > fn->bufsize)
                return 0;
        mad_stream_buffer(&pmd->stream, (unsigned char *) inbuffer, copy);
        pmd->stream.error = 0;
@@ -78,7 +78,7 @@ next_frame:
                PARA_ERROR_LOG("output buffer full: %zd\n", fn->loaded);
                        return -E_MP3DEC_OVERRUN;
        }
-       if (fn->loaded <= fn->bufsize * 4 / 5)
+       if (fn->loaded + 16384 <= fn->bufsize)
                goto next_frame;
 out:
        if (pmd->stream.next_frame) { /* we still have some data */