]> git.ipfire.org Git - thirdparty/asterisk.git/commit
rtp_engine: Prevent unnecessary memory increases during calls. 91/291/1
authorMark Michelson <mmichelson@digium.com>
Wed, 29 Apr 2015 16:46:48 +0000 (11:46 -0500)
committerMark Michelson <mmichelson@digium.com>
Wed, 29 Apr 2015 16:46:48 +0000 (11:46 -0500)
commitc87b0d73757956253b0a5b219373385365347e1a
tree9e5a536ea29471722e57a681315bddddc493aac3
parent9bee1cae12dce1658586c55bf930c813f6f7b34e
rtp_engine: Prevent unnecessary memory increases during calls.

The doxygen for ast_rtp_codecs_payloads_copy() states:

"This copies the payloads from the codecs0 structure to the codecs1
structure, overwriting any current values."

However, in practice, the overwriting of current values was not
happening. Instead, a new RTP codec payload object would be appended to
the codecs1 structure instead of replacing the corresponding object.

This patch corrects this behavior by overwriting the object in the
codecs1 structure if it exists already. If it does not already exist,
then create a new copy and link it in.

Tests of "memory show summary rtp_engine.c" had previously shown
additional allocations being performed any time that Asterisk processed
an incoming SDP. Scenarios involving lots of reinvites resulted in lots
of allocations. With this patch, I can perform as many reinvites as
I want and see no memory increases from the RTP engine.

ASTERISK-24916 #close
Reported by Christophe Osuna

Change-Id: I9a90bc3f564535bc767bf2fc0c455d5f065cea75
main/rtp_engine.c