From 16dfe8f03f7c26fc038d79372899dda1ea8f7176 Mon Sep 17 00:00:00 2001
From: Sean Bright <sean.bright@gmail.com>
Date: Wed, 23 Sep 2020 16:20:48 -0400
Subject: [PATCH] dsp.c: Update calls to ast_format_cmp to check result
 properly

ASTERISK-28311 #close

Change-Id: Ib1ce8fc1a8752751f5bf3615c59245532dfd9aa2
---
 main/dsp.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/main/dsp.c b/main/dsp.c
index 433e61a4b8..871a687fbb 100644
--- a/main/dsp.c
+++ b/main/dsp.c
@@ -1442,12 +1442,12 @@ static int ast_dsp_silence_noise_with_energy(struct ast_dsp *dsp, struct ast_fra
 	} else {
 		odata = f->data.ptr;
 		len = f->datalen;
-		if (ast_format_cmp(f->subclass.format, ast_format_ulaw)) {
+		if (ast_format_cmp(f->subclass.format, ast_format_ulaw) == AST_FORMAT_CMP_EQUAL) {
 			s = ast_alloca(len * 2);
 			for (x = 0; x < len; x++) {
 				s[x] = AST_MULAW(odata[x]);
 			}
-		} else if (ast_format_cmp(f->subclass.format, ast_format_alaw)) {
+		} else if (ast_format_cmp(f->subclass.format, ast_format_alaw) == AST_FORMAT_CMP_EQUAL) {
 			s = ast_alloca(len * 2);
 			for (x = 0; x < len; x++) {
 				s[x] = AST_ALAW(odata[x]);
-- 
GitLab