Revision 78955474 plugins/janus_videoroom.c

View differences:

plugins/janus_videoroom.c
246 246
	uint16_t fir_freq;			/* Regular FIR frequency (0=disabled) */
247 247
	gboolean record;			/* Whether the feeds from publishers in this room should be recorded */
248 248
	char *rec_dir;				/* Where to save the recordings of this room, if enabled */
249
	guint64 destroyed;			/* Value to flag the room for destruction, done lazily */
249
	gint64 destroyed;			/* Value to flag the room for destruction, done lazily */
250 250
	GHashTable *participants;	/* Map of potential publishers (we get listeners from them) */
251 251
	janus_mutex participants_mutex;/* Mutex to protect room properties */
252 252
} janus_videoroom;
......
261 261
	gpointer participant;
262 262
	gboolean started;
263 263
	gboolean stopping;
264
	guint64 destroyed;	/* Time at which this session was marked as destroyed */
264
	gboolean hangingup;
265
	gint64 destroyed;	/* Time at which this session was marked as destroyed */
265 266
} janus_videoroom_session;
266 267
static GHashTable *sessions;
267 268
static GList *old_sessions;
......
778 779
	/* Cleaning up and removing the session is done in a lazy way */
779 780
	janus_mutex_lock(&sessions_mutex);
780 781
	if(!session->destroyed) {
781
		session->destroyed = janus_get_monotonic_time();
782 782
		/* Any related WebRTC PeerConnection is not available anymore either */
783 783
		janus_videoroom_hangup_media(handle);
784
		session->destroyed = janus_get_monotonic_time();
784 785
		old_sessions = g_list_append(old_sessions, session);
785 786
		if(session->participant_type == janus_videoroom_p_type_publisher) {
786 787
			/* Get rid of publisher */
......
1929 1930
		JANUS_LOG(LOG_ERR, "No session associated with this handle...\n");
1930 1931
		return;
1931 1932
	}
1932
	if(session->destroyed)
1933
		return;
1934 1933
	session->started = FALSE;
1934
	if(session->destroyed || session->hangingup)
1935
		return;
1936
	session->hangingup = TRUE;
1935 1937
	/* Send an event to the browser and tell the PeerConnection is over */
1936 1938
	if(session->participant_type == janus_videoroom_p_type_publisher) {
1937 1939
		/* This publisher just 'unpublished' */
......
2027 2029
		}
2028 2030
		/* TODO Should we close the handle as well? */
2029 2031
	}
2032
	/* Done */
2033
	session->hangingup = FALSE;
2030 2034
}
2031 2035

  
2032 2036
/* Thread to handle incoming messages */

Also available in: Unified diff