From e3866cb7141eb376c2daa20042ec797a92892ee6 Mon Sep 17 00:00:00 2001
From: Alexei Gradinari <alex2grad@gmail.com>
Date: Fri, 14 Jun 2019 16:45:39 -0400
Subject: [PATCH] translate.c do not log WARNING on empty audio frame

There is WARNING "no samples for ..." on each Playtones.
The function ast_playtones_start calls ast_activate_generator,
which calls ast_prod.
The function ast_prod calls ast_write with empty audio frame.
In this case it's spam log.

Change-Id: Id4ac309489d9ff281bad02abdef341cecdede660
---
 main/translate.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/main/translate.c b/main/translate.c
index 26f9c9beeb..fe464602cb 100644
--- a/main/translate.c
+++ b/main/translate.c
@@ -402,7 +402,10 @@ static int framein(struct ast_trans_pvt *pvt, struct ast_frame *f)
 	pvt->f.seqno = f->seqno;
 
 	if (f->samples == 0) {
-		ast_log(LOG_WARNING, "no samples for %s\n", pvt->t->name);
+		/* Do not log empty audio frame */
+		if (strcasecmp(f->src, "ast_prod")) {
+			ast_log(LOG_WARNING, "no samples for %s\n", pvt->t->name);
+		}
 	}
 	if (pvt->t->buffer_samples) {	/* do not pass empty frames to callback */
 		if (f->datalen == 0) { /* perform native PLC if available */
-- 
GitLab