[asterisk-commits] rmudgett: branch rmudgett/native_dahdi r394826 - in /team/rmudgett/native_dah...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Fri Jul 19 17:48:37 CDT 2013
Author: rmudgett
Date: Fri Jul 19 17:48:35 2013
New Revision: 394826
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=394826
Log:
Extract a repeated test into ast_channel_has_audio_frame_or_monitor().
........
Merged revisions 394825 from http://svn.asterisk.org/svn/asterisk/trunk
Modified:
team/rmudgett/native_dahdi/ (props changed)
team/rmudgett/native_dahdi/bridges/bridge_native_rtp.c
team/rmudgett/native_dahdi/include/asterisk/channel.h
team/rmudgett/native_dahdi/main/bridging.c
team/rmudgett/native_dahdi/main/channel.c
Propchange: team/rmudgett/native_dahdi/
------------------------------------------------------------------------------
--- native_dahdi-integrated (original)
+++ native_dahdi-integrated Fri Jul 19 17:48:35 2013
@@ -1,1 +1,1 @@
-/trunk:1-394819
+/trunk:1-394825
Modified: team/rmudgett/native_dahdi/bridges/bridge_native_rtp.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/native_dahdi/bridges/bridge_native_rtp.c?view=diff&rev=394826&r1=394825&r2=394826
==============================================================================
--- team/rmudgett/native_dahdi/bridges/bridge_native_rtp.c (original)
+++ team/rmudgett/native_dahdi/bridges/bridge_native_rtp.c Fri Jul 19 17:48:35 2013
@@ -45,7 +45,6 @@
#include "asterisk/bridging_technology.h"
#include "asterisk/frame.h"
#include "asterisk/rtp_engine.h"
-#include "asterisk/audiohook.h"
/*! \brief Forward declarations for frame hook usage */
static int native_rtp_bridge_join(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel);
@@ -85,13 +84,7 @@
/*! \brief Internal helper function which checks whether the channels are compatible with our native bridging */
static int native_rtp_bridge_capable(struct ast_channel *chan)
{
- if (ast_channel_monitor(chan) || (ast_channel_audiohooks(chan) &&
- !ast_audiohook_write_list_empty(ast_channel_audiohooks(chan))) ||
- !ast_framehook_list_contains_no_active(ast_channel_framehooks(chan))) {
- return 0;
- } else {
- return 1;
- }
+ return ast_channel_has_audio_frame_or_monitor(chan);
}
/*! \brief Internal helper function which gets all RTP information (glue and instances) relating to the given channels */
Modified: team/rmudgett/native_dahdi/include/asterisk/channel.h
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/native_dahdi/include/asterisk/channel.h?view=diff&rev=394826&r1=394825&r2=394826
==============================================================================
--- team/rmudgett/native_dahdi/include/asterisk/channel.h (original)
+++ team/rmudgett/native_dahdi/include/asterisk/channel.h Fri Jul 19 17:48:35 2013
@@ -4336,6 +4336,16 @@
const char *ast_channel_oldest_linkedid(const char *a, const char *b);
/*!
+ * \brief Check if the channel has active audiohooks, active framehooks, or a monitor.
+ * \since 12.0.0
+ *
+ * \param chan The channel to check.
+ *
+ * \retval non-zero if channel has active audiohooks, framehooks, or monitor.
+ */
+int ast_channel_has_audio_frame_or_monitor(struct ast_channel *chan);
+
+/*!
* \brief Removes the trailing identifiers from a channel name string
* \since 12.0.0
*
Modified: team/rmudgett/native_dahdi/main/bridging.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/native_dahdi/main/bridging.c?view=diff&rev=394826&r1=394825&r2=394826
==============================================================================
--- team/rmudgett/native_dahdi/main/bridging.c (original)
+++ team/rmudgett/native_dahdi/main/bridging.c Fri Jul 19 17:48:35 2013
@@ -63,7 +63,6 @@
#include "asterisk/core_local.h"
#include "asterisk/core_unreal.h"
#include "asterisk/features_config.h"
-#include "asterisk/audiohook.h"
/*! All bridges container. */
static struct ao2_container *bridges;
@@ -4727,10 +4726,7 @@
if (!AST_LIST_EMPTY(ast_channel_readq(chan))) {
return NULL;
}
- if (ast_channel_monitor(chan)
- || (ast_channel_audiohooks(chan)
- && !ast_audiohook_write_list_empty(ast_channel_audiohooks(chan)))
- || !ast_framehook_list_contains_no_active(ast_channel_framehooks(chan))) {
+ if (ast_channel_has_audio_frame_or_monitor(chan)) {
/* Channel has an active monitor, audiohook, or framehook. */
return NULL;
}
@@ -4776,10 +4772,7 @@
ast_channel_unlock(peer);
return NULL;
}
- if (ast_channel_monitor(peer)
- || (ast_channel_audiohooks(peer)
- && !ast_audiohook_write_list_empty(ast_channel_audiohooks(peer)))
- || !ast_framehook_list_contains_no_active(ast_channel_framehooks(peer))) {
+ if (ast_channel_has_audio_frame_or_monitor(peer)) {
/* Peer has an active monitor, audiohook, or framehook. */
ast_channel_unlock(peer);
return NULL;
Modified: team/rmudgett/native_dahdi/main/channel.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/native_dahdi/main/channel.c?view=diff&rev=394826&r1=394825&r2=394826
==============================================================================
--- team/rmudgett/native_dahdi/main/channel.c (original)
+++ team/rmudgett/native_dahdi/main/channel.c Fri Jul 19 17:48:35 2013
@@ -2627,6 +2627,14 @@
ast_channel_unlock(bridge);
ast_channel_unref(bridge);
}
+}
+
+int ast_channel_has_audio_frame_or_monitor(struct ast_channel *chan)
+{
+ return ast_channel_monitor(chan)
+ || (ast_channel_audiohooks(chan)
+ && !ast_audiohook_write_list_empty(ast_channel_audiohooks(chan)))
+ || !ast_framehook_list_contains_no_active(ast_channel_framehooks(chan));
}
static void destroy_hooks(struct ast_channel *chan)
More information about the asterisk-commits
mailing list