diff options
Diffstat (limited to 'addons/format_mp3.c')
-rw-r--r-- | addons/format_mp3.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/addons/format_mp3.c b/addons/format_mp3.c index e354148f0..1373f3e92 100644 --- a/addons/format_mp3.c +++ b/addons/format_mp3.c @@ -120,9 +120,11 @@ static int mp3_squeue(struct ast_filestream *s) res = ftell(s->f); p->sbuflen = fread(p->sbuf, 1, MP3_SCACHE, s->f); - if(p->sbuflen < 0) { - ast_log(LOG_WARNING, "Short read (%d) (%s)!\n", p->sbuflen, strerror(errno)); - return -1; + if (p->sbuflen < MP3_SCACHE) { + if (ferror(s->f)) { + ast_log(LOG_WARNING, "Error while reading MP3 file: %s\n", strerror(errno)); + return -1; + } } res = decodeMP3(&p->mp,p->sbuf,p->sbuflen,p->dbuf,MP3_DCACHE,&p->dbuflen); if(res != MP3_OK) |