Revision 3a3cc054 plugins/janus_audiobridge.c

View differences:

plugins/janus_audiobridge.c
855 855
	session->started = FALSE;
856 856
	session->stopping = FALSE;
857 857
	session->destroyed = 0;
858
	g_atomic_int_set(&session->hangingup, 1);
858 859
	handle->plugin_handle = session;
859 860
	janus_mutex_lock(&sessions_mutex);
860 861
	g_hash_table_insert(sessions, handle, session);
......
1446 1447
	janus_audiobridge_participant *participant = (janus_audiobridge_participant *)session->participant;
1447 1448
	if(!participant)
1448 1449
		return;
1450
	g_atomic_int_set(&session->hangingup, 0);
1449 1451
	/* FIXME Only send this peer the audio mix when we get this event */
1450 1452
	session->started = TRUE;
1451 1453
}
......
1534 1536
		return;
1535 1537
	}
1536 1538
	session->started = FALSE;
1537
	if(session->destroyed || !session->participant || g_atomic_int_get(&session->hangingup))
1539
	if(session->destroyed || !session->participant)
1540
		return;
1541
	if(g_atomic_int_add(&session->hangingup, 1))
1538 1542
		return;
1539
	g_atomic_int_set(&session->hangingup, 1);
1540 1543
	/* Get rid of participant */
1541 1544
	janus_audiobridge_participant *participant = (janus_audiobridge_participant *)session->participant;
1542 1545
	janus_audiobridge_room *audiobridge = participant->room;
......
1595 1598
	if(audiobridge != NULL) {
1596 1599
		janus_mutex_unlock(&audiobridge->mutex);
1597 1600
	}
1598
	/* Done */
1599
	g_atomic_int_set(&session->hangingup, 0);
1600 1601
}
1601 1602

  
1602 1603
/* Thread to handle incoming messages */

Also available in: Unified diff