Revision 78955474 plugins/janus_videocall.c

View differences:

plugins/janus_videocall.c
334 334
	uint64_t bitrate;
335 335
	guint16 slowlink_count;
336 336
	struct janus_videocall_session *peer;
337
	guint64 destroyed;	/* Time at which this session was marked as destroyed */
337
	gboolean hangingup;
338
	gint64 destroyed;	/* Time at which this session was marked as destroyed */
338 339
} janus_videocall_session;
339 340
static GHashTable *sessions;
340 341
static GList *old_sessions;
......
536 537
	}
537 538
	janus_mutex_lock(&sessions_mutex);
538 539
	if(!session->destroyed) {
539
		session->destroyed = janus_get_monotonic_time();
540 540
		JANUS_LOG(LOG_VERB, "Removing VideoCall user %s session...\n", session->username ? session->username : "'unknown'");
541 541
		janus_videocall_hangup_media(handle);
542
		session->destroyed = janus_get_monotonic_time();
542 543
		if(session->username != NULL) {
543 544
			int res = g_hash_table_remove(sessions, (gpointer)session->username);
544 545
			JANUS_LOG(LOG_VERB, "  -- Removed: %d\n", res);
......
760 761
		JANUS_LOG(LOG_ERR, "No session associated with this handle...\n");
761 762
		return;
762 763
	}
763
	if(session->destroyed)
764
	if(session->destroyed || session->hangingup)
764 765
		return;
765
	janus_mutex_lock(&sessions_mutex);
766
	session->hangingup = TRUE;
766 767
	if(session->peer) {
767 768
		/* Send event to our peer too */
768 769
		json_t *call = json_object();
......
784 785
	session->audio_active = TRUE;
785 786
	session->video_active = TRUE;
786 787
	session->bitrate = 0;
787
	janus_mutex_unlock(&sessions_mutex);
788
	/* Done */
789
	session->hangingup = FALSE;
788 790
}
789 791

  
790 792
/* Thread to handle incoming messages */

Also available in: Unified diff