[asterisk-dev] [Code Review] 3689: Media format improvements: the great renaming + some cleanup

Matt Jordan reviewboard at asterisk.org
Thu Jul 3 06:42:25 CDT 2014


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/3689/
-----------------------------------------------------------

(Updated July 3, 2014, 6:42 a.m.)


Status
------

This change has been marked as submitted.


Review request for Asterisk Developers.


Changes
-------

Committed in revision 417801


Repository: Asterisk


Description
-------

This patch performs the renaming discussed on the asterisk-dev list [1]. As usual, as I was going through it some other cleanups occurred, and in order to make sure I didn't make memory leaks worse, some parts of Corey's memory leak cleanups made their way in as well.

[1] http://lists.digium.com/pipermail/asterisk-dev/2014-June/068133.html

The great renaming:

 * ast_format_cap_add             => ast_format_cap_append
 * ast_format_cap_add_all_by_type => ast_format_cap_append_all_by_type
 * ast_parse_allow_disallow       => ast_format_cap_update_by_allow_disallow
 * ast_cap_remove_bytype          => ast_format_cap_remove_by_type
 * ast_getformatname_multiple     => ast_format_cap_get_names, and now uses an ast_str ** instead of a char *buf/size_t len
 * ast_format_sdp_generate        => ast_format_generate_sdp_fmtp
 * ast_format_sdp_parse           => ast_format_parse_sdp_fmtp

Functions removed:
 * ast_format_compatibility_get_original_id - no longer used

Note that chan_h323, chan_gtalk, and chan_jingle did not get all of the re-namings (particularly ast_getformatname_multiple => ast_format_cap_get_names), and will not compile with this patch. These modules should be removed, per the discussion on the -dev list.

Functions that support REF_DEBUG:
 * ast_format_cap_alloc
 * ast_format_cap_append
 * ast_format_cache_get

Memory leak cleanups (many of which came from Corey's patches):
 * Channel technology struct capabilities leak their format capabilities on off nominal exit paths (chan_motif, chan_pjsip, chan_unistim, chan_skinny)
 * Format capabilities leak in chan_pjsip_new nominal path
 * Leak of nativeformats format_cap in nominal path of channel.c's ast_channel_alloc
 * Leak of format_cap in channel.c's set_format
 * Leak of format_cap in channel.c's ast_request
 * Usage of ao2_replace in translate.c to avoid overwriting a ref
 * Clean up of frame format cache in RTP instance in res_rtp_asterisk destructor

Unit tests
 * Remove test for ast_getformatname_multiple, add test for ast_format_cap_get_names


Diffs
-----

  /team/group/media_formats-reviewed-trunk/tests/test_voicemail_api.c 417786 
  /team/group/media_formats-reviewed-trunk/tests/test_format_cap.c 417786 
  /team/group/media_formats-reviewed-trunk/tests/test_format_api.c 417786 
  /team/group/media_formats-reviewed-trunk/tests/test_core_format.c 417786 
  /team/group/media_formats-reviewed-trunk/tests/test_config.c 417786 
  /team/group/media_formats-reviewed-trunk/res/res_stasis_snoop.c 417786 
  /team/group/media_formats-reviewed-trunk/res/res_stasis.c 417786 
  /team/group/media_formats-reviewed-trunk/res/res_rtp_asterisk.c 417786 
  /team/group/media_formats-reviewed-trunk/res/res_pjsip_session.c 417786 
  /team/group/media_formats-reviewed-trunk/res/res_pjsip_sdp_rtp.c 417786 
  /team/group/media_formats-reviewed-trunk/res/res_pjsip/pjsip_configuration.c 417786 
  /team/group/media_formats-reviewed-trunk/res/res_clioriginate.c 417786 
  /team/group/media_formats-reviewed-trunk/res/res_calendar.c 417786 
  /team/group/media_formats-reviewed-trunk/res/res_agi.c 417786 
  /team/group/media_formats-reviewed-trunk/res/parking/parking_applications.c 417786 
  /team/group/media_formats-reviewed-trunk/res/ari/resource_channels.c 417786 
  /team/group/media_formats-reviewed-trunk/res/ari/resource_bridges.c 417786 
  /team/group/media_formats-reviewed-trunk/pbx/pbx_spool.c 417786 
  /team/group/media_formats-reviewed-trunk/main/translate.c 417786 
  /team/group/media_formats-reviewed-trunk/main/sorcery.c 417786 
  /team/group/media_formats-reviewed-trunk/main/rtp_engine.c 417786 
  /team/group/media_formats-reviewed-trunk/main/media_index.c 417786 
  /team/group/media_formats-reviewed-trunk/main/manager.c 417786 
  /team/group/media_formats-reviewed-trunk/main/format_compatibility.c 417786 
  /team/group/media_formats-reviewed-trunk/main/format_cap.c 417786 
  /team/group/media_formats-reviewed-trunk/main/format_cache.c 417786 
  /team/group/media_formats-reviewed-trunk/main/format.c 417786 
  /team/group/media_formats-reviewed-trunk/main/file.c 417786 
  /team/group/media_formats-reviewed-trunk/main/dial.c 417786 
  /team/group/media_formats-reviewed-trunk/main/core_unreal.c 417786 
  /team/group/media_formats-reviewed-trunk/main/core_local.c 417786 
  /team/group/media_formats-reviewed-trunk/main/config_options.c 417786 
  /team/group/media_formats-reviewed-trunk/main/cli.c 417786 
  /team/group/media_formats-reviewed-trunk/main/channel.c 417786 
  /team/group/media_formats-reviewed-trunk/main/ccss.c 417786 
  /team/group/media_formats-reviewed-trunk/main/bridge_basic.c 417786 
  /team/group/media_formats-reviewed-trunk/main/bridge.c 417786 
  /team/group/media_formats-reviewed-trunk/include/asterisk/rtp_engine.h 417786 
  /team/group/media_formats-reviewed-trunk/include/asterisk/format_compatibility.h 417786 
  /team/group/media_formats-reviewed-trunk/include/asterisk/format_cap.h 417786 
  /team/group/media_formats-reviewed-trunk/include/asterisk/format_cache.h 417786 
  /team/group/media_formats-reviewed-trunk/include/asterisk/format.h 417786 
  /team/group/media_formats-reviewed-trunk/funcs/func_channel.c 417786 
  /team/group/media_formats-reviewed-trunk/channels/pjsip/dialplan_functions.c 417786 
  /team/group/media_formats-reviewed-trunk/channels/dahdi/bridge_native_dahdi.c 417786 
  /team/group/media_formats-reviewed-trunk/channels/chan_unistim.c 417786 
  /team/group/media_formats-reviewed-trunk/channels/chan_skinny.c 417786 
  /team/group/media_formats-reviewed-trunk/channels/chan_sip.c 417786 
  /team/group/media_formats-reviewed-trunk/channels/chan_pjsip.c 417786 
  /team/group/media_formats-reviewed-trunk/channels/chan_phone.c 417786 
  /team/group/media_formats-reviewed-trunk/channels/chan_oss.c 417786 
  /team/group/media_formats-reviewed-trunk/channels/chan_nbs.c 417786 
  /team/group/media_formats-reviewed-trunk/channels/chan_multicast_rtp.c 417786 
  /team/group/media_formats-reviewed-trunk/channels/chan_motif.c 417786 
  /team/group/media_formats-reviewed-trunk/channels/chan_misdn.c 417786 
  /team/group/media_formats-reviewed-trunk/channels/chan_mgcp.c 417786 
  /team/group/media_formats-reviewed-trunk/channels/chan_jingle.c 417786 
  /team/group/media_formats-reviewed-trunk/channels/chan_iax2.c 417786 
  /team/group/media_formats-reviewed-trunk/channels/chan_h323.c 417786 
  /team/group/media_formats-reviewed-trunk/channels/chan_gtalk.c 417786 
  /team/group/media_formats-reviewed-trunk/channels/chan_dahdi.c 417786 
  /team/group/media_formats-reviewed-trunk/channels/chan_console.c 417786 
  /team/group/media_formats-reviewed-trunk/channels/chan_bridge_media.c 417786 
  /team/group/media_formats-reviewed-trunk/channels/chan_alsa.c 417786 
  /team/group/media_formats-reviewed-trunk/bridges/bridge_softmix.c 417786 
  /team/group/media_formats-reviewed-trunk/bridges/bridge_simple.c 417786 
  /team/group/media_formats-reviewed-trunk/bridges/bridge_native_rtp.c 417786 
  /team/group/media_formats-reviewed-trunk/bridges/bridge_holding.c 417786 
  /team/group/media_formats-reviewed-trunk/apps/confbridge/conf_chan_record.c 417786 
  /team/group/media_formats-reviewed-trunk/apps/app_voicemail.c 417786 
  /team/group/media_formats-reviewed-trunk/apps/app_originate.c 417786 
  /team/group/media_formats-reviewed-trunk/apps/app_meetme.c 417786 
  /team/group/media_formats-reviewed-trunk/apps/app_dumpchan.c 417786 
  /team/group/media_formats-reviewed-trunk/apps/app_confbridge.c 417786 
  /team/group/media_formats-reviewed-trunk/addons/chan_ooh323.c 417786 
  /team/group/media_formats-reviewed-trunk/addons/chan_mobile.c 417786 

Diff: https://reviewboard.asterisk.org/r/3689/diff/


Testing
-------

Negotiation using PJSIP still works.

The most prevalent memory leak that still occurs happens when a statically allocated frame ref bumps a format. This happens a lot when generating translator tables, and in various other places as well.


Thanks,

Matt Jordan

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20140703/e8a8d81a/attachment.html>


More information about the asterisk-dev mailing list