Revision 71a04f89 plugins/janus_videoroom.c

View differences:

plugins/janus_videoroom.c
283 283

  
284 284
/* Useful stuff */
285 285
static volatile gint initialized = 0, stopping = 0;
286
static gboolean notify_events = TRUE;
286 287
static janus_callbacks *gateway = NULL;
287 288
static GThread *handler_thread;
288 289
static GThread *watchdog;
......
756 757
		janus_config_item *key = janus_config_get_item_drilldown(config, "general", "admin_key");
757 758
		if(key != NULL && key->value != NULL)
758 759
			admin_key = g_strdup(key->value);
760
		janus_config_item *events = janus_config_get_item_drilldown(config, "general", "events");
761
		if(events != NULL && events->value != NULL)
762
			notify_events = janus_is_true(events->value);
763
		if(!notify_events && callback->events_is_enabled()) {
764
			JANUS_LOG(LOG_WARN, "Notification of events to handlers disabled for %s\n", JANUS_VIDEOROOM_NAME);
765
		}
759 766
		/* Iterate on all rooms */
760 767
		GList *cl = janus_config_get_categories(config);
761 768
		while(cl != NULL) {
......
1481 1488
		json_object_set_new(response, "videoroom", json_string("created"));
1482 1489
		json_object_set_new(response, "room", json_integer(videoroom->room_id));
1483 1490
		/* Also notify event handlers */
1484
		if(gateway->events_is_enabled()) {
1491
		if(notify_events && gateway->events_is_enabled()) {
1485 1492
			json_t *info = json_object();
1486 1493
			json_object_set_new(info, "event", json_string("created"));
1487 1494
			json_object_set_new(info, "room", json_integer(videoroom->room_id));
......
1539 1546
		g_free(destroyed_text);
1540 1547
		janus_mutex_unlock(&videoroom->participants_mutex);
1541 1548
		/* Also notify event handlers */
1542
		if(gateway->events_is_enabled()) {
1549
		if(notify_events && gateway->events_is_enabled()) {
1543 1550
			json_t *info = json_object();
1544 1551
			json_object_set_new(info, "event", json_string("destroyed"));
1545 1552
			json_object_set_new(info, "room", json_integer(room_id));
......
1986 1993
			g_free(pub_text);
1987 1994
			janus_mutex_unlock(&videoroom->participants_mutex);
1988 1995
			/* Also notify event handlers */
1989
			if(gateway->events_is_enabled()) {
1996
			if(notify_events && gateway->events_is_enabled()) {
1990 1997
				json_t *info = json_object();
1991 1998
				json_object_set_new(info, "event", json_string("published"));
1992 1999
				json_object_set_new(info, "room", json_integer(participant->room->room_id));
......
2010 2017
					JANUS_LOG(LOG_VERB, "New listener available, sending PLI to %"SCNu64" (%s)\n", p->user_id, p->display ? p->display : "??");
2011 2018
					gateway->relay_rtcp(p->session->handle, 1, buf, 12);
2012 2019
					/* Also notify event handlers */
2013
					if(gateway->events_is_enabled()) {
2020
					if(notify_events && gateway->events_is_enabled()) {
2014 2021
						json_t *info = json_object();
2015 2022
						json_object_set_new(info, "event", json_string("subscribed"));
2016 2023
						json_object_set_new(info, "room", json_integer(p->room->room_id));
......
2379 2386
				janus_mutex_unlock(&publisher->listeners_mutex);
2380 2387
				listener->feed = NULL;
2381 2388
				/* Also notify event handlers */
2382
				if(gateway->events_is_enabled()) {
2389
				if(notify_events && gateway->events_is_enabled()) {
2383 2390
					json_t *info = json_object();
2384 2391
					json_object_set_new(info, "event", json_string("unsubscribed"));
2385 2392
					json_object_set_new(info, "room", json_integer(publisher->room->room_id));
......
2737 2744
				json_object_set_new(event, "id", json_integer(user_id));
2738 2745
				json_object_set_new(event, "publishers", list);
2739 2746
				/* Also notify event handlers */
2740
				if(gateway->events_is_enabled()) {
2747
				if(notify_events && gateway->events_is_enabled()) {
2741 2748
					json_t *info = json_object();
2742 2749
					json_object_set_new(info, "event", json_string("joined"));
2743 2750
					json_object_set_new(info, "room", json_integer(videoroom->room_id));
......
2831 2838
						root = NULL;
2832 2839
						janus_videoroom_message_free(msg);
2833 2840
						/* Also notify event handlers */
2834
						if(gateway->events_is_enabled()) {
2841
						if(notify_events && gateway->events_is_enabled()) {
2835 2842
							json_t *info = json_object();
2836 2843
							json_object_set_new(info, "event", json_string("subscribing"));
2837 2844
							json_object_set_new(info, "room", json_integer(videoroom->room_id));
......
3029 3036
				json_object_set_new(event, "room", json_integer(participant->room->room_id));
3030 3037
				json_object_set_new(event, "configured", json_string("ok"));
3031 3038
				/* Also notify event handlers */
3032
				if(gateway->events_is_enabled()) {
3039
				if(notify_events && gateway->events_is_enabled()) {
3033 3040
					json_t *info = json_object();
3034 3041
					json_object_set_new(info, "event", json_string("configured"));
3035 3042
					json_object_set_new(info, "room", json_integer(participant->room->room_id));
......
3219 3226
				if(publisher->display)
3220 3227
					json_object_set_new(event, "display", json_string(publisher->display));
3221 3228
				/* Also notify event handlers */
3222
				if(gateway->events_is_enabled()) {
3229
				if(notify_events && gateway->events_is_enabled()) {
3223 3230
					json_t *info = json_object();
3224 3231
					json_object_set_new(info, "event", json_string("switched"));
3225 3232
					json_object_set_new(info, "room", json_integer(publisher->room->room_id));

Also available in: Unified diff