From 15e41c7542fba77244ec709a76c49efdc74d450e Mon Sep 17 00:00:00 2001 From: Joshua Colp Date: Tue, 7 Aug 2012 13:07:58 +0000 Subject: Reduce memory consumption significantly for users of the RTP engine API by storing only the payloads present and in use instead of every possible one. Review: https://reviewboard.asterisk.org/r/2052/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@370832 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- include/asterisk/rtp_engine.h | 39 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 37 insertions(+), 2 deletions(-) (limited to 'include/asterisk') diff --git a/include/asterisk/rtp_engine.h b/include/asterisk/rtp_engine.h index bd47e42b1..dad2a60f8 100644 --- a/include/asterisk/rtp_engine.h +++ b/include/asterisk/rtp_engine.h @@ -431,10 +431,10 @@ struct ast_rtp_engine { /*! Structure that represents codec and packetization information */ struct ast_rtp_codecs { + /*! Payloads present */ + struct ao2_container *payloads; /*! Codec packetization preferences */ struct ast_codec_pref pref; - /*! Payloads present */ - struct ast_rtp_payload_type payloads[AST_RTP_MAX_PT]; }; /*! Structure that represents the glue that binds an RTP instance to a channel */ @@ -944,6 +944,41 @@ int ast_rtp_instance_get_prop(struct ast_rtp_instance *instance, enum ast_rtp_pr */ struct ast_rtp_codecs *ast_rtp_instance_get_codecs(struct ast_rtp_instance *instance); +/*! + * \brief Initialize an RTP codecs structure + * + * \param codecs The codecs structure to initialize + * + * \retval 0 success + * \retval -1 failure + * + * Example usage: + * + * \code + * struct ast_rtp_codecs codecs; + * ast_rtp_codecs_payloads_initialize(&codecs); + * \endcode + * + * \since 11 + */ +int ast_rtp_codecs_payloads_initialize(struct ast_rtp_codecs *codecs); + +/*! + * \brief Destroy the contents of an RTP codecs structure (but not the structure itself) + * + * \param codecs The codecs structure to destroy the contents of + * + * Example usage: + * + * \code + * struct ast_rtp_codecs codecs; + * ast_rtp_codecs_payloads_destroy(&codecs); + * \endcode + * + * \since 11 + */ +void ast_rtp_codecs_payloads_destroy(struct ast_rtp_codecs *codecs); + /*! * \brief Clear payload information from an RTP instance * -- cgit v1.2.3