[Asterisk-code-review] AST-2019-005 - translate: Don't assume all frames will have a src. (...asterisk[13])

Friendly Automation asteriskteam at digium.com
Thu Sep 5 05:27:04 CDT 2019


Hello Joshua Colp,

I'd like you to do a code review. Please visit

    https://gerrit.asterisk.org/c/asterisk/+/12836

to review the following change.


Change subject: AST-2019-005 - translate: Don't assume all frames will have a src.
......................................................................

AST-2019-005 - translate: Don't assume all frames will have a src.

This change removes the assumption that a frame will always have
a src set on it. This assumption is incorrect.

Given a scenario where an RTP packet is received with no payload
the resulting audio frame will have no samples. If this frame goes
through a signed linear translation path an interpolated frame can
be created (if generic packet loss concealment is enabled) that has
minimal data on it, including no src. If this frame is given to a
translation path a crash will occur due to the lack of src.

ASTERISK-28499

Change-Id: I024d10dd98207eb8a6b35b59880bcdf1090538f8
---
M main/translate.c
1 file changed, 1 insertion(+), 1 deletion(-)



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/36/12836/1

diff --git a/main/translate.c b/main/translate.c
index 68d2cdb..acfe5df 100644
--- a/main/translate.c
+++ b/main/translate.c
@@ -405,7 +405,7 @@
 
 	if (f->samples == 0) {
 		/* Do not log empty audio frame */
-		if (strcasecmp(f->src, "ast_prod")) {
+		if (!f->src || strcasecmp(f->src, "ast_prod")) {
 			ast_log(LOG_WARNING, "no samples for %s\n", pvt->t->name);
 		}
 	}

-- 
To view, visit https://gerrit.asterisk.org/c/asterisk/+/12836
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Change-Id: I024d10dd98207eb8a6b35b59880bcdf1090538f8
Gerrit-Change-Number: 12836
Gerrit-PatchSet: 1
Gerrit-Owner: Friendly Automation
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20190905/aea2e3d0/attachment.html>


More information about the asterisk-code-review mailing list