[Nice] API thoughts

Dafydd Harries dafydd.harries at collabora.co.uk
Thu Apr 10 15:16:16 PDT 2008

I've been discussing with my colleagues Olivier and Youness what kind of API
libnice needs to provide so that we can write reasonable GStreamer elements.
Our current idea is to have a new pair of agent methods:

  GMainContext *
  nice_agent_make_recv_context (
      NiceAgent *agent,
      guint stream_id,
      guint component_id,
      NiceAgentRecvFunc func,
      gpointer data);

  GMainContext *
  nice_agent_make_shared_context (
      NiceAgent *agent);

The first would create a GMainContext with a GSource for each of the indicated
stream's candidates, suitable for a GstSource to run in a mainloop. This
provides the ability to stop waiting at any time using g_main_loop_quit ().
The locking should be quite straightforward, I think.

The second would create a context with sources for each of the agent's
timeouts. Code which used nice_agent_make_shared_context () would run a main
loop with that context in a separate thread.

I suspect nice_agent_recv_sock () and nice_agent_poll_read () should be


More information about the Nice mailing list