From 675e058e7794f15a4729093a165a0a66abb5d9f9 Mon Sep 17 00:00:00 2001
From: Sean Bright <sean.bright@gmail.com>
Date: Tue, 2 May 2017 12:34:24 -0400
Subject: [PATCH] cleanup: Change severity of fread short-read warning

Many sound files don't have a full frame's worth of data at EOF, so the
warning messages were a bit too noisy. So we demote them to debug
messages.

Change-Id: I6b617467d687658adca39170a81797a11cc766f6
---
 formats/format_g719.c    | 6 +++---
 formats/format_g723.c    | 6 +++---
 formats/format_g726.c    | 6 +++---
 formats/format_g729.c    | 6 +++---
 formats/format_gsm.c     | 6 +++---
 formats/format_h263.c    | 6 +++---
 formats/format_h264.c    | 6 +++---
 formats/format_ilbc.c    | 6 +++---
 formats/format_pcm.c     | 6 +++---
 formats/format_siren14.c | 6 +++---
 formats/format_siren7.c  | 6 +++---
 formats/format_sln.c     | 6 +++---
 formats/format_vox.c     | 6 +++---
 formats/format_wav.c     | 6 +++---
 formats/format_wav_gsm.c | 6 +++---
 15 files changed, 45 insertions(+), 45 deletions(-)

diff --git a/formats/format_g719.c b/formats/format_g719.c
index 572b88f5f7..3b2195a30b 100644
--- a/formats/format_g719.c
+++ b/formats/format_g719.c
@@ -47,9 +47,9 @@ static struct ast_frame *g719read(struct ast_filestream *s, int *whennext)
 	if ((res = fread(s->fr.data.ptr, 1, s->fr.datalen, s->f)) != s->fr.datalen) {
 		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);
+				ast_debug(3, "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",
diff --git a/formats/format_g723.c b/formats/format_g723.c
index d4c4d4b1c9..fff6ed07bb 100644
--- a/formats/format_g723.c
+++ b/formats/format_g723.c
@@ -67,9 +67,9 @@ static struct ast_frame *g723_read(struct ast_filestream *s, int *whennext)
 	if ((res = fread(s->fr.data.ptr, 1, s->fr.datalen, s->f)) != s->fr.datalen) {
 		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);
+				ast_debug(3, "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",
diff --git a/formats/format_g726.c b/formats/format_g726.c
index 7da6d1ecbb..33f9639537 100644
--- a/formats/format_g726.c
+++ b/formats/format_g726.c
@@ -126,9 +126,9 @@ static struct ast_frame *g726_read(struct ast_filestream *s, int *whennext)
 	if ((res = fread(s->fr.data.ptr, 1, s->fr.datalen, s->f)) != s->fr.datalen) {
 		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);
+				ast_debug(3, "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",
diff --git a/formats/format_g729.c b/formats/format_g729.c
index 4cefc0401c..1e523062ed 100644
--- a/formats/format_g729.c
+++ b/formats/format_g729.c
@@ -53,9 +53,9 @@ static struct ast_frame *g729_read(struct ast_filestream *s, int *whennext)
 	if ((res = fread(s->fr.data.ptr, 1, s->fr.datalen, s->f)) != s->fr.datalen) {
 		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);
+				ast_debug(3, "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",
diff --git a/formats/format_gsm.c b/formats/format_gsm.c
index 39deb983e3..b737c97e5f 100644
--- a/formats/format_gsm.c
+++ b/formats/format_gsm.c
@@ -59,9 +59,9 @@ static struct ast_frame *gsm_read(struct ast_filestream *s, int *whennext)
 	if ((res = fread(s->fr.data.ptr, 1, GSM_FRAME_SIZE, s->f)) != GSM_FRAME_SIZE) {
 		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), GSM_FRAME_SIZE, res);
+				ast_debug(3, "Incomplete frame data at end of %s file "
+						  "(expected %d bytes, read %d)\n",
+						  ast_format_get_name(s->fr.subclass.format), GSM_FRAME_SIZE, res);
 			}
 		} else {
 			ast_log(LOG_ERROR, "Error while reading %s file: %s\n",
diff --git a/formats/format_h263.c b/formats/format_h263.c
index d05e598254..586e2d8e54 100644
--- a/formats/format_h263.c
+++ b/formats/format_h263.c
@@ -87,9 +87,9 @@ static struct ast_frame *h263_read(struct ast_filestream *s, int *whennext)
 	if ((res = fread(s->fr.data.ptr, 1, s->fr.datalen, s->f)) != s->fr.datalen) {
 		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);
+				ast_debug(3, "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",
diff --git a/formats/format_h264.c b/formats/format_h264.c
index 47f71ae6cc..9230129e7e 100644
--- a/formats/format_h264.c
+++ b/formats/format_h264.c
@@ -79,9 +79,9 @@ static struct ast_frame *h264_read(struct ast_filestream *s, int *whennext)
 	if ((res = fread(s->fr.data.ptr, 1, s->fr.datalen, s->f)) != s->fr.datalen) {
 		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);
+				ast_debug(3, "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",
diff --git a/formats/format_ilbc.c b/formats/format_ilbc.c
index ec8ad0ffa6..8b41ab2287 100644
--- a/formats/format_ilbc.c
+++ b/formats/format_ilbc.c
@@ -51,9 +51,9 @@ static struct ast_frame *ilbc_read(struct ast_filestream *s, int *whennext)
 	if ((res = fread(s->fr.data.ptr, 1, s->fr.datalen, s->f)) != s->fr.datalen) {
 		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);
+				ast_debug(3, "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",
diff --git a/formats/format_pcm.c b/formats/format_pcm.c
index f5ddda9c61..4891f7ed5b 100644
--- a/formats/format_pcm.c
+++ b/formats/format_pcm.c
@@ -86,9 +86,9 @@ static struct ast_frame *pcm_read(struct ast_filestream *s, int *whennext)
 	if ((res = fread(s->fr.data.ptr, 1, s->fr.datalen, s->f)) != s->fr.datalen) {
 		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);
+				ast_debug(3, "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",
diff --git a/formats/format_siren14.c b/formats/format_siren14.c
index d54ed993bc..e15e20f465 100644
--- a/formats/format_siren14.c
+++ b/formats/format_siren14.c
@@ -47,9 +47,9 @@ static struct ast_frame *siren14read(struct ast_filestream *s, int *whennext)
 	if ((res = fread(s->fr.data.ptr, 1, s->fr.datalen, s->f)) != s->fr.datalen) {
 		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);
+				ast_debug(3, "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",
diff --git a/formats/format_siren7.c b/formats/format_siren7.c
index f3b4b42b3c..298992c3ca 100644
--- a/formats/format_siren7.c
+++ b/formats/format_siren7.c
@@ -47,9 +47,9 @@ static struct ast_frame *siren7read(struct ast_filestream *s, int *whennext)
 	if ((res = fread(s->fr.data.ptr, 1, s->fr.datalen, s->f)) != s->fr.datalen) {
 		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);
+				ast_debug(3, "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",
diff --git a/formats/format_sln.c b/formats/format_sln.c
index 1977f7dc06..5a5cde7770 100644
--- a/formats/format_sln.c
+++ b/formats/format_sln.c
@@ -41,9 +41,9 @@ static struct ast_frame *generic_read(struct ast_filestream *s, int *whennext, u
 	if ((res = fread(s->fr.data.ptr, 1, s->fr.datalen, s->f)) != s->fr.datalen) {
 		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);
+				ast_debug(3, "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",
diff --git a/formats/format_vox.c b/formats/format_vox.c
index 195714c6f0..c3da4ab941 100644
--- a/formats/format_vox.c
+++ b/formats/format_vox.c
@@ -47,9 +47,9 @@ static struct ast_frame *vox_read(struct ast_filestream *s, int *whennext)
 	if ((res = fread(s->fr.data.ptr, 1, s->fr.datalen, s->f)) != s->fr.datalen) {
 		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);
+				ast_debug(3, "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",
diff --git a/formats/format_wav.c b/formats/format_wav.c
index 09e6a5313f..ce8a8bf0ab 100644
--- a/formats/format_wav.c
+++ b/formats/format_wav.c
@@ -394,9 +394,9 @@ static struct ast_frame *wav_read(struct ast_filestream *s, int *whennext)
 	if ((res = fread(s->fr.data.ptr, 1, s->fr.datalen, s->f)) != s->fr.datalen) {
 		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);
+				ast_debug(3, "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",
diff --git a/formats/format_wav_gsm.c b/formats/format_wav_gsm.c
index bfec903d07..8d7d87f657 100644
--- a/formats/format_wav_gsm.c
+++ b/formats/format_wav_gsm.c
@@ -424,9 +424,9 @@ static struct ast_frame *wav_read(struct ast_filestream *s, int *whennext)
 		if ((res = fread(msdata, 1, MSGSM_FRAME_SIZE, s->f)) != MSGSM_FRAME_SIZE) {
 			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), MSGSM_FRAME_SIZE, res);
+					ast_debug(3, "Incomplete frame data at end of %s file "
+							  "(expected %d bytes, read %d)\n",
+							  ast_format_get_name(s->fr.subclass.format), MSGSM_FRAME_SIZE, res);
 				}
 			} else {
 				ast_log(LOG_ERROR, "Error while reading %s file: %s\n",
-- 
GitLab