[asterisk-commits] translate: explicit format destination not properly set (asterisk[master])

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Jul 14 13:40:43 CDT 2016


Anonymous Coward #1000019 has submitted this change and it was merged.

Change subject: translate: explicit format destination not properly set
......................................................................


translate: explicit format destination not properly set

If the destination format's name differed from the codec name then the
translator's explict_dst field would be improperly set. In some circumstances
it would end up setting it to a newly created format that has the same name
as the codec when it actually needed to be the given destination codec.

This could cause the translation path to use the wrong format. For instance,
if an endpoint had specified 'myulaw' as a format the translator could end up
using a 'ulaw' format (with whatever/default settings) instead. If the format
attribute settings differed between the two then there may unexpected results
during processing.

This patch removes the name check when building the translation path. This
should make it always set the translator's explicit_dst to the given destination
format as long as the sample rate and types match.

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

Approvals:
  George Joseph: Looks good to me, but someone else must approve
  Anonymous Coward #1000019: Verified
  Joshua Colp: Looks good to me, approved



diff --git a/main/translate.c b/main/translate.c
index 8d37e37..43e6e29 100644
--- a/main/translate.c
+++ b/main/translate.c
@@ -494,7 +494,7 @@
 			AST_RWLIST_UNLOCK(&translators);
 			return NULL;
 		}
-		if ((t->dst_codec.sample_rate == ast_format_get_sample_rate(dst)) && (t->dst_codec.type == ast_format_get_type(dst)) && (!strcmp(t->dst_codec.name, ast_format_get_name(dst)))) {
+		if ((t->dst_codec.sample_rate == ast_format_get_sample_rate(dst)) && (t->dst_codec.type == ast_format_get_type(dst))) {
 			explicit_dst = dst;
 		}
 		if (!(cur = newpvt(t, explicit_dst))) {

-- 
To view, visit https://gerrit.asterisk.org/3199
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Iaf8a03831d68e657d89569d54b505074efbefab5
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Owner: Kevin Harwell <kharwell at digium.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>



More information about the asterisk-commits mailing list