[Asterisk-code-review] ast format cap: Avoid format creation on module load, use ca... (asterisk[13])

Alexander Traud asteriskteam at digium.com
Mon Nov 9 07:07:37 CST 2015


Alexander Traud has uploaded a new change for review.

  https://gerrit.asterisk.org/1590

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(-)


  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/90/1590/1

diff --git a/main/format_cap.c b/main/format_cap.c
index 1725e38..4739efa 100644
--- a/main/format_cap.c
+++ b/main/format_cap.c
@@ -264,7 +264,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/1590
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I479cdc220d5617c840a98f3389b3bd91e91fbd9b
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Owner: Alexander Traud <pabstraud at compuserve.com>



More information about the asterisk-code-review mailing list