コード例 #1
0
ファイル: nice.c プロジェクト: mssurajkaiga/farstream
static gboolean
set_the_candidates (gpointer user_data)
{
  FsStreamTransmitter *st = FS_STREAM_TRANSMITTER (user_data);
  GList *candidates = g_object_get_data (G_OBJECT (st), "candidates-set");
  gboolean ret;
  GError *error = NULL;

  if (!candidates)
  {
    g_debug ("Skipping libnice check because it found NO local candidates");
    g_atomic_int_set(&running, FALSE);
    g_main_loop_quit (loop);
    return FALSE;
  }

  if (force_candidates)
  {
    GList *item = NULL;
    GList *next = NULL;
    GList *new_list = NULL;
    for (item = candidates; item; item = next)
    {
      FsCandidate *cand = item->data;
      GList *item2 = NULL;
      next = g_list_next (item);

      for (item2 = new_list; item2; item2 = g_list_next (item2))
      {
        FsCandidate *cand2 = item2->data;
        if (cand2->component_id == cand->component_id)
          break;
      }
      if (!item2)
      {
        candidates = g_list_remove (candidates, cand);
        new_list = g_list_append (new_list, cand);
      }
    }

    ret = fs_stream_transmitter_force_remote_candidates (st, new_list, &error);

    fs_candidate_list_destroy (new_list);
  }
  else
  {
    ret = fs_stream_transmitter_add_remote_candidates (st, candidates, &error);
  }

  if (error)
    ts_fail ("Error while adding candidate: (%s:%d) %s",
        g_quark_to_string (error->domain), error->code, error->message);

  ts_fail_unless (ret == TRUE, "No detailed error setting remote_candidate");

  fs_candidate_list_destroy (candidates);

  return FALSE;
}
コード例 #2
0
static void
fs_stream_transmitter_dispose (GObject *object)
{
  FsStreamTransmitter *self = FS_STREAM_TRANSMITTER (object);

  if (self->priv->disposed) {
    /* If dispose did already run, return. */
    return;
  }

  /* Make sure dispose does not run twice. */
  self->priv->disposed = TRUE;

  parent_class->dispose (object);
}
コード例 #3
0
ファイル: nice.c プロジェクト: mssurajkaiga/farstream
static void
_local_candidates_prepared (FsStreamTransmitter *st, gpointer user_data)
{
  FsStreamTransmitter *st2 = FS_STREAM_TRANSMITTER (user_data);
  GList *candidates = g_object_get_data (G_OBJECT (st), "candidates");

  g_object_set_data (G_OBJECT (st), "candidates", NULL);

  ts_fail_if (g_list_length (candidates) < 2,
      "We don't have at least 2 candidates");

  GST_DEBUG ("Local Candidates Prepared");

  g_object_set_data (G_OBJECT (st2), "candidates-set", candidates);

  g_idle_add (set_the_candidates, st2);

}
コード例 #4
0
ファイル: nice.c プロジェクト: kakaroto/farstream
static gboolean
set_the_candidates (gpointer user_data)
{
    FsStreamTransmitter *st = FS_STREAM_TRANSMITTER (user_data);
    GList *candidates = g_object_get_data (G_OBJECT (st), "candidates-set");
    gboolean ret;
    GError *error = NULL;

    if (!candidates)
    {
        g_debug ("Skipping libnice check because it found NO local candidates");
        g_atomic_int_set(&running, FALSE);
        g_main_loop_quit (loop);
        return FALSE;
    }

    if (force_candidates)
    {
        GList *item = NULL;
        GList *next = NULL;
        GList *new_list = NULL;
        for (item = candidates; item; item = next)
        {
            FsCandidate *cand = item->data;
            GList *item2 = NULL;

            next = g_list_next (item);

            if (cand->type != FS_CANDIDATE_TYPE_HOST)
                continue;
            if (cand->component_id != 1)
                continue;

            for (item2 = candidates; item2; item2 = g_list_next (item2))
            {
                FsCandidate *cand2 = item2->data;
                if (cand2->component_id == 2 &&
                        !strcmp (cand->foundation, cand2->foundation))
                {
                    new_list = g_list_append (new_list, cand);
                    new_list = g_list_append (new_list, cand2);
                    goto got_candidates;
                }
            }
        }

        ts_fail ("Could not find two matching host candidates???");

got_candidates:
        ts_fail_unless (g_list_length (new_list) == 2);
        ret = fs_stream_transmitter_force_remote_candidates (st, new_list, &error);
    }
    else
    {
        ret = fs_stream_transmitter_add_remote_candidates (st, candidates, &error);
    }

    if (error)
        ts_fail ("Error while adding candidate: (%s:%d) %s",
                 g_quark_to_string (error->domain), error->code, error->message);

    ts_fail_unless (ret == TRUE, "No detailed error setting remote_candidate");

    fs_candidate_list_destroy (candidates);

    return FALSE;
}