Ejemplo n.º 1
0
static void
kms_ice_nice_agent_new_candidate (NiceAgent * agent,
    guint stream_id,
    guint component_id, gchar * foundation, KmsIceNiceAgent * self)
{
  KmsIceBaseAgent *parent = KMS_ICE_BASE_AGENT (self);
  GSList *candidates;
  GSList *walk;

  GST_TRACE_OBJECT (self,
      "stream_id: %d, component_id: %d, foundation: %s", stream_id,
      component_id, foundation);

  candidates = nice_agent_get_local_candidates (agent, stream_id, component_id);

  for (walk = candidates; walk; walk = walk->next) {
    NiceCandidate *cand = walk->data;

    if (cand->stream_id == stream_id &&
        cand->component_id == component_id &&
        g_strcmp0 (foundation, cand->foundation) == 0) {
      kms_ice_nice_agent_sdp_msg_add_ice_candidate (self->priv->session,
          self->priv->agent, cand, parent);
    }
  }
  g_slist_free_full (candidates, (GDestroyNotify) nice_candidate_free);
}
Ejemplo n.º 2
0
static void
kms_ice_base_agent_finalize (GObject * object)
{
  KmsIceBaseAgent *self = KMS_ICE_BASE_AGENT (object);

  GST_DEBUG_OBJECT (self, "finalize");

  /* chain up */
  G_OBJECT_CLASS (kms_ice_base_agent_parent_class)->finalize (object);
}
Ejemplo n.º 3
0
static void
kms_webrtc_session_init_ice_agent (KmsWebrtcSession * self)
{
  self->agent =
      KMS_ICE_BASE_AGENT (kms_ice_nice_agent_new (self->context, self));

  kms_ice_base_agent_run_agent (self->agent);

  g_signal_connect (self->agent, "on-ice-candidate",
      G_CALLBACK (kms_webrtc_session_new_candidate), self);
  g_signal_connect (self->agent, "on-ice-gathering-done",
      G_CALLBACK (kms_webrtc_session_gathering_done), self);
  g_signal_connect (self->agent, "on-ice-component-state-changed",
      G_CALLBACK (kms_webrtc_session_component_state_change), self);
}
Ejemplo n.º 4
0
static void
kms_ice_nice_agent_component_state_change (NiceAgent * agent, guint stream_id,
    guint component_id, NiceComponentState state, KmsIceNiceAgent * self)
{
  KmsIceBaseAgent *parent = KMS_ICE_BASE_AGENT (self);
  IceState state_;
  char buff[33];
  char *ret;

  //convert id to char*
  g_snprintf (buff, 32, "%d", stream_id);

  ret = g_strdup (buff);

  switch (state) {
    case NICE_COMPONENT_STATE_DISCONNECTED:
      state_ = ICE_STATE_DISCONNECTED;
      break;
    case NICE_COMPONENT_STATE_GATHERING:
      state_ = ICE_STATE_GATHERING;
      break;
    case NICE_COMPONENT_STATE_CONNECTING:
      state_ = ICE_STATE_CONNECTING;
      break;
    case NICE_COMPONENT_STATE_CONNECTED:
      state_ = ICE_STATE_CONNECTED;
      break;
    case NICE_COMPONENT_STATE_READY:
      state_ = ICE_STATE_READY;
      break;
    case NICE_COMPONENT_STATE_FAILED:
      state_ = ICE_STATE_FAILED;
      break;
    default:
      state_ = ICE_STATE_FAILED;
      break;
  }

  GST_DEBUG_OBJECT (self,
      "stream_id: %d, component_id: %d, state: %s",
      stream_id, component_id, nice_component_state_to_string (state));

  g_signal_emit_by_name (parent, "on-ice-component-state-changed", ret,
      component_id, state_);
  g_free (ret);
}
Ejemplo n.º 5
0
static void
kms_ice_nice_agent_gathering_done (NiceAgent * agent, guint stream_id,
    KmsIceNiceAgent * self)
{
  KmsIceBaseAgent *parent = KMS_ICE_BASE_AGENT (self);
  char buff[33];
  char *ret;

  //convert id to char*
  g_snprintf (buff, 32, "%d", stream_id);

  ret = g_strdup (buff);

  g_signal_emit_by_name (parent, "on-ice-gathering-done", ret);

  g_free (ret);
}