summaryrefslogtreecommitdiff
path: root/formats/format_ilbc.c
diff options
context:
space:
mode:
Diffstat (limited to 'formats/format_ilbc.c')
-rw-r--r--formats/format_ilbc.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/formats/format_ilbc.c b/formats/format_ilbc.c
index eab465d88..ec8ad0ffa 100644
--- a/formats/format_ilbc.c
+++ b/formats/format_ilbc.c
@@ -49,8 +49,16 @@ static struct ast_frame *ilbc_read(struct ast_filestream *s, int *whennext)
/* Send a frame from the file to the appropriate channel */
AST_FRAME_SET_BUFFER(&s->fr, s->buf, AST_FRIENDLY_OFFSET, ILBC_BUF_SIZE);
if ((res = fread(s->fr.data.ptr, 1, s->fr.datalen, s->f)) != s->fr.datalen) {
- if (res)
- ast_log(LOG_WARNING, "Short read (%d) (%s)!\n", res, strerror(errno));
+ if (feof(s->f)) {
+ if (res) {
+ ast_log(LOG_WARNING, "Incomplete frame data at end of %s file "
+ "(expected %d bytes, read %d)\n",
+ ast_format_get_name(s->fr.subclass.format), s->fr.datalen, res);
+ }
+ } else {
+ ast_log(LOG_ERROR, "Error while reading %s file: %s\n",
+ ast_format_get_name(s->fr.subclass.format), strerror(errno));
+ }
return NULL;
}
*whennext = s->fr.samples = ILBC_SAMPLES;