Skip to content

Commit

Permalink
Fixed race condition in VideoRoom
Browse files Browse the repository at this point in the history
  • Loading branch information
lminiero committed May 28, 2021
1 parent b45cd37 commit d3b39b9
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions plugins/janus_videoroom.c
Original file line number Diff line number Diff line change
Expand Up @@ -5145,10 +5145,13 @@ void janus_videoroom_setup_media(janus_plugin_session *handle) {
json_object_set_new(pub, "videoroom", json_string("event"));
json_object_set_new(pub, "room", string_ids ? json_string(participant->room_id_str) : json_integer(participant->room_id));
json_object_set_new(pub, "publishers", list);
if (participant->room) {
janus_mutex_lock(&participant->room->mutex);
janus_videoroom *room = participant->room;
if(room && !g_atomic_int_get(&room->destroyed)) {
janus_refcount_increase(&room->ref);
janus_mutex_lock(&room->mutex);
janus_videoroom_notify_participants(participant, pub, FALSE);
janus_mutex_unlock(&participant->room->mutex);
janus_mutex_unlock(&room->mutex);
janus_refcount_decrease(&room->ref);
}
json_decref(pub);
/* Also notify event handlers */
Expand Down

0 comments on commit d3b39b9

Please sign in to comment.