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

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Mar 15 15:15:42 CDT 2013


Author: rmudgett
Date: Fri Mar 15 15:15:38 2013
New Revision: 383260

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=383260
Log:
Rename ast_bridge and ast_bridge_channel bridge_pvt to tech_pvt since that is what it really is.

Modified:
    team/rmudgett/bridge_phase/bridges/bridge_holding.c
    team/rmudgett/bridge_phase/bridges/bridge_softmix.c
    team/rmudgett/bridge_phase/include/asterisk/bridging.h
    team/rmudgett/bridge_phase/main/bridging.c

Modified: team/rmudgett/bridge_phase/bridges/bridge_holding.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/bridge_phase/bridges/bridge_holding.c?view=diff&rev=383260&r1=383259&r2=383260
==============================================================================
--- team/rmudgett/bridge_phase/bridges/bridge_holding.c (original)
+++ team/rmudgett/bridge_phase/bridges/bridge_holding.c Fri Mar 15 15:15:38 2013
@@ -71,7 +71,7 @@
 
 static void participant_stop_hold_audio(struct ast_bridge_channel *bridge_channel)
 {
-	struct holding_channel *hc = bridge_channel->bridge_pvt;
+	struct holding_channel *hc = bridge_channel->tech_pvt;
 	if (!hc) {
 		return;
 	}
@@ -101,7 +101,7 @@
 /* This should only be called on verified holding_participants. */
 static void participant_start_hold_audio(struct ast_bridge_channel *bridge_channel)
 {
-	struct holding_channel *hc = bridge_channel->bridge_pvt;
+	struct holding_channel *hc = bridge_channel->tech_pvt;
 	const char *moh_class;
 
 	if (!hc) {
@@ -124,7 +124,7 @@
 static void handle_participant_join(struct ast_bridge_channel *bridge_channel, struct ast_bridge_channel *announcer_channel)
 {
 	struct ast_channel *us = bridge_channel->chan;
-	struct holding_channel *hc = bridge_channel->bridge_pvt;
+	struct holding_channel *hc = bridge_channel->tech_pvt;
 	const char *idle_mode = ast_bridge_channel_get_role_option(bridge_channel, "holding_participant", "idle_mode");
 
 
@@ -165,22 +165,22 @@
 		return -1;
 	}
 
-	bridge_channel->bridge_pvt = hc;
+	bridge_channel->tech_pvt = hc;
 
 	/* The bridge pvt holds the announcer channel if we have one. */
-	announcer_channel = bridge->bridge_pvt;
+	announcer_channel = bridge->tech_pvt;
 
 	if (ast_bridge_channel_has_role(bridge_channel, "announcer")) {
 		/* If another announcer already exists, scrap the holding channel struct so we know to ignore it in the future */
 		if (announcer_channel) {
-			bridge_channel->bridge_pvt = NULL;
+			bridge_channel->tech_pvt = NULL;
 			ast_free(hc);
 			ast_log(LOG_WARNING, "A second announcer channel %s attempted to enter a holding bridge.\n",
 				ast_channel_name(announcer_channel->chan));
 			return -1;
 		}
 
-		bridge->bridge_pvt = bridge_channel;
+		bridge->tech_pvt = bridge_channel;
 		ast_set_flag(&hc->holding_roles, HOLDING_ROLE_ANNOUNCER);
 
 		/* The announcer should always be made compatible with signed linear */
@@ -208,7 +208,7 @@
 
 static void participant_reaction_announcer_leave(struct ast_bridge_channel *bridge_channel)
 {
-	struct holding_channel *hc = bridge_channel->bridge_pvt;
+	struct holding_channel *hc = bridge_channel->tech_pvt;
 
 	if (!hc) {
 		/* We are dealing with a channel that failed to join properly. Skip it. */
@@ -224,20 +224,20 @@
 static void holding_bridge_leave(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel)
 {
 	struct ast_bridge_channel *other_channel;
-	struct holding_channel *hc = bridge_channel->bridge_pvt;
+	struct holding_channel *hc = bridge_channel->tech_pvt;
 
 	if (!hc) {
 		return;
 	}
 
 	if (!ast_test_flag(&hc->holding_roles, HOLDING_ROLE_ANNOUNCER)) {
-		/* It's not an announcer so nothing needs to react to its departure. Just free the bridge_pvt. */
-		if (!bridge->bridge_pvt) {
+		/* It's not an announcer so nothing needs to react to its departure. Just free the tech_pvt. */
+		if (!bridge->tech_pvt) {
 			/* Since no announcer is in the channel, we may be playing MOH/ringing. Stop that. */
 			participant_stop_hold_audio(bridge_channel);
 		}
 		ast_free(hc);
-		bridge_channel->bridge_pvt = NULL;
+		bridge_channel->tech_pvt = NULL;
 		return;
 	}
 
@@ -246,19 +246,19 @@
 		participant_reaction_announcer_leave(other_channel);
 	}
 
-	/* Since the announcer is leaving, we should clear the bridge_pvt pointing to it */
-	bridge->bridge_pvt = NULL;
+	/* Since the announcer is leaving, we should clear the tech_pvt pointing to it */
+	bridge->tech_pvt = NULL;
 
 	ast_free(hc);
-	bridge_channel->bridge_pvt = NULL;
+	bridge_channel->tech_pvt = NULL;
 }
 
 static int holding_bridge_write(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel, struct ast_frame *frame)
 {
 	struct ast_bridge_channel *other;
-	struct holding_channel *hc = bridge_channel->bridge_pvt;
-
-	/* If there is no bridge_pvt, then the channel failed to allocate one when it joined and is borked. Don't listen to him. */
+	struct holding_channel *hc = bridge_channel->tech_pvt;
+
+	/* If there is no tech_pvt, then the channel failed to allocate one when it joined and is borked. Don't listen to him. */
 	if (!hc) {
 		return -1;
 	}
@@ -270,7 +270,7 @@
 
 	/* Ok, so we are the announcer and there are one or more people available to receive our writes. Let's do it. */
 	AST_LIST_TRAVERSE(&bridge->channels, other, entry) {
-		if (!other->bridge_pvt) {
+		if (!other->tech_pvt) {
 			continue;
 		}
 		if (bridge_channel == other) {

Modified: team/rmudgett/bridge_phase/bridges/bridge_softmix.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/bridge_phase/bridges/bridge_softmix.c?view=diff&rev=383260&r1=383259&r2=383260
==============================================================================
--- team/rmudgett/bridge_phase/bridges/bridge_softmix.c (original)
+++ team/rmudgett/bridge_phase/bridges/bridge_softmix.c Fri Mar 15 15:15:38 2013
@@ -307,7 +307,7 @@
 
 static void set_softmix_bridge_data(int rate, int interval, struct ast_bridge_channel *bridge_channel, int reset)
 {
-	struct softmix_channel *sc = bridge_channel->bridge_pvt;
+	struct softmix_channel *sc = bridge_channel->tech_pvt;
 	unsigned int channel_read_rate = ast_format_rate(ast_channel_rawreadformat(bridge_channel->chan));
 
 	ast_mutex_lock(&sc->lock);
@@ -366,14 +366,14 @@
 /*! \brief Function called when a channel is unsuspended from the bridge */
 static void softmix_bridge_unsuspend(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel)
 {
-	softmix_poke_thread(bridge->bridge_pvt);
+	softmix_poke_thread(bridge->tech_pvt);
 }
 
 /*! \brief Function called when a channel is joined into the bridge */
 static int softmix_bridge_join(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel)
 {
 	struct softmix_channel *sc;
-	struct softmix_bridge_data *softmix_data = bridge->bridge_pvt;
+	struct softmix_bridge_data *softmix_data = bridge->tech_pvt;
 
 	/* Create a new softmix_channel structure and allocate various things on it */
 	if (!(sc = ast_calloc(1, sizeof(*sc)))) {
@@ -384,7 +384,7 @@
 	ast_mutex_init(&sc->lock);
 
 	/* Can't forget to record our pvt structure within the bridged channel structure */
-	bridge_channel->bridge_pvt = sc;
+	bridge_channel->tech_pvt = sc;
 
 	set_softmix_bridge_data(softmix_data->internal_rate,
 		softmix_data->internal_mixing_interval
@@ -399,12 +399,12 @@
 /*! \brief Function called when a channel leaves the bridge */
 static void softmix_bridge_leave(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel)
 {
-	struct softmix_channel *sc = bridge_channel->bridge_pvt;
+	struct softmix_channel *sc = bridge_channel->tech_pvt;
 
 	if (!sc) {
 		return;
 	}
-	bridge_channel->bridge_pvt = NULL;
+	bridge_channel->tech_pvt = NULL;
 
 	/* Drop mutex lock */
 	ast_mutex_destroy(&sc->lock);
@@ -471,8 +471,8 @@
 /*! \brief Function called when a channel writes a frame into the bridge */
 static int softmix_bridge_write(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel, struct ast_frame *frame)
 {
-	struct softmix_channel *sc = bridge_channel->bridge_pvt;
-	struct softmix_bridge_data *softmix_data = bridge->bridge_pvt;
+	struct softmix_channel *sc = bridge_channel->tech_pvt;
+	struct softmix_bridge_data *softmix_data = bridge->tech_pvt;
 	int totalsilence = 0;
 	int cur_energy = 0;
 	int silence_threshold = bridge_channel->tech_args.silence_threshold ?
@@ -718,7 +718,7 @@
 {
 	struct softmix_stats stats = { { 0 }, };
 	struct softmix_mixing_array mixing_array;
-	struct softmix_bridge_data *softmix_data = bridge->bridge_pvt;
+	struct softmix_bridge_data *softmix_data = bridge->tech_pvt;
 	struct ast_timer *timer;
 	struct softmix_translate_helper trans_helper;
 	int16_t buf[MAX_DATALEN];
@@ -778,7 +778,7 @@
 
 		/* Go through pulling audio from each factory that has it available */
 		AST_LIST_TRAVERSE(&bridge->channels, bridge_channel, entry) {
-			struct softmix_channel *sc = bridge_channel->bridge_pvt;
+			struct softmix_channel *sc = bridge_channel->tech_pvt;
 
 			/* Update the sample rate to match the bridge's native sample rate if necessary. */
 			if (update_all_rates) {
@@ -813,7 +813,7 @@
 
 		/* Next step go through removing the channel's own audio and creating a good frame... */
 		AST_LIST_TRAVERSE(&bridge->channels, bridge_channel, entry) {
-			struct softmix_channel *sc = bridge_channel->bridge_pvt;
+			struct softmix_channel *sc = bridge_channel->tech_pvt;
 
 			if (bridge_channel->suspended) {
 				continue;
@@ -894,7 +894,7 @@
 
 	ast_debug(1, "Starting mixing thread for bridge %p\n", bridge);
 
-	softmix_data = bridge->bridge_pvt;
+	softmix_data = bridge->tech_pvt;
 	while (!softmix_data->stop) {
 		if (!bridge->num_active) {
 			/* Wait for something to happen to the bridge. */
@@ -955,13 +955,13 @@
 	softmix_data->internal_rate = 8000;
 	softmix_data->internal_mixing_interval = DEFAULT_SOFTMIX_INTERVAL;
 
-	bridge->bridge_pvt = softmix_data;
+	bridge->tech_pvt = softmix_data;
 
 	/* Start the mixing thread. */
 	if (ast_pthread_create(&softmix_data->thread, NULL, softmix_mixing_thread, bridge)) {
 		softmix_data->thread = AST_PTHREADT_NULL;
 		softmix_bridge_data_destroy(softmix_data);
-		bridge->bridge_pvt = NULL;
+		bridge->tech_pvt = NULL;
 		return -1;
 	}
 
@@ -974,7 +974,7 @@
 	struct softmix_bridge_data *softmix_data;
 	pthread_t thread;
 
-	softmix_data = bridge->bridge_pvt;
+	softmix_data = bridge->tech_pvt;
 	if (!softmix_data) {
 		return;
 	}
@@ -991,7 +991,7 @@
 	}
 
 	softmix_bridge_data_destroy(softmix_data);
-	bridge->bridge_pvt = NULL;
+	bridge->tech_pvt = NULL;
 }
 
 static struct ast_bridge_technology softmix_bridge = {

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=383260&r1=383259&r2=383260
==============================================================================
--- team/rmudgett/bridge_phase/include/asterisk/bridging.h (original)
+++ team/rmudgett/bridge_phase/include/asterisk/bridging.h Fri Mar 15 15:15:38 2013
@@ -129,7 +129,7 @@
 	/*! Bridge this channel is participating in */
 	struct ast_bridge *bridge;
 	/*! Private information unique to the bridge technology */
-	void *bridge_pvt;
+	void *tech_pvt;
 	/*! Thread handling the bridged channel (Needed by ast_bridge_depart) */
 	pthread_t thread;
 	/*! TRUE if the channel is in a bridge. */
@@ -246,7 +246,7 @@
 	/*! Bridge technology that is handling the bridge */
 	struct ast_bridge_technology *technology;
 	/*! Private information unique to the bridge technology */
-	void *bridge_pvt;
+	void *tech_pvt;
 	/*! Call ID associated with the bridge */
 	struct ast_callid *callid;
 	/*! Linked list of channels participating in the bridge */

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=383260&r1=383259&r2=383260
==============================================================================
--- team/rmudgett/bridge_phase/main/bridging.c (original)
+++ team/rmudgett/bridge_phase/main/bridging.c Fri Mar 15 15:15:38 2013
@@ -807,7 +807,7 @@
 	struct tech_deferred_destroy *deferred = action->data.ptr;
 	struct ast_bridge dummy_bridge = {
 		.technology = deferred->tech,
-		.bridge_pvt = deferred->tech_pvt,
+		.tech_pvt = deferred->tech_pvt,
 		};
 
 	ast_debug(1, "Giving bridge technology %s the bridge structure %p (really %p) to destroy (deferred)\n",
@@ -1071,7 +1071,7 @@
 	struct ast_frame *deferred_action;
 	struct ast_bridge dummy_bridge = {
 		.technology = bridge->technology,
-		.bridge_pvt = bridge->bridge_pvt,
+		.tech_pvt = bridge->tech_pvt,
 	};
 
 	if (bridge->dissolved) {
@@ -1124,7 +1124,7 @@
 	if (old_technology->destroy) {
 		struct tech_deferred_destroy deferred_tech_destroy = {
 			.tech = dummy_bridge.technology,
-			.tech_pvt = dummy_bridge.bridge_pvt,
+			.tech_pvt = dummy_bridge.tech_pvt,
 		};
 		struct ast_frame action = {
 			.frametype = AST_FRAME_BRIDGE_ACTION,
@@ -1156,11 +1156,11 @@
 
 	/*
 	 * Since we are soon going to pass this bridge to a new
-	 * technology we need to NULL out the bridge_pvt pointer but
+	 * technology we need to NULL out the tech_pvt pointer but
 	 * don't worry as it still exists in dummy_bridge, ditto for the
 	 * old technology.
 	 */
-	bridge->bridge_pvt = NULL;
+	bridge->tech_pvt = NULL;
 	bridge->technology = new_technology;
 
 	/* Setup the new bridge technology. */
@@ -1170,7 +1170,7 @@
 /* BUGBUG need to output the bridge id for tracking why. */
 		ast_log(LOG_WARNING, "Bridge technology %s for bridge %p failed to get setup\n",
 			new_technology->name, bridge);
-		bridge->bridge_pvt = dummy_bridge.bridge_pvt;
+		bridge->tech_pvt = dummy_bridge.tech_pvt;
 		bridge->technology = dummy_bridge.technology;
 		ast_module_unref(new_technology->mod);
 		return -1;




More information about the asterisk-commits mailing list