[asterisk-commits] kmoore: branch kmoore/stasis-bridge_events r384738 - /team/kmoore/stasis-brid...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Thu Apr 4 11:01:09 CDT 2013
Author: kmoore
Date: Thu Apr 4 11:01:05 2013
New Revision: 384738
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=384738
Log:
Add bridge state publishing to bridging
Modified:
team/kmoore/stasis-bridge_events/main/bridging.c
Modified: team/kmoore/stasis-bridge_events/main/bridging.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis-bridge_events/main/bridging.c?view=diff&rev=384738&r1=384737&r2=384738
==============================================================================
--- team/kmoore/stasis-bridge_events/main/bridging.c (original)
+++ team/kmoore/stasis-bridge_events/main/bridging.c Thu Apr 4 11:01:05 2013
@@ -40,6 +40,7 @@
#include "asterisk/lock.h"
#include "asterisk/linkedlists.h"
#include "asterisk/bridging.h"
+#include "asterisk/stasis_bridging.h"
#include "asterisk/bridging_technology.h"
#include "asterisk/app.h"
#include "asterisk/file.h"
@@ -421,6 +422,7 @@
bridge->v_table->pull(bridge, bridge_channel);
bridge->reconfigured = 1;
+ ast_bridge_publish_state(bridge);
}
/*!
@@ -492,6 +494,7 @@
}
bridge->reconfigured = 1;
+ ast_bridge_publish_state(bridge);
}
/*!
@@ -887,6 +890,12 @@
static void destroy_bridge(void *obj)
{
struct ast_bridge *bridge = obj;
+ RAII_VAR(struct stasis_message *, msg, NULL, ao2_cleanup);
+
+ msg = stasis_cache_clear_create(ast_bridge_snapshot_type(), bridge->uniqueid);
+ if (msg) {
+ stasis_publish(ast_bridge_topic(bridge), msg);
+ }
ast_debug(1, "Bridge %s: actually destroying %s bridge, nobody wants it anymore\n",
bridge->uniqueid, bridge->v_table->name);
@@ -987,6 +996,11 @@
return NULL;
}
+ if (!ast_bridge_topic(self)) {
+ ao2_ref(self, -1);
+ return NULL;
+ }
+
return self;
}
@@ -1093,6 +1107,9 @@
bridge = ast_bridge_alloc(sizeof(struct ast_bridge), &ast_bridge_base_v_table);
bridge = ast_bridge_base_init(bridge, capabilities, flags);
+ if (bridge) {
+ ast_bridge_publish_state(bridge);
+ }
return bridge;
}
@@ -3338,6 +3355,7 @@
{
ast_bridge_lock(bridge);
bridge->internal_mixing_interval = mixing_interval;
+ ast_bridge_publish_state(bridge);
ast_bridge_unlock(bridge);
}
@@ -3345,6 +3363,7 @@
{
ast_bridge_lock(bridge);
bridge->internal_sample_rate = sample_rate;
+ ast_bridge_publish_state(bridge);
ast_bridge_unlock(bridge);
}
@@ -3377,6 +3396,7 @@
bridge->video_mode.mode_data.single_src_data.chan_vsrc = ast_channel_ref(video_src_chan);
ast_test_suite_event_notify("BRIDGE_VIDEO_MODE", "Message: video mode set to single source\r\nVideo Mode: %d\r\nVideo Channel: %s", bridge->video_mode.mode, ast_channel_name(video_src_chan));
ast_indicate(video_src_chan, AST_CONTROL_VIDUPDATE);
+ ast_bridge_publish_state(bridge);
ast_bridge_unlock(bridge);
}
@@ -3386,6 +3406,7 @@
cleanup_video_mode(bridge);
bridge->video_mode.mode = AST_BRIDGE_VIDEO_MODE_TALKER_SRC;
ast_test_suite_event_notify("BRIDGE_VIDEO_MODE", "Message: video mode set to talker source\r\nVideo Mode: %d", bridge->video_mode.mode);
+ ast_bridge_publish_state(bridge);
ast_bridge_unlock(bridge);
}
@@ -3414,6 +3435,7 @@
data->average_talking_energy = talker_energy;
ast_test_suite_event_notify("BRIDGE_VIDEO_SRC", "Message: video source updated\r\nVideo Channel: %s", ast_channel_name(data->chan_vsrc));
ast_indicate(data->chan_vsrc, AST_CONTROL_VIDUPDATE);
+ ast_bridge_publish_state(bridge);
} else if ((data->average_talking_energy < talker_energy) && !is_keyframe) {
ast_indicate(chan, AST_CONTROL_VIDUPDATE);
} else if (!data->chan_vsrc && is_keyframe) {
@@ -3421,6 +3443,7 @@
data->average_talking_energy = talker_energy;
ast_test_suite_event_notify("BRIDGE_VIDEO_SRC", "Message: video source updated\r\nVideo Channel: %s", ast_channel_name(data->chan_vsrc));
ast_indicate(chan, AST_CONTROL_VIDUPDATE);
+ ast_bridge_publish_state(bridge);
} else if (!data->chan_old_vsrc && is_keyframe) {
data->chan_old_vsrc = ast_channel_ref(chan);
ast_indicate(chan, AST_CONTROL_VIDUPDATE);
@@ -3507,6 +3530,7 @@
bridge->video_mode.mode_data.talker_src_data.chan_old_vsrc = NULL;
}
}
+ ast_bridge_publish_state(bridge);
ast_bridge_unlock(bridge);
}
More information about the asterisk-commits
mailing list