[Nice] what threads are needed?

Youness Alaoui youness.alaoui at collabora.co.uk
Mon Aug 30 15:24:04 PDT 2010

On 08/30/2010 06:20 PM, Tony Di Croce wrote:
> 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?)...
So far good, yes, you can serialize them with the to_string and from_string.
Just don't forget to get/set the port on the NiceAddress.
> 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())....?
no, you don't need to.. some compatiblity modes (like google, or MSN) have a
username/password different for each candidate, but that's from the old draft of
ICE (draft 6) and it's not used anymore, now only the get/set credentials is
needed. If you set a user/pass on the candidate itself, it will override the
global stream credentials for that candidate.

> 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...
yes, 5 is FAILED, so something goes wrong.. if you run your program with the
environment variable "NICE_DEBUG=all" set, and send me the logs from both sides
for the same call, I'll have a look at see why it failed.
You can send the logs to me directly in this case :)

>     td
> On Mon, Aug 30, 2010 at 2:47 PM, Youness Alaoui
> <youness.alaoui at collabora.co.uk <mailto: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.
> _______________________________________________
> Nice mailing list
> Nice at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/nice

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 262 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freedesktop.org/archives/nice/attachments/20100830/f92549d3/attachment.pgp>

More information about the Nice mailing list