Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
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
videolan
vlc
Commits
f7fa395e
Commit
f7fa395e
authored
Nov 17, 2009
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
RTMP: use new thread API, remove bogus uses of b_die and FifoWake
parent
88ae87b2
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
29 additions
and
33 deletions
+29
-33
modules/access/rtmp/access.c
modules/access/rtmp/access.c
+14
-17
modules/access/rtmp/rtmp_amf_flv.c
modules/access/rtmp/rtmp_amf_flv.c
+1
-2
modules/access/rtmp/rtmp_amf_flv.h
modules/access/rtmp/rtmp_amf_flv.h
+1
-0
modules/access_output/rtmp.c
modules/access_output/rtmp.c
+13
-14
No files found.
modules/access/rtmp/access.c
View file @
f7fa395e
...
...
@@ -84,7 +84,7 @@ static ssize_t Read( access_t *, uint8_t *, size_t );
static
int
Seek
(
access_t
*
,
int64_t
);
static
int
Control
(
access_t
*
,
int
,
va_list
);
static
void
*
ThreadControl
(
v
lc_object_t
*
);
static
void
*
ThreadControl
(
v
oid
*
);
/*****************************************************************************
* Open: open the rtmp connection
...
...
@@ -149,7 +149,6 @@ static int Open( vlc_object_t *p_this )
}
/* Initialize thread variables */
p_sys
->
p_thread
->
b_die
=
0
;
p_sys
->
p_thread
->
b_error
=
0
;
p_sys
->
p_thread
->
p_fifo_input
=
block_FifoNew
();
p_sys
->
p_thread
->
p_empty_blocks
=
block_FifoNew
();
...
...
@@ -227,8 +226,8 @@ static int Open( vlc_object_t *p_this )
p_sys
->
p_thread
->
result_publish
=
0
;
}
if
(
vlc_
thread_create
(
p_sys
->
p_thread
,
"rtmp control thread"
,
ThreadControl
,
VLC_THREAD_PRIORITY_INPUT
)
)
if
(
vlc_
clone
(
&
p_sys
->
p_thread
->
thread
,
ThreadControl
,
p_sys
->
p_thread
,
VLC_THREAD_PRIORITY_INPUT
)
)
{
msg_Err
(
p_access
,
"cannot spawn rtmp control thread"
);
goto
error2
;
...
...
@@ -240,9 +239,8 @@ static int Open( vlc_object_t *p_this )
{
msg_Err
(
p_access
,
"connect active failed"
);
/* Kill the running thread */
vlc_object_kill
(
p_sys
->
p_thread
);
block_FifoWake
(
p_sys
->
p_thread
->
p_fifo_input
);
vlc_thread_join
(
p_sys
->
p_thread
);
vlc_cancel
(
p_sys
->
p_thread
->
thread
);
vlc_join
(
p_sys
->
p_thread
->
thread
,
NULL
);
goto
error2
;
}
}
...
...
@@ -289,11 +287,8 @@ static void Close( vlc_object_t * p_this )
access_sys_t
*
p_sys
=
p_access
->
p_sys
;
int
i
;
/* p_sys->p_thread->b_die = true;*/
vlc_object_kill
(
p_sys
->
p_thread
);
block_FifoWake
(
p_sys
->
p_thread
->
p_fifo_input
);
vlc_thread_join
(
p_sys
->
p_thread
);
vlc_cancel
(
p_sys
->
p_thread
->
thread
);
vlc_join
(
p_sys
->
p_thread
->
thread
,
NULL
);
vlc_cond_destroy
(
&
p_sys
->
p_thread
->
wait
);
vlc_mutex_destroy
(
&
p_sys
->
p_thread
->
lock
);
...
...
@@ -521,17 +516,19 @@ static int Control( access_t *p_access, int i_query, va_list args )
/*****************************************************************************
* ThreadControl: manage control messages and pipe media to Read
*****************************************************************************/
static
void
*
ThreadControl
(
v
lc_object_t
*
p_this
)
static
void
*
ThreadControl
(
v
oid
*
p_this
)
{
rtmp_control_thread_t
*
p_thread
=
(
rtmp_control_thread_t
*
)
p_this
;
rtmp_control_thread_t
*
p_thread
=
p_this
;
rtmp_packet_t
*
rtmp_packet
;
int
canc
=
vlc_savecancel
();
rtmp_init_handler
(
p_thread
->
rtmp_handler
);
while
(
vlc_object_alive
(
p_thread
)
)
for
(
;;
)
{
vlc_restorecancel
(
canc
);
rtmp_packet
=
rtmp_read_net_packet
(
p_thread
);
canc
=
vlc_savecancel
(
);
if
(
rtmp_packet
!=
NULL
)
{
if
(
rtmp_packet
->
content_type
<
0x01
/* RTMP_CONTENT_TYPE_CHUNK_SIZE */
...
...
@@ -557,10 +554,10 @@ static void* ThreadControl( vlc_object_t *p_this )
vlc_mutex_unlock
(
&
p_thread
->
lock
);
}
p_thread
->
b_die
=
1
;
#warning info cannot be accessed outside input thread!
((
access_t
*
)
p_thread
->
p_base_object
)
->
info
.
b_eof
=
true
;
block_FifoWake
(
p_thread
->
p_fifo_input
);
break
;
}
}
vlc_restorecancel
(
canc
);
...
...
modules/access/rtmp/rtmp_amf_flv.c
View file @
f7fa395e
...
...
@@ -878,6 +878,7 @@ rtmp_build_flv_over_rtmp( rtmp_control_thread_t *p_thread, block_t *p_buffer )
return
rtmp_packet
;
}
/* This function must be cancellation-safe! */
rtmp_packet_t
*
rtmp_read_net_packet
(
rtmp_control_thread_t
*
p_thread
)
{
...
...
@@ -1288,8 +1289,6 @@ rtmp_handler_invoke( rtmp_control_thread_t *p_thread, rtmp_packet_t *rtmp_packet
}
else
if
(
strcmp
(
"NetConnection.Connect.InvalidApp"
,
string2
)
==
0
)
{
p_thread
->
b_die
=
1
;
vlc_mutex_lock
(
&
p_thread
->
lock
);
vlc_cond_signal
(
&
p_thread
->
wait
);
vlc_mutex_unlock
(
&
p_thread
->
lock
);
...
...
modules/access/rtmp/rtmp_amf_flv.h
View file @
f7fa395e
...
...
@@ -66,6 +66,7 @@ struct rtmp_control_thread_t
vlc_mutex_t
lock
;
vlc_cond_t
wait
;
vlc_thread_t
thread
;
int
result_connect
;
int
result_publish
;
...
...
modules/access_output/rtmp.c
View file @
f7fa395e
...
...
@@ -68,7 +68,7 @@ vlc_module_end ()
*****************************************************************************/
static
ssize_t
Write
(
sout_access_out_t
*
,
block_t
*
);
static
int
Seek
(
sout_access_out_t
*
,
off_t
);
static
void
*
ThreadControl
(
v
lc_object_t
*
);
static
void
*
ThreadControl
(
v
oid
*
);
struct
sout_access_out_sys_t
{
...
...
@@ -143,7 +143,6 @@ static int Open( vlc_object_t *p_this )
}
/* Initialize thread variables */
p_sys
->
p_thread
->
b_die
=
0
;
p_sys
->
p_thread
->
b_error
=
0
;
p_sys
->
p_thread
->
p_fifo_input
=
block_FifoNew
();
p_sys
->
p_thread
->
p_empty_blocks
=
block_FifoNew
();
...
...
@@ -219,8 +218,8 @@ static int Open( vlc_object_t *p_this )
}
}
if
(
vlc_
thread_create
(
p_sys
->
p_thread
,
"rtmp control thread"
,
ThreadControl
,
VLC_THREAD_PRIORITY_INPUT
)
)
if
(
vlc_
clone
(
&
p_sys
->
p_thread
->
thread
,
ThreadControl
,
p_sys
->
p_thread
,
VLC_THREAD_PRIORITY_INPUT
)
)
{
msg_Err
(
p_access
,
"cannot spawn rtmp control thread"
);
goto
error2
;
...
...
@@ -231,6 +230,8 @@ static int Open( vlc_object_t *p_this )
if
(
rtmp_connect_passive
(
p_sys
->
p_thread
)
<
0
)
{
msg_Err
(
p_access
,
"connect passive failed"
);
vlc_cancel
(
p_sys
->
p_thread
->
thread
);
vlc_join
(
p_sys
->
p_thread
->
thread
,
NULL
);
goto
error2
;
}
}
...
...
@@ -267,11 +268,8 @@ static void Close( vlc_object_t * p_this )
sout_access_out_sys_t
*
p_sys
=
p_access
->
p_sys
;
int
i
;
// p_sys->p_thread->b_die = true;
vlc_object_kill
(
p_sys
->
p_thread
);
block_FifoWake
(
p_sys
->
p_thread
->
p_fifo_input
);
vlc_thread_join
(
p_sys
->
p_thread
);
vlc_cancel
(
p_sys
->
p_thread
->
thread
);
vlc_join
(
p_sys
->
p_thread
->
thread
,
NULL
);
vlc_cond_destroy
(
&
p_sys
->
p_thread
->
wait
);
vlc_mutex_destroy
(
&
p_sys
->
p_thread
->
lock
);
...
...
@@ -376,17 +374,19 @@ static int Seek( sout_access_out_t *p_access, off_t i_pos )
/*****************************************************************************
* ThreadControl: manage control messages and pipe media to Read
*****************************************************************************/
static
void
*
ThreadControl
(
v
lc_object_t
*
p_this
)
static
void
*
ThreadControl
(
v
oid
*
p_this
)
{
rtmp_control_thread_t
*
p_thread
=
(
rtmp_control_thread_t
*
)
p_this
;
rtmp_control_thread_t
*
p_thread
=
p_this
;
rtmp_packet_t
*
rtmp_packet
;
int
canc
=
vlc_savecancel
();
rtmp_init_handler
(
p_thread
->
rtmp_handler
);
while
(
vlc_object_alive
(
p_thread
)
)
for
(
;;
)
{
vlc_restorecancel
(
canc
);
rtmp_packet
=
rtmp_read_net_packet
(
p_thread
);
canc
=
vlc_savecancel
(
);
if
(
rtmp_packet
!=
NULL
)
{
if
(
rtmp_packet
->
content_type
<
0x01
/* RTMP_CONTENT_TYPE_CHUNK_SIZE */
...
...
@@ -411,8 +411,7 @@ static void* ThreadControl( vlc_object_t *p_this )
vlc_cond_signal
(
&
p_thread
->
wait
);
vlc_mutex_unlock
(
&
p_thread
->
lock
);
}
p_thread
->
b_die
=
1
;
break
;
}
}
vlc_restorecancel
(
canc
);
...
...
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