summaryrefslogtreecommitdiff
path: root/res/res_sdp_translator_pjmedia.c
diff options
context:
space:
mode:
authorRichard Mudgett <rmudgett@digium.com>2018-02-27 15:40:18 -0600
committerRichard Mudgett <rmudgett@digium.com>2018-02-28 11:41:30 -0600
commit1a36a452bd92eba702170ac2fe9bf2d83fbfaa98 (patch)
tree3ac4af64b514aa7b5ceaf27aa9267d79c183f066 /res/res_sdp_translator_pjmedia.c
parent53ed437db3f37d941538ec1bf0ff96c422c7bef5 (diff)
pjproject: Add cache_pools debugging option.
The pool cache gets in the way of finding use after free errors of memory pool contents. Tools like valgrind and MALLOC_DEBUG don't know when a pool is released because it gets put into the cache instead of being freed. * Added the "cache_pools" option to pjproject.conf. Disabling the option helps track down pool content mismanagement when using valgrind or MALLOC_DEBUG. The cache gets in the way of determining if the pool contents are used after free and who freed it. To disable the pool caching simply disable the cache_pools option in pjproject.conf and restart Asterisk. Sample pjproject.conf setting: [startup] cache_pools=no * Made current users of the caching pool factory initialization and destruction calls call common routines to create and destroy cached pools. ASTERISK-27704 Change-Id: I64d5befbaeed2532f93aa027a51eb52347d2b828
Diffstat (limited to 'res/res_sdp_translator_pjmedia.c')
-rw-r--r--res/res_sdp_translator_pjmedia.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/res/res_sdp_translator_pjmedia.c b/res/res_sdp_translator_pjmedia.c
index 772be272c..676e740bc 100644
--- a/res/res_sdp_translator_pjmedia.c
+++ b/res/res_sdp_translator_pjmedia.c
@@ -17,6 +17,11 @@
*/
#include "asterisk.h"
+
+#include <pjlib.h>
+#include <pjmedia.h>
+
+#include "asterisk/res_pjproject.h"
#include "asterisk/sdp_translator.h"
#include "asterisk/sdp_options.h"
#include "asterisk/vector.h"
@@ -27,10 +32,6 @@
#include "asterisk/module.h"
#include "asterisk/sdp.h"
-#ifdef HAVE_PJPROJECT
-#include <pjlib.h>
-#include <pjmedia.h>
-#endif
/*** MODULEINFO
<depend>pjproject</depend>
@@ -573,7 +574,7 @@ static int load_module(void)
if (ast_sdp_register_translator(&pjmedia_translator)) {
return AST_MODULE_LOAD_DECLINE;
}
- pj_caching_pool_init(&sdp_caching_pool, NULL, 1024 * 1024);
+ ast_pjproject_caching_pool_init(&sdp_caching_pool, NULL, 1024 * 1024);
AST_TEST_REGISTER(pjmedia_to_sdp_test);
AST_TEST_REGISTER(sdp_to_pjmedia_test);
@@ -583,7 +584,7 @@ static int load_module(void)
static int unload_module(void)
{
ast_sdp_unregister_translator(&pjmedia_translator);
- pj_caching_pool_destroy(&sdp_caching_pool);
+ ast_pjproject_caching_pool_destroy(&sdp_caching_pool);
AST_TEST_UNREGISTER(pjmedia_to_sdp_test);
AST_TEST_UNREGISTER(sdp_to_pjmedia_test);
return 0;
@@ -600,4 +601,5 @@ AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_LOAD_ORDER, "PJMEDIA SDP Translato
.unload = unload_module,
.reload = reload_module,
.load_pri = AST_MODPRI_CHANNEL_DEPEND,
+ .requires = "res_pjproject",
);