webrtc_state_e old_state;
g_mutex_lock(&webrtc->mutex);
-
webrtc->idle_cb_event_source_ids[data->type] = 0;
old_state = webrtc->state;
webrtc->state = data->new.state;
-
g_mutex_unlock(&webrtc->mutex);
_invoke_state_changed_cb(webrtc, old_state, webrtc->state);
break;
}
+
case IDLE_CB_TYPE_ERROR:
+ g_mutex_lock(&webrtc->mutex);
webrtc->idle_cb_event_source_ids[data->type] = 0;
+ g_mutex_unlock(&webrtc->mutex);
+
__invoke_error_cb(webrtc, data->new.error);
break;
+
case IDLE_CB_TYPE_PEER_CONNECTION_STATE_CHANGE:
+ g_mutex_lock(&webrtc->mutex);
webrtc->idle_cb_event_source_ids[data->type] = 0;
+ g_mutex_unlock(&webrtc->mutex);
+
__invoke_peer_connection_state_change_cb(webrtc, data->new.peer_connection_state);
break;
+
case IDLE_CB_TYPE_SIGNALING_STATE_CHANGE:
+ g_mutex_lock(&webrtc->mutex);
webrtc->idle_cb_event_source_ids[data->type] = 0;
+ g_mutex_unlock(&webrtc->mutex);
+
__invoke_signaling_state_change_cb(webrtc, data->new.signaling_state);
break;
+
case IDLE_CB_TYPE_ICE_GATHERING_STATE_CHANGE:
+ g_mutex_lock(&webrtc->mutex);
webrtc->idle_cb_event_source_ids[data->type] = 0;
+ g_mutex_unlock(&webrtc->mutex);
+
__invoke_ice_gathering_state_change_cb(webrtc, data->new.ice_gathering_state);
break;
+
case IDLE_CB_TYPE_ICE_CONNECTION_STATE_CHANGE:
+ g_mutex_lock(&webrtc->mutex);
webrtc->idle_cb_event_source_ids[data->type] = 0;
+ g_mutex_unlock(&webrtc->mutex);
+
__invoke_ice_connection_state_change_cb(webrtc, data->new.ice_connection_state);
break;
+
default:
LOG_ERROR_IF_REACHED("type(%d)", data->type);
}
RET_IF(webrtcbin == NULL, "webrtcbin is NULL");
RET_IF(webrtc == NULL, "webrtc is NULL");
+ g_mutex_lock(&webrtc->mutex);
_post_state_cb_in_idle(webrtc, WEBRTC_STATE_NEGOTIATING);
+ g_mutex_unlock(&webrtc->mutex);
if (webrtc->negotiation_needed_cb.callback == NULL) {
LOG_DEBUG("negotiation_needed_cb is NULL, skip it");
LOG_DEBUG("webrtc[%p] [PeerConnectionState] is changed to [%s]", webrtc, __peer_connection_state_info[state].str);
webrtc->negotiation_states.peer_connection_state = __peer_connection_state_info[state].state;
+ g_mutex_lock(&webrtc->mutex);
__post_peer_connection_state_change_cb_in_idle(webrtc, state);
+ g_mutex_unlock(&webrtc->mutex);
switch (state) {
case GST_WEBRTC_PEER_CONNECTION_STATE_CONNECTED:
state == GST_WEBRTC_SIGNALING_STATE_STABLE)
__update_data_recovery_type_from_remote_description(webrtc);
+ g_mutex_lock(&webrtc->mutex);
__post_signaling_state_change_cb_in_idle(webrtc, state);
+ g_mutex_unlock(&webrtc->mutex);
}
static void __webrtcbin_ice_gathering_state_cb(GstElement *webrtcbin, GParamSpec * pspec, gpointer user_data)
LOG_DEBUG("webrtc[%p] [IceGatheringState] is changed to [%s]", webrtc, __ice_gathering_state_info[state].str);
webrtc->negotiation_states.ice_gathering_state = __ice_gathering_state_info[state].state;
+ g_mutex_lock(&webrtc->mutex);
__post_ice_gathering_state_change_cb_in_idle(webrtc, state);
+ g_mutex_unlock(&webrtc->mutex);
}
//LCOV_EXCL_START
LOG_DEBUG("webrtc[%p] [IceConnectionState] is changed to [%s]", webrtc, __ice_connection_state_info[state].str);
webrtc->negotiation_states.ice_connection_state = __ice_connection_state_info[state].state;
+ g_mutex_lock(&webrtc->mutex);
__post_ice_connection_state_change_cb_in_idle(webrtc, state);
+ g_mutex_unlock(&webrtc->mutex);
if (state == GST_WEBRTC_ICE_CONNECTION_STATE_FAILED)
__invoke_error_cb(webrtc, WEBRTC_ERROR_CONNECTION_FAILED);