Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
libnice
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
cpp-libs
libnice
Commits
b1528dae
Commit
b1528dae
authored
Feb 04, 2013
by
Youness Alaoui
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix/clean threaded-example
parent
6eb3fc68
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
5 deletions
+6
-5
examples/threaded-example.c
examples/threaded-example.c
+6
-5
No files found.
examples/threaded-example.c
View file @
b1528dae
...
...
@@ -45,7 +45,6 @@
#include <agent.h>
static
GMainLoop
*
gloop
;
static
GIOChannel
*
io_stdin
;
static
gchar
*
stun_addr
=
NULL
;
static
guint
stun_port
;
static
gboolean
controlling
;
...
...
@@ -104,15 +103,14 @@ main(int argc, char *argv[])
g_type_init
();
gloop
=
g_main_loop_new
(
NULL
,
FALSE
);
io_stdin
=
g_io_channel_unix_new
(
fileno
(
stdin
));
// Run the mainloop and the example thread
exit_thread
=
FALSE
;
gloopthread
=
g_thread_new
(
"example thread"
,
&
example_thread
,
NULL
);
g_main_loop_run
(
gloop
);
exit_thread
=
TRUE
;
g_main_loop_unref
(
gloop
);
g_io_channel_unref
(
io_stdin
);
g_thread_join
(
gloopthread
);
g_thread_unref
(
gloopthread
);
...
...
@@ -124,10 +122,13 @@ example_thread(void *data)
{
NiceAgent
*
agent
;
NiceCandidate
*
local
,
*
remote
;
GIOChannel
*
io_stdin
;
guint
stream_id
;
gchar
*
line
=
NULL
;
int
rval
;
io_stdin
=
g_io_channel_unix_new
(
fileno
(
stdin
));
// Create the nice agent
agent
=
nice_agent_new
(
g_main_loop_get_context
(
gloop
),
NICE_COMPATIBILITY_RFC5245
);
...
...
@@ -188,8 +189,7 @@ example_thread(void *data)
// Parse remote candidate list and set it on the agent
rval
=
parse_remote_data
(
agent
,
stream_id
,
1
,
line
);
if
(
rval
==
EXIT_SUCCESS
)
{
// Return FALSE so we stop listening to stdin since we parsed the
// candidates correctly
g_free
(
line
);
break
;
}
else
{
fprintf
(
stderr
,
"ERROR: failed to parse remote data
\n
"
);
...
...
@@ -240,6 +240,7 @@ example_thread(void *data)
}
end:
g_io_channel_unref
(
io_stdin
);
g_object_unref
(
agent
);
g_main_loop_quit
(
gloop
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment