Skip to content

Commit

Permalink
Add more checks on peer when hanging up VideoCall session
Browse files Browse the repository at this point in the history
  • Loading branch information
lminiero committed Jul 28, 2020
1 parent 5c74a5c commit a6731ba
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion plugins/janus_videocall.c
Original file line number Diff line number Diff line change
Expand Up @@ -996,8 +996,9 @@ static void janus_videocall_hangup_media_internal(janus_plugin_session *handle)
janus_mutex_unlock(&session->rec_mutex);
janus_videocall_session *peer = session->peer;
session->peer = NULL;
if(peer) {
if(peer && !g_atomic_int_get(&peer->destroyed)) {
/* Send event to our peer too */
janus_refcount_increase(&peer->ref);
json_t *call = json_object();
json_object_set_new(call, "videocall", json_string("event"));
json_t *calling = json_object();
Expand All @@ -1016,6 +1017,7 @@ static void janus_videocall_hangup_media_internal(janus_plugin_session *handle)
json_object_set_new(info, "reason", json_string("Remote WebRTC hangup"));
gateway->notify_event(&janus_videocall_plugin, peer->handle, info);
}
janus_refcount_decrease(&peer->ref);
}
/* Reset controls */
session->has_audio = FALSE;
Expand Down

0 comments on commit a6731ba

Please sign in to comment.