[Asterisk-code-review] ast format cap: Avoid format creation on module load, use ca... (asterisk[master])
Alexander Traud
asteriskteam at digium.com
Mon Nov 9 07:07:55 CST 2015
Alexander Traud has uploaded a new change for review.
https://gerrit.asterisk.org/1589
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/89/1589/1
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: newchange
Gerrit-Change-Id: I479cdc220d5617c840a98f3389b3bd91e91fbd9b
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Owner: Alexander Traud <pabstraud at compuserve.com>
More information about the asterisk-code-review
mailing list