From 4441bb6a2560d7781d87b15eaa2cef58f7645da8 Mon Sep 17 00:00:00 2001 From: Richard Mudgett Date: Wed, 8 Apr 2015 18:14:00 +0000 Subject: Bridging: Eliminate the unnecessary make channel compatible with bridge operation. When a channel enters the bridging system it is first made compatible with the bridge and then the bridge technology makes the channel compatible with the technology. For all but the DAHDI native and softmix bridge technologies the make channel compatible with the bridge step is an effective noop because the other technologies allow all audio formats. For the DAHDI native bridge technology it doesn't matter because it is not an initial bridge technology and chan_dahdi allows only one native format per channel. For the softmix bridge technology, it is a noop at best and harmful at worst because the wrong translation path could be setup if the channel's native formats allow more than one audio format. This is an intermediate patch for a series of patches aimed at improving translation path choices. * Removed code dealing with the unnecessary step of making the channel compatible with the bridge. ASTERISK-24841 Reported by: Matt Jordan Review: https://reviewboard.asterisk.org/r/4600/ git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@434424 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- bridges/bridge_holding.c | 14 +++++--------- bridges/bridge_native_rtp.c | 13 +++++-------- bridges/bridge_simple.c | 14 +++++--------- bridges/bridge_softmix.c | 11 +++++------ 4 files changed, 20 insertions(+), 32 deletions(-) (limited to 'bridges') diff --git a/bridges/bridge_holding.c b/bridges/bridge_holding.c index c343cc624..2fd79d09a 100644 --- a/bridges/bridge_holding.c +++ b/bridges/bridge_holding.c @@ -428,21 +428,17 @@ static void deferred_action(struct ast_bridge_channel *bridge_channel, const voi static int unload_module(void) { - ao2_cleanup(holding_bridge.format_capabilities); - holding_bridge.format_capabilities = NULL; - return ast_bridge_technology_unregister(&holding_bridge); + ast_bridge_technology_unregister(&holding_bridge); + return 0; } static int load_module(void) { - if (!(holding_bridge.format_capabilities = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_DEFAULT))) { + if (ast_bridge_technology_register(&holding_bridge)) { + unload_module(); return AST_MODULE_LOAD_DECLINE; } - ast_format_cap_append_by_type(holding_bridge.format_capabilities, AST_MEDIA_TYPE_AUDIO); - ast_format_cap_append_by_type(holding_bridge.format_capabilities, AST_MEDIA_TYPE_VIDEO); - ast_format_cap_append_by_type(holding_bridge.format_capabilities, AST_MEDIA_TYPE_TEXT); - - return ast_bridge_technology_register(&holding_bridge); + return AST_MODULE_LOAD_SUCCESS; } AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Holding bridge module"); diff --git a/bridges/bridge_native_rtp.c b/bridges/bridge_native_rtp.c index a69a97f63..980f46716 100644 --- a/bridges/bridge_native_rtp.c +++ b/bridges/bridge_native_rtp.c @@ -474,20 +474,17 @@ static struct ast_bridge_technology native_rtp_bridge = { static int unload_module(void) { - ao2_t_ref(native_rtp_bridge.format_capabilities, -1, "Dispose of capabilities in module unload"); - return ast_bridge_technology_unregister(&native_rtp_bridge); + ast_bridge_technology_unregister(&native_rtp_bridge); + return 0; } static int load_module(void) { - if (!(native_rtp_bridge.format_capabilities = ast_format_cap_alloc(0))) { + if (ast_bridge_technology_register(&native_rtp_bridge)) { + unload_module(); return AST_MODULE_LOAD_DECLINE; } - ast_format_cap_append_by_type(native_rtp_bridge.format_capabilities, AST_MEDIA_TYPE_AUDIO); - ast_format_cap_append_by_type(native_rtp_bridge.format_capabilities, AST_MEDIA_TYPE_VIDEO); - ast_format_cap_append_by_type(native_rtp_bridge.format_capabilities, AST_MEDIA_TYPE_TEXT); - - return ast_bridge_technology_register(&native_rtp_bridge); + return AST_MODULE_LOAD_SUCCESS; } AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Native RTP bridging module"); diff --git a/bridges/bridge_simple.c b/bridges/bridge_simple.c index 1626a3993..570453500 100644 --- a/bridges/bridge_simple.c +++ b/bridges/bridge_simple.c @@ -76,21 +76,17 @@ static struct ast_bridge_technology simple_bridge = { static int unload_module(void) { - ao2_cleanup(simple_bridge.format_capabilities); - simple_bridge.format_capabilities = NULL; - return ast_bridge_technology_unregister(&simple_bridge); + ast_bridge_technology_unregister(&simple_bridge); + return 0; } static int load_module(void) { - if (!(simple_bridge.format_capabilities = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_DEFAULT))) { + if (ast_bridge_technology_register(&simple_bridge)) { + unload_module(); return AST_MODULE_LOAD_DECLINE; } - ast_format_cap_append_by_type(simple_bridge.format_capabilities, AST_MEDIA_TYPE_AUDIO); - ast_format_cap_append_by_type(simple_bridge.format_capabilities, AST_MEDIA_TYPE_VIDEO); - ast_format_cap_append_by_type(simple_bridge.format_capabilities, AST_MEDIA_TYPE_TEXT); - - return ast_bridge_technology_register(&simple_bridge); + return AST_MODULE_LOAD_SUCCESS; } AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Simple two channel bridging module"); diff --git a/bridges/bridge_softmix.c b/bridges/bridge_softmix.c index 53be7d975..72299209c 100644 --- a/bridges/bridge_softmix.c +++ b/bridges/bridge_softmix.c @@ -1194,18 +1194,17 @@ static struct ast_bridge_technology softmix_bridge = { static int unload_module(void) { - ao2_cleanup(softmix_bridge.format_capabilities); - softmix_bridge.format_capabilities = NULL; - return ast_bridge_technology_unregister(&softmix_bridge); + ast_bridge_technology_unregister(&softmix_bridge); + return 0; } static int load_module(void) { - if (!(softmix_bridge.format_capabilities = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_DEFAULT))) { + if (ast_bridge_technology_register(&softmix_bridge)) { + unload_module(); return AST_MODULE_LOAD_DECLINE; } - ast_format_cap_append(softmix_bridge.format_capabilities, ast_format_slin, 0); - return ast_bridge_technology_register(&softmix_bridge); + return AST_MODULE_LOAD_SUCCESS; } AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Multi-party software based channel mixing"); -- cgit v1.2.3