Revision 71a04f89 plugins/janus_streaming.c

View differences:

plugins/janus_streaming.c
288 288

  
289 289
/* Useful stuff */
290 290
static volatile gint initialized = 0, stopping = 0;
291
static gboolean notify_events = TRUE;
291 292
static janus_callbacks *gateway = NULL;
292 293
static GThread *handler_thread;
293 294
static GThread *watchdog;
......
568 569
		janus_config_item *key = janus_config_get_item_drilldown(config, "general", "admin_key");
569 570
		if(key != NULL && key->value != NULL)
570 571
			admin_key = g_strdup(key->value);
572
		janus_config_item *events = janus_config_get_item_drilldown(config, "general", "events");
573
		if(events != NULL && events->value != NULL)
574
			notify_events = janus_is_true(events->value);
575
		if(!notify_events && callback->events_is_enabled()) {
576
			JANUS_LOG(LOG_WARN, "Notification of events to handlers disabled for %s\n", JANUS_STREAMING_NAME);
577
		}
571 578
		/* Iterate on all rooms */
572 579
		GList *cl = janus_config_get_categories(config);
573 580
		while(cl != NULL) {
......
1564 1571
		json_object_set_new(ml, "is_private", json_string(mp->is_private ? "true" : "false"));
1565 1572
		json_object_set_new(response, "stream", ml);
1566 1573
		/* Also notify event handlers */
1567
		if(gateway->events_is_enabled()) {
1574
		if(notify_events && gateway->events_is_enabled()) {
1568 1575
			json_t *info = json_object();
1569 1576
			json_object_set_new(info, "event", json_string("created"));
1570 1577
			json_object_set_new(info, "id", json_integer(mp->id));
......
1652 1659
			old_mountpoints = g_list_append(old_mountpoints, mp);
1653 1660
		}
1654 1661
		/* Also notify event handlers */
1655
		if(gateway->events_is_enabled()) {
1662
		if(notify_events && gateway->events_is_enabled()) {
1656 1663
			json_t *info = json_object();
1657 1664
			json_object_set_new(info, "event", json_string("destroyed"));
1658 1665
			json_object_set_new(info, "id", json_integer(id_value));
......
2216 2223
			/* We wait for the setup_media event to start: on the other hand, it may have already arrived */
2217 2224
			json_object_set_new(result, "status", json_string(session->started ? "started" : "starting"));
2218 2225
			/* Also notify event handlers */
2219
			if(gateway->events_is_enabled()) {
2226
			if(notify_events && gateway->events_is_enabled()) {
2220 2227
				json_t *info = json_object();
2221 2228
				json_object_set_new(info, "status", json_string("starting"));
2222 2229
				json_object_set_new(info, "id", json_integer(session->mountpoint->id));
......
2234 2241
			result = json_object();
2235 2242
			json_object_set_new(result, "status", json_string("pausing"));
2236 2243
			/* Also notify event handlers */
2237
			if(gateway->events_is_enabled()) {
2244
			if(notify_events && gateway->events_is_enabled()) {
2238 2245
				json_t *info = json_object();
2239 2246
				json_object_set_new(info, "status", json_string("pausing"));
2240 2247
				json_object_set_new(info, "id", json_integer(session->mountpoint->id));
......
2302 2309
			json_object_set_new(result, "switched", json_string("ok"));
2303 2310
			json_object_set_new(result, "id", json_integer(id_value));
2304 2311
			/* Also notify event handlers */
2305
			if(gateway->events_is_enabled()) {
2312
			if(notify_events && gateway->events_is_enabled()) {
2306 2313
				json_t *info = json_object();
2307 2314
				json_object_set_new(info, "status", json_string("switching"));
2308 2315
				json_object_set_new(info, "id", json_integer(id_value));
......
2330 2337
				janus_mutex_unlock(&session->mountpoint->mutex);
2331 2338
			}
2332 2339
			/* Also notify event handlers */
2333
			if(gateway->events_is_enabled()) {
2340
			if(notify_events && gateway->events_is_enabled()) {
2334 2341
				json_t *info = json_object();
2335 2342
				json_object_set_new(info, "status", json_string("stopping"));
2336 2343
				json_object_set_new(info, "id", json_integer(session->mountpoint->id));

Also available in: Unified diff