Commit 25e3a828 authored by Dafydd Harries's avatar Dafydd Harries

make ice_agent_add_stream take callback function

darcs-hash:20070122144214-c9803-0d9ffdcd6f0c7befe6dbaddc2eab3033bc92523d.gz
parent 905ac46a
......@@ -193,6 +193,7 @@ struct _stream
guint id;
/* XXX: streams can have multiple components */
Component *component;
void (*handle_recv) (Agent *agent, guint stream_id, guint len, gchar *buf);
};
......@@ -375,13 +376,17 @@ ice_agent_add_local_host_candidate (
guint
ice_agent_add_stream (Agent *agent, MediaType type)
ice_agent_add_stream (
Agent *agent,
MediaType type,
void (*handle_recv) (Agent *agent, guint stream_id, guint len, gchar *buf))
{
Stream *stream;
GSList *i;
stream = stream_new (type);
stream->id = agent->next_stream_id++;
stream->handle_recv = handle_recv;
agent->streams = g_slist_append (agent->streams, stream);
/* generate a local host candidate for each local address */
......
......@@ -147,7 +147,10 @@ ice_agent_pop_event (Agent *agent);
void
ice_agent_add_local_address (Agent *agent, Address *addr);
guint
ice_agent_add_stream (Agent *agent, MediaType type);
ice_agent_add_stream (
Agent *agent,
MediaType type,
void (*handle_recv) (Agent *agent, guint stream_id, guint len, gchar *buf));
void
ice_agent_free (Agent *agent);
void
......
......@@ -7,15 +7,21 @@
#include <agent.h>
void
handle_recv (Agent *agent, guint stream_id, guint len, gchar *buf)
{
g_assert_not_reached ();
}
int
main (void)
{
Agent *agent;
agent = ice_agent_new (NULL);
g_assert (ice_agent_add_stream (agent, MEDIA_TYPE_AUDIO) == 1);
g_assert (ice_agent_add_stream (agent, MEDIA_TYPE_AUDIO) == 2);
g_assert (ice_agent_add_stream (agent, MEDIA_TYPE_AUDIO) == 3);
g_assert (ice_agent_add_stream (agent, MEDIA_TYPE_AUDIO, handle_recv) == 1);
g_assert (ice_agent_add_stream (agent, MEDIA_TYPE_AUDIO, handle_recv) == 2);
g_assert (ice_agent_add_stream (agent, MEDIA_TYPE_AUDIO, handle_recv) == 3);
ice_agent_free (agent);
return 0;
......
......@@ -8,6 +8,12 @@
#include <agent.h>
void
handle_recv (Agent *agent, guint stream_id, guint len, gchar *buf)
{
g_assert_not_reached ();
}
gint
main (void)
{
......@@ -39,7 +45,7 @@ main (void)
g_assert (agent->local_candidates == NULL);
/* add an audio stream */
ice_agent_add_stream (agent, MEDIA_TYPE_AUDIO);
ice_agent_add_stream (agent, MEDIA_TYPE_AUDIO, handle_recv);
/* adding a stream should cause host candidates to be generated */
g_assert (agent->local_candidates != NULL);
......
......@@ -31,7 +31,7 @@ make_agent (
ice_agent_add_local_address (agent, addr_local);
address_free (addr_local);
ice_agent_add_stream (agent, MEDIA_TYPE_AUDIO);
ice_agent_add_stream (agent, MEDIA_TYPE_AUDIO, NULL);
g_assert (agent->local_candidates != NULL);
candidate = (Candidate *) agent->local_candidates->data;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment