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
ff66bb3b
Commit
ff66bb3b
authored
May 08, 2011
by
Laurent Aimar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Do not used vlc_thread_create() in input/es_out_timeshift.c
parent
5699c34a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
31 deletions
+25
-31
src/input/es_out_timeshift.c
src/input/es_out_timeshift.c
+25
-31
No files found.
src/input/es_out_timeshift.c
View file @
ff66bb3b
...
...
@@ -172,9 +172,7 @@ struct ts_storage_t
typedef
struct
{
VLC_COMMON_MEMBERS
/* */
vlc_thread_t
thread
;
input_thread_t
*
p_input
;
es_out_t
*
p_out
;
int64_t
i_tmp_size_max
;
...
...
@@ -224,7 +222,7 @@ struct es_out_sys_t
/* */
bool
b_delayed
;
ts_thread_t
*
p_t
hread
;
ts_thread_t
*
p_t
s
;
/* */
bool
b_input_paused
;
...
...
@@ -254,7 +252,7 @@ static bool TsIsUnused( ts_thread_t * );
static
int
TsChangePause
(
ts_thread_t
*
,
bool
b_source_paused
,
bool
b_paused
,
mtime_t
i_date
);
static
int
TsChangeRate
(
ts_thread_t
*
,
int
i_src_rate
,
int
i_rate
);
static
void
*
TsRun
(
v
lc_object_t
*
);
static
void
*
TsRun
(
v
oid
*
);
static
ts_storage_t
*
TsStorageNew
(
const
char
*
psz_path
,
int64_t
i_tmp_size_max
);
static
void
TsStorageDelete
(
ts_storage_t
*
);
...
...
@@ -322,7 +320,7 @@ es_out_t *input_EsOutTimeshiftNew( input_thread_t *p_input, es_out_t *p_next_out
vlc_mutex_init_recursive
(
&
p_sys
->
lock
);
p_sys
->
b_delayed
=
false
;
p_sys
->
p_t
hread
=
NULL
;
p_sys
->
p_t
s
=
NULL
;
TAB_INIT
(
p_sys
->
i_es
,
p_sys
->
pp_es
);
...
...
@@ -361,7 +359,7 @@ static void Destroy( es_out_t *p_out )
if
(
p_sys
->
b_delayed
)
{
TsStop
(
p_sys
->
p_t
hread
);
TsStop
(
p_sys
->
p_t
s
);
p_sys
->
b_delayed
=
false
;
}
...
...
@@ -398,7 +396,7 @@ static es_out_id_t *Add( es_out_t *p_out, const es_format_t *p_fmt )
TAB_APPEND
(
p_sys
->
i_es
,
p_sys
->
pp_es
,
p_es
);
if
(
p_sys
->
b_delayed
)
TsPushCmd
(
p_sys
->
p_t
hread
,
&
cmd
);
TsPushCmd
(
p_sys
->
p_t
s
,
&
cmd
);
else
CmdExecuteAdd
(
p_sys
->
p_out
,
&
cmd
);
...
...
@@ -418,7 +416,7 @@ static int Send( es_out_t *p_out, es_out_id_t *p_es, block_t *p_block )
CmdInitSend
(
&
cmd
,
p_es
,
p_block
);
if
(
p_sys
->
b_delayed
)
TsPushCmd
(
p_sys
->
p_t
hread
,
&
cmd
);
TsPushCmd
(
p_sys
->
p_t
s
,
&
cmd
);
else
i_ret
=
CmdExecuteSend
(
p_sys
->
p_out
,
&
cmd
)
;
...
...
@@ -437,7 +435,7 @@ static void Del( es_out_t *p_out, es_out_id_t *p_es )
CmdInitDel
(
&
cmd
,
p_es
);
if
(
p_sys
->
b_delayed
)
TsPushCmd
(
p_sys
->
p_t
hread
,
&
cmd
);
TsPushCmd
(
p_sys
->
p_t
s
,
&
cmd
);
else
CmdExecuteDel
(
p_sys
->
p_out
,
&
cmd
);
...
...
@@ -450,7 +448,7 @@ static int ControlLockedGetEmpty( es_out_t *p_out, bool *pb_empty )
{
es_out_sys_t
*
p_sys
=
p_out
->
p_sys
;
if
(
p_sys
->
b_delayed
&&
TsHasCmd
(
p_sys
->
p_t
hread
)
)
if
(
p_sys
->
b_delayed
&&
TsHasCmd
(
p_sys
->
p_t
s
)
)
*
pb_empty
=
false
;
else
*
pb_empty
=
es_out_GetEmpty
(
p_sys
->
p_out
);
...
...
@@ -501,7 +499,7 @@ static int ControlLockedSetPauseState( es_out_t *p_out, bool b_source_paused, bo
if
(
!
p_sys
->
b_delayed
)
TsStart
(
p_out
);
if
(
p_sys
->
b_delayed
)
i_ret
=
TsChangePause
(
p_sys
->
p_t
hread
,
b_source_paused
,
b_paused
,
i_date
);
i_ret
=
TsChangePause
(
p_sys
->
p_t
s
,
b_source_paused
,
b_paused
,
i_date
);
}
else
{
...
...
@@ -536,7 +534,7 @@ static int ControlLockedSetRate( es_out_t *p_out, int i_src_rate, int i_rate )
if
(
!
p_sys
->
b_delayed
)
TsStart
(
p_out
);
if
(
p_sys
->
b_delayed
)
i_ret
=
TsChangeRate
(
p_sys
->
p_t
hread
,
i_src_rate
,
i_rate
);
i_ret
=
TsChangeRate
(
p_sys
->
p_t
s
,
i_src_rate
,
i_rate
);
}
else
{
...
...
@@ -614,7 +612,7 @@ static int ControlLocked( es_out_t *p_out, int i_query, va_list args )
return
VLC_EGENERIC
;
if
(
p_sys
->
b_delayed
)
{
TsPushCmd
(
p_sys
->
p_t
hread
,
&
cmd
);
TsPushCmd
(
p_sys
->
p_t
s
,
&
cmd
);
return
VLC_SUCCESS
;
}
return
CmdExecuteControl
(
p_sys
->
p_out
,
&
cmd
);
...
...
@@ -725,12 +723,11 @@ static int Control( es_out_t *p_out, int i_query, va_list args )
/*****************************************************************************
*
*****************************************************************************/
static
void
TsDestr
uctor
(
vlc_object_t
*
p_thi
s
)
static
void
TsDestr
oy
(
ts_thread_t
*
p_t
s
)
{
ts_thread_t
*
p_ts
=
(
ts_thread_t
*
)
p_this
;
vlc_cond_destroy
(
&
p_ts
->
wait
);
vlc_mutex_destroy
(
&
p_ts
->
lock
);
free
(
p_ts
);
}
static
int
TsStart
(
es_out_t
*
p_out
)
{
...
...
@@ -739,8 +736,7 @@ static int TsStart( es_out_t *p_out )
assert
(
!
p_sys
->
b_delayed
);
p_sys
->
p_thread
=
p_ts
=
vlc_custom_create
(
p_sys
->
p_input
,
sizeof
(
ts_thread_t
),
VLC_OBJECT_GENERIC
,
"es out timeshift"
);
p_sys
->
p_ts
=
p_ts
=
calloc
(
1
,
sizeof
(
*
p_ts
));
if
(
!
p_ts
)
return
VLC_EGENERIC
;
...
...
@@ -761,14 +757,12 @@ static int TsStart( es_out_t *p_out )
p_ts
->
p_storage_r
=
NULL
;
p_ts
->
p_storage_w
=
NULL
;
vlc_object_set_destructor
(
p_ts
,
TsDestructor
);
p_sys
->
b_delayed
=
true
;
if
(
vlc_
thread_create
(
p_ts
,
TsRun
,
VLC_THREAD_PRIORITY_INPUT
)
)
if
(
vlc_
clone
(
&
p_ts
->
thread
,
TsRun
,
p_ts
,
VLC_THREAD_PRIORITY_INPUT
)
)
{
msg_Err
(
p_sys
->
p_input
,
"cannot create
inpu
t thread"
);
msg_Err
(
p_sys
->
p_input
,
"cannot create
timeshif
t thread"
);
vlc_object_release
(
p_ts
);
TsDestroy
(
p_ts
);
p_sys
->
b_delayed
=
false
;
return
VLC_EGENERIC
;
...
...
@@ -780,18 +774,18 @@ static void TsAutoStop( es_out_t *p_out )
{
es_out_sys_t
*
p_sys
=
p_out
->
p_sys
;
if
(
!
p_sys
->
b_delayed
||
!
TsIsUnused
(
p_sys
->
p_t
hread
)
)
if
(
!
p_sys
->
b_delayed
||
!
TsIsUnused
(
p_sys
->
p_t
s
)
)
return
;
msg_Warn
(
p_sys
->
p_input
,
"es out timeshift: auto stop"
);
TsStop
(
p_sys
->
p_t
hread
);
TsStop
(
p_sys
->
p_t
s
);
p_sys
->
b_delayed
=
false
;
}
static
void
TsStop
(
ts_thread_t
*
p_ts
)
{
vlc_
object_kill
(
p_ts
);
vlc_
thread_join
(
p_ts
);
vlc_
cancel
(
p_ts
->
thread
);
vlc_
join
(
p_ts
->
thread
,
NULL
);
vlc_mutex_lock
(
&
p_ts
->
lock
);
for
(
;;
)
...
...
@@ -808,7 +802,7 @@ static void TsStop( ts_thread_t *p_ts )
TsStorageDelete
(
p_ts
->
p_storage_r
);
vlc_mutex_unlock
(
&
p_ts
->
lock
);
vlc_object_release
(
p_ts
);
TsDestroy
(
p_ts
);
}
static
void
TsPushCmd
(
ts_thread_t
*
p_ts
,
ts_cmd_t
*
p_cmd
)
{
...
...
@@ -938,9 +932,9 @@ static int TsChangeRate( ts_thread_t *p_ts, int i_src_rate, int i_rate )
return
i_ret
;
}
static
void
*
TsRun
(
v
lc_object_t
*
p_thread
)
static
void
*
TsRun
(
v
oid
*
p_data
)
{
ts_thread_t
*
p_ts
=
(
ts_thread_t
*
)
p_thread
;
ts_thread_t
*
p_ts
=
p_data
;
mtime_t
i_buffering_date
=
-
1
;
for
(
;;
)
...
...
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