Cache string values of formats on ast_format_cap() to save processing.
authorMark Michelson <mmichelson@digium.com>
Thu, 3 Oct 2013 14:58:16 +0000 (14:58 +0000)
committerMark Michelson <mmichelson@digium.com>
Thu, 3 Oct 2013 14:58:16 +0000 (14:58 +0000)
commitee21eee7e067573ad83bd0df492036094b4dbaca
tree024e25a92079bc7e5348bd55cc29eff2f3c38dec
parentc977f73e136eca1f2aaccd0ea0fe45c350906374
Cache string values of formats on ast_format_cap() to save processing.

Channel snapshots have string representations of the channel's native formats.
Prior to this change, the format strings were re-created on ever channel snapshot
creation. Since channel native formats rarely change, this was very wasteful.
Now, string representations of formats may optionally be stored on the ast_format_cap
for cases where string representations may be requested frequently. When formats
are altered, the string cache is marked as invalid. When strings are requested, the
cache validity is checked. If the cache is valid, then the cached strings are copied.
If the cache is invalid, then the string cache is rebuilt and copied, and the cache
is marked as being valid again.

Review: https://reviewboard.asterisk.org/r/2879
........

Merged revisions 400356 from http://svn.asterisk.org/svn/asterisk/branches/12

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@400363 65c4cc65-6c06-0410-ace0-fbb531ad65f3
51 files changed:
addons/chan_mobile.c
addons/chan_ooh323.c
apps/app_confbridge.c
apps/app_meetme.c
apps/app_originate.c
bridges/bridge_holding.c
bridges/bridge_native_rtp.c
bridges/bridge_simple.c
bridges/bridge_softmix.c
channels/chan_alsa.c
channels/chan_bridge_media.c
channels/chan_console.c
channels/chan_dahdi.c
channels/chan_gtalk.c
channels/chan_h323.c
channels/chan_iax2.c
channels/chan_jingle.c
channels/chan_mgcp.c
channels/chan_misdn.c
channels/chan_motif.c
channels/chan_multicast_rtp.c
channels/chan_nbs.c
channels/chan_oss.c
channels/chan_phone.c
channels/chan_pjsip.c
channels/chan_sip.c
channels/chan_skinny.c
channels/chan_unistim.c
channels/dahdi/bridge_native_dahdi.c
include/asterisk/format_cap.h
main/bridge_basic.c
main/ccss.c
main/channel.c
main/core_local.c
main/dial.c
main/file.c
main/format_cap.c
main/manager.c
main/media_index.c
main/rtp_engine.c
pbx/pbx_spool.c
res/ari/resource_bridges.c
res/parking/parking_applications.c
res/res_agi.c
res/res_clioriginate.c
res/res_pjsip/pjsip_configuration.c
res/res_pjsip_sdp_rtp.c
res/res_pjsip_session.c
res/res_stasis.c
tests/test_config.c
tests/test_format_api.c