mp3_afh: Don't bail out on short files.
authorAndre Noll <maan@tuebingen.mpg.de>
Sun, 24 Nov 2019 16:33:51 +0000 (17:33 +0100)
committerAndre Noll <maan@tuebingen.mpg.de>
Sat, 29 Feb 2020 16:00:07 +0000 (17:00 +0100)
It's perfectly OK to have mp3 files which are shorter than two seconds.
For example lexico.com offers mp3 downloads to learn the pronuciation
of single words. These files are often shorter than one second.

The check for short length files predates the git history. Most likely
it was added for no good reason, so drop it.

mp3_afh.c

index f279cd5752ad8be4798ff5c0fc3fecd9c212b67a..728b25b81f94aa177a1e74ae01fca07419f7fe90 100644 (file)
--- a/mp3_afh.c
+++ b/mp3_afh.c
@@ -675,7 +675,7 @@ static int mp3_get_file_info(char *map, size_t numbytes, int fd,
        ret = mp3_read_info((unsigned char *)map, numbytes, fd, afhi);
        if (ret < 0)
                return ret;
        ret = mp3_read_info((unsigned char *)map, numbytes, fd, afhi);
        if (ret < 0)
                return ret;
-       if (afhi->seconds_total < 2 || !afhi->chunks_total)
+       if (afhi->chunks_total == 0)
                return -E_MP3_INFO;
        return 1;
 }
                return -E_MP3_INFO;
        return 1;
 }