Skip to content

Commit

Permalink
Check mountpoint in use before performing an ICE restart on a streami…
Browse files Browse the repository at this point in the history
…ng session (fixes #3288).
  • Loading branch information
atoppi committed Nov 13, 2023
1 parent 0ae1c6d commit 7b91e80
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/plugins/janus_streaming.c
Original file line number Diff line number Diff line change
Expand Up @@ -5843,6 +5843,27 @@ static void *janus_streaming_handler(void *data) {
/* Check if this is a new viewer, or if an update is taking place (i.e., ICE restart) */
gboolean audio = TRUE, video = TRUE, data = TRUE;
if(do_restart) {
if(session->mountpoint == NULL) {
JANUS_LOG(LOG_ERR, "Can't perform ICE restart: no mountpoint set\n");
error_code = JANUS_STREAMING_ERROR_NO_SUCH_MOUNTPOINT;
g_snprintf(error_cause, 512, "Can't perform ICE restart: no mountpoint set");
janus_mutex_unlock(&session->mutex);
janus_mutex_unlock(&mp->mutex);
janus_mutex_unlock(&sessions_mutex);
janus_refcount_decrease(&mp->ref);
goto error;
}
if(session->mountpoint != mp) {
/* Already watching something else */
JANUS_LOG(LOG_ERR, "Already watching mountpoint %s\n", session->mountpoint->id_str);
error_code = JANUS_STREAMING_ERROR_INVALID_STATE;
g_snprintf(error_cause, 512, "Already watching mountpoint %s", session->mountpoint->id_str);
janus_mutex_unlock(&session->mutex);
janus_mutex_unlock(&mp->mutex);
janus_mutex_unlock(&sessions_mutex);
janus_refcount_decrease(&mp->ref);
goto error;
}
/* User asked for an ICE restart: provide a new offer */
if(!g_atomic_int_compare_and_exchange(&session->renegotiating, 0, 1)) {
/* Already triggered a renegotiation, and still waiting for an answer */
Expand Down

0 comments on commit 7b91e80

Please sign in to comment.