[asterisk-commits] ast format cap: Avoid format creation on module load, use ca... (asterisk[master])

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Nov 11 08:08:02 CST 2015


Matt Jordan has submitted this change and it was merged.

Change subject: ast_format_cap: Avoid format creation on module load, use cache instead.
......................................................................


ast_format_cap: Avoid format creation on module load, use cache instead.

Since Asterisk 13, formats are immutable and cached. However while loading a
module like chan_sip, some formats were created instead using cached ones.

ASTERISK-25535 #close

Change-Id: I479cdc220d5617c840a98f3389b3bd91e91fbd9b
---
M main/format_cap.c
1 file changed, 4 insertions(+), 1 deletion(-)

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



diff --git a/main/format_cap.c b/main/format_cap.c
index d486d5d..2221c53 100644
--- a/main/format_cap.c
+++ b/main/format_cap.c
@@ -230,7 +230,10 @@
 			continue;
 		}
 
-		format = ast_format_create(codec);
+		format = ast_format_cache_get(codec->name);
+		if (!format || (codec != ast_format_get_codec(format))) {
+			format = ast_format_create(codec);
+		}
 		ao2_ref(codec, -1);
 
 		if (!format) {

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I479cdc220d5617c840a98f3389b3bd91e91fbd9b
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Owner: Alexander Traud <pabstraud at compuserve.com>
Gerrit-Reviewer: Alexander Traud <pabstraud at compuserve.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Matt Jordan <mjordan at digium.com>



More information about the asterisk-commits mailing list