[asterisk-commits] rmudgett: branch rmudgett/bridge_phase r386155 - in /team/rmudgett/bridge_pha...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Apr 19 16:09:05 CDT 2013


Author: rmudgett
Date: Fri Apr 19 16:09:03 2013
New Revision: 386155

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=386155
Log:
Address local channel optimization review feedback.

Modified:
    team/rmudgett/bridge_phase/channels/chan_local.c
    team/rmudgett/bridge_phase/include/asterisk/bridging.h
    team/rmudgett/bridge_phase/main/bridging.c

Modified: team/rmudgett/bridge_phase/channels/chan_local.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/bridge_phase/channels/chan_local.c?view=diff&rev=386155&r1=386154&r2=386155
==============================================================================
--- team/rmudgett/bridge_phase/channels/chan_local.c (original)
+++ team/rmudgett/bridge_phase/channels/chan_local.c Fri Apr 19 16:09:03 2013
@@ -152,9 +152,9 @@
 	struct ast_channel *chan;       /*!< Outbound channel - PBX is run here */
 };
 
-#define LOCAL_LAUNCHED_PBX    (1 << 1) /*!< PBX was launched */
-#define LOCAL_NO_OPTIMIZATION (1 << 2) /*!< Do not optimize using masquerading */
-#define LOCAL_MOH_PASSTHRU    (1 << 3) /*!< Pass through music on hold start/stop frames */
+#define LOCAL_LAUNCHED_PBX    (1 << 0) /*!< PBX was launched */
+#define LOCAL_NO_OPTIMIZATION (1 << 1) /*!< Do not optimize using masquerading */
+#define LOCAL_MOH_PASSTHRU    (1 << 2) /*!< Pass through music on hold start/stop frames */
 
 /*!
  * \brief Send a pvt in with no locks held and get all locks
@@ -461,7 +461,7 @@
  * \retval 0 if local channels were not optimized out.
  * \retval non-zero if local channels were optimized out.
  */
-static int optimized_out(struct ast_channel *ast, struct local_pvt *p)
+static int got_optimized_out(struct ast_channel *ast, struct local_pvt *p)
 {
 	/* Do a few conditional checks early on just to see if this optimization is possible */
 	if (ast_test_flag(p, LOCAL_NO_OPTIMIZATION) || !p->chan || !p->owner) {
@@ -473,7 +473,7 @@
 	if (ast == p->chan) {
 		return ast_bridge_local_optimized_out(p->chan, p->owner);
 	}
-	/* What is ast? */
+	/* ast is not valid to optimize. */
 	return 0;
 }
 
@@ -486,7 +486,6 @@
 {
 	struct local_pvt *p = ast_channel_tech_pvt(ast);
 	int res = -1;
-	int isoutbound;
 
 	if (!p) {
 		return -1;
@@ -498,13 +497,12 @@
 	switch (f->frametype) {
 	case AST_FRAME_VOICE:
 	case AST_FRAME_VIDEO:
-		if (optimized_out(ast, p)) {
+		if (got_optimized_out(ast, p)) {
 			break;
 		}
 		/* fall through */
 	default:
-		isoutbound = IS_OUTBOUND(ast, p);
-		res = local_queue_frame(p, isoutbound, f, ast, 1);
+		res = local_queue_frame(p, IS_OUTBOUND(ast, p), f, ast, 1);
 		break;
 	}
 	ao2_unlock(p);

Modified: team/rmudgett/bridge_phase/include/asterisk/bridging.h
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/bridge_phase/include/asterisk/bridging.h?view=diff&rev=386155&r1=386154&r2=386155
==============================================================================
--- team/rmudgett/bridge_phase/include/asterisk/bridging.h (original)
+++ team/rmudgett/bridge_phase/include/asterisk/bridging.h Fri Apr 19 16:09:03 2013
@@ -847,7 +847,7 @@
  * \param chan Local channel writing a frame into the channel driver.
  * \param peer Other local channel in the pair.
  *
- * \note It is assumed that chan is locked.
+ * \note It is assumed that chan is already locked.
  *
  * \retval 0 if local channels were not optimized out.
  * \retval non-zero if local channels were optimized out.

Modified: team/rmudgett/bridge_phase/main/bridging.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/bridge_phase/main/bridging.c?view=diff&rev=386155&r1=386154&r2=386155
==============================================================================
--- team/rmudgett/bridge_phase/main/bridging.c (original)
+++ team/rmudgett/bridge_phase/main/bridging.c Fri Apr 19 16:09:03 2013
@@ -3178,12 +3178,12 @@
  *
  * \param chan Local channel writing a frame into the channel driver.
  *
- * \note It is assumed that chan is locked.
+ * \note It is assumed that chan is already locked.
  *
  * \retval bridge on success with bridge and bridge_channel locked.
  * \retval NULL if cannot do optimization now.
  */
-static struct ast_bridge *lock_local_chan(struct ast_channel *chan)
+static struct ast_bridge *optimize_lock_chan_stack(struct ast_channel *chan)
 {
 	struct ast_bridge *bridge;
 	struct ast_bridge_channel *bridge_channel;
@@ -3223,7 +3223,7 @@
  * \retval bridge on success with bridge, bridge_channel, and peer locked.
  * \retval NULL if cannot do optimization now.
  */
-static struct ast_bridge *lock_local_peer(struct ast_channel *peer)
+static struct ast_bridge *optimize_lock_peer_stack(struct ast_channel *peer)
 {
 	struct ast_bridge *bridge;
 	struct ast_bridge_channel *bridge_channel;
@@ -3268,13 +3268,13 @@
 	struct ast_bridge_channel *peer_bridge_channel;
 	int res = 0;
 
-	chan_bridge = lock_local_chan(chan);
+	chan_bridge = optimize_lock_chan_stack(chan);
 	if (!chan_bridge) {
 		return res;
 	}
 	chan_bridge_channel = ast_channel_internal_bridge_channel(chan);
 
-	peer_bridge = lock_local_peer(peer);
+	peer_bridge = optimize_lock_peer_stack(peer);
 	if (peer_bridge) {
 		struct ast_bridge *dst_bridge = NULL;
 		struct ast_bridge *src_bridge = NULL;




More information about the asterisk-commits mailing list