summaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
authorRichard Mudgett <rmudgett@digium.com>2013-07-19 22:47:10 +0000
committerRichard Mudgett <rmudgett@digium.com>2013-07-19 22:47:10 +0000
commit2838683742cd21a452298801e41e85cd890add06 (patch)
tree322a99f305585589f457e272e4f4b1b9843bb4a1 /main
parenta6329a3acf0109d5b364476d212cd0aee4c20dfb (diff)
Extract a repeated test into ast_channel_has_audio_frame_or_monitor().
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@394825 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'main')
-rw-r--r--main/bridging.c11
-rw-r--r--main/channel.c8
2 files changed, 10 insertions, 9 deletions
diff --git a/main/bridging.c b/main/bridging.c
index 4304dfb36..f833ccb81 100644
--- a/main/bridging.c
+++ b/main/bridging.c
@@ -63,7 +63,6 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#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;
@@ -4722,10 +4721,7 @@ static struct ast_bridge *optimize_lock_chan_stack(struct ast_channel *chan)
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;
}
@@ -4771,10 +4767,7 @@ static struct ast_bridge *optimize_lock_peer_stack(struct ast_channel *peer)
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;
diff --git a/main/channel.c b/main/channel.c
index fba59d4df..f76d6a845 100644
--- a/main/channel.c
+++ b/main/channel.c
@@ -2629,6 +2629,14 @@ void ast_set_hangupsource(struct ast_channel *chan, const char *source, int forc
}
}
+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)
{
if (ast_channel_audiohooks(chan)) {