[svn-commits] rmudgett: branch rmudgett/bridge_phase r383059 - /team/rmudgett/bridge_phase/...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Thu Mar 14 11:48:03 CDT 2013


Author: rmudgett
Date: Thu Mar 14 11:47:59 2013
New Revision: 383059

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=383059
Log:
Extract interval timer code from ast_bridge_handle_trip().

Added notes about further interval hook improvements.

Modified:
    team/rmudgett/bridge_phase/main/bridging.c

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=383059&r1=383058&r2=383059
==============================================================================
--- team/rmudgett/bridge_phase/main/bridging.c (original)
+++ team/rmudgett/bridge_phase/main/bridging.c Thu Mar 14 11:47:59 2013
@@ -581,22 +581,6 @@
 static void ast_bridge_handle_trip(struct ast_bridge_channel *bridge_channel)
 {
 	struct ast_frame *frame;
-	struct ast_timer *interval_timer;
-
-	if (bridge_channel->features
-		&& (interval_timer = bridge_channel->features->interval_timer)) {
-		if (ast_wait_for_input(ast_timer_fd(interval_timer), 0) == 1) {
-			ast_timer_ack(interval_timer, 1);
-			if (bridge_channel_interval_ready(bridge_channel)) {
-				struct ast_frame interval_action = {
-					.frametype = AST_FRAME_BRIDGE_ACTION,
-					.subclass.integer = AST_BRIDGE_ACTION_INTERVAL,
-				};
-
-				ast_bridge_channel_queue_frame(bridge_channel, &interval_action);
-			}
-		}
-	}
 
 	if (bridge_channel->features && bridge_channel->features->mute) {
 		frame = ast_read_noaudio(bridge_channel->chan);
@@ -1444,7 +1428,7 @@
  * \brief Handle bridge channel write frame to channel.
  * \since 12.0.0
  *
- * \param bridge_channel Channel to outgoing frame.
+ * \param bridge_channel Channel to write outgoing frame.
  *
  * \return Nothing
  */
@@ -1480,6 +1464,36 @@
 		break;
 	}
 	ast_frfree(fr);
+}
+
+/*!
+ * \internal
+ * \brief Handle bridge channel interval expiration.
+ * \since 12.0.0
+ *
+ * \param bridge_channel Channel to check interval on.
+ *
+ * \return Nothing
+ */
+static void bridge_channel_handle_interval(struct ast_bridge_channel *bridge_channel)
+{
+	struct ast_timer *interval_timer;
+
+	if (bridge_channel->features
+		&& (interval_timer = bridge_channel->features->interval_timer)) {
+		if (ast_wait_for_input(ast_timer_fd(interval_timer), 0) == 1) {
+			ast_timer_ack(interval_timer, 1);
+			if (bridge_channel_interval_ready(bridge_channel)) {
+/* BUGBUG since this is now only run by the channel thread, there is no need to queue the action once this intervals become a first class wait item in bridge_channel_wait(). */
+				struct ast_frame interval_action = {
+					.frametype = AST_FRAME_BRIDGE_ACTION,
+					.subclass.integer = AST_BRIDGE_ACTION_INTERVAL,
+				};
+
+				ast_bridge_channel_queue_frame(bridge_channel, &interval_action);
+			}
+		}
+	}
 }
 
 /*!
@@ -1513,11 +1527,13 @@
 			bridge_channel->bridge);
 		ao2_unlock(bridge_channel);
 		outfd = -1;
+/* BUGBUG need to make the next expiring active interval setup ms timeout rather than holding up the chan reads. */
 		chan = ast_waitfor_nandfds(&bridge_channel->chan, 1,
 			&bridge_channel->alert_pipe[0], 1, NULL, &outfd, &ms);
 		if (!bridge_channel->suspended
 			&& bridge_channel->state == AST_BRIDGE_CHANNEL_STATE_WAIT) {
 			if (chan) {
+				bridge_channel_handle_interval(bridge_channel);
 				ast_bridge_handle_trip(bridge_channel);
 			} else if (-1 < outfd) {
 				bridge_channel_handle_write(bridge_channel);




More information about the svn-commits mailing list