summaryrefslogtreecommitdiff
path: root/channels/chan_motif.c
diff options
context:
space:
mode:
authorJoshua Colp <jcolp@digium.com>2012-08-07 13:07:58 +0000
committerJoshua Colp <jcolp@digium.com>2012-08-07 13:07:58 +0000
commit15e41c7542fba77244ec709a76c49efdc74d450e (patch)
tree08a86fa9d8e990a70f46121e79ed348b44cc0a33 /channels/chan_motif.c
parent5c4578f4ad9af0d13638ec72a2bc141227ec8b3c (diff)
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
Diffstat (limited to 'channels/chan_motif.c')
-rw-r--r--channels/chan_motif.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/channels/chan_motif.c b/channels/chan_motif.c
index 52d15d00a..8c4c11a7a 100644
--- a/channels/chan_motif.c
+++ b/channels/chan_motif.c
@@ -1869,7 +1869,11 @@ static int jingle_interpret_description(struct jingle_session *session, iks *des
return -1;
}
- ast_rtp_codecs_payloads_clear(&codecs, NULL);
+ if (ast_rtp_codecs_payloads_initialize(&codecs)) {
+ jingle_queue_hangup_with_cause(session, AST_CAUSE_BEARERCAPABILITY_NOTAVAIL);
+ ast_log(LOG_ERROR, "Could not initialize codecs for negotiation on session '%s'\n", session->sid);
+ return -1;
+ }
/* Iterate the codecs updating the relevant RTP instance as we go */
for (codec = iks_child(description); codec; codec = iks_next(codec)) {
@@ -1894,10 +1898,12 @@ static int jingle_interpret_description(struct jingle_session *session, iks *des
if (ast_format_cap_is_empty(session->jointcap)) {
/* We have no compatible codecs, so terminate the session appropriately */
jingle_queue_hangup_with_cause(session, AST_CAUSE_BEARERCAPABILITY_NOTAVAIL);
+ ast_rtp_codecs_payloads_destroy(&codecs);
return -1;
}
ast_rtp_codecs_payloads_copy(&codecs, ast_rtp_instance_get_codecs(*rtp), *rtp);
+ ast_rtp_codecs_payloads_destroy(&codecs);
return 0;
}