Revision c3654169 plugins/janus_videoroom.c

View differences:

plugins/janus_videoroom.c
1042 1042
}
1043 1043

  
1044 1044
static void janus_videoroom_leave_or_unpublish(janus_videoroom_participant *participant, gboolean is_leaving) {
1045
	json_t *event = json_object();
1046
	json_object_set_new(event, "videoroom", json_string("event"));
1047
	json_object_set_new(event, "room", json_integer(participant->room->room_id));
1048
	json_object_set_new(event, is_leaving ? "leaving" : "unpublished", json_integer(participant->user_id));
1049 1045
	/* we need to check if the room still exists, may have been destroyed already */
1050
	if(participant->room) {
1051
		if(!participant->room->destroyed) {
1052
			janus_mutex_lock(&participant->room->participants_mutex);
1053
			janus_videoroom_notify_participants(participant, event);
1054
			if(is_leaving) {
1055
				g_hash_table_remove(participant->room->participants, &participant->user_id);
1056
			}
1057
			janus_mutex_unlock(&participant->room->participants_mutex);
1046
	if(participant->room && !participant->room->destroyed) {
1047
		json_t *event = json_object();
1048
		json_object_set_new(event, "videoroom", json_string("event"));
1049
		json_object_set_new(event, "room", json_integer(participant->room->room_id));
1050
		json_object_set_new(event, is_leaving ? "leaving" : "unpublished", json_integer(participant->user_id));
1051
		janus_mutex_lock(&participant->room->participants_mutex);
1052
		janus_videoroom_notify_participants(participant, event);
1053
		if(is_leaving) {
1054
			g_hash_table_remove(participant->room->participants, &participant->user_id);
1058 1055
		}
1056
		janus_mutex_unlock(&participant->room->participants_mutex);
1057
		json_decref(event);
1059 1058
	}
1060
	json_decref(event);
1061 1059
}
1062 1060

  
1063 1061
void janus_videoroom_destroy_session(janus_plugin_session *handle, int *error) {

Also available in: Unified diff