[Nice] what threads are needed?

Tony Di Croce dicroce at gmail.com
Mon Aug 30 15:20:02 PDT 2010


Ok, well, I guess that's not my problem then!

I feel like I'm very close...

I have two agents... both of which are getting their local candidates,
serializing them and sendthing them to the other...

Both of them are also sending their local credentials to each other and
calling "nice_agent_set_remote_credentials()" on them...

They are both talking to my stun server, and I believe that all of the
information is being serialized and deserialized correctly (it's safe to use
nice_address_to_string() and nice_address_set_from_string() to serialize and
deserialize the NiceCandidate->addr and NiceCandidate->base_addr members
right?)...

BTW, do I need to set the "NiceCandidate->username" and
"NiceCandidate->password" fields if I am seperately sending the credentials
( I currently am both sending them as part of my NiceCandidate serialization
process and seperately for calls to set_remote_credentials())...?

The behaviour that I'm seeing is that my componet state never changes to
4... it goes right from 2 to 5... then a send() of course fails...

    td

On Mon, Aug 30, 2010 at 2:47 PM, Youness Alaoui <
youness.alaoui at collabora.co.uk> wrote:

> On 08/30/2010 05:43 PM, Tony Di Croce wrote:
> > In the "test-thread.c" example application that is included in the
> > libnice source tree a number of threads are created...
> >
> > My current thinking is that "lthread" and "rthread" are needed to
> > implement the main loop of the agents themselves... IE.. The threads
> > that execute the "candidate-gathering-done" etc signals...
> >
> > I'm less sure about "ldthread" and "rdthread".... These seem to be used
> > when you're attaching a recv function... So I'm guessing these are
> > internal worker threads that actually do the data transfer between
> > endpoints? If so, do you need a thread like this per stream or is one
> > worker thread for the whole agent sufficient?
> >
> >     td
>
> No threads are needed, The test-thread.c example is for "testing threads",
> it's
> there to make sure that even if libnice is being used by a multi-threaded
> environment, the library is thread-safe. It does not mean at all that you
> need
> to be using threads in order to make it work.. you only need one thread,
> your
> main one, the one where your main_loop is running, that's why you give the
> nice_agent_new the main_context to your mainloop, and that's why you give
> it to
> the nice_agent_attach_recv. That's all you need.
>
> p.s: Please keep asking your questions on the mailing list.
>
> Youness.
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/nice/attachments/20100830/aaa1b25f/attachment.html>


More information about the Nice mailing list