Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
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-2-2
Commits
87129938
Commit
87129938
authored
Jul 27, 2009
by
Laurent Aimar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cosmetics (create a DecoderWaitDate function).
It also avoid useless mdate() when decoding audio.
parent
6088f39f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
14 deletions
+31
-14
src/input/decoder.c
src/input/decoder.c
+31
-14
No files found.
src/input/decoder.c
View file @
87129938
...
...
@@ -1078,6 +1078,35 @@ static void DecoderFixTs( decoder_t *p_dec, mtime_t *pi_ts0, mtime_t *pi_ts1,
}
}
/**
* If *pb_reject, it does nothing, otherwise it waits for the given
* deadline or a flush request (in which case it set *pi_reject to true.
*/
static
void
DecoderWaitDate
(
decoder_t
*
p_dec
,
bool
*
pb_reject
,
mtime_t
i_deadline
)
{
decoder_owner_sys_t
*
p_owner
=
p_dec
->
p_owner
;
if
(
*
pb_reject
||
i_deadline
<
0
)
return
;
for
(
;;
)
{
vlc_mutex_lock
(
&
p_owner
->
lock
);
if
(
p_owner
->
b_flushing
||
p_dec
->
b_die
)
{
*
pb_reject
=
true
;
vlc_mutex_unlock
(
&
p_owner
->
lock
);
break
;
}
int
i_ret
=
vlc_cond_timedwait
(
&
p_owner
->
wait_request
,
&
p_owner
->
lock
,
i_deadline
);
vlc_mutex_unlock
(
&
p_owner
->
lock
);
if
(
i_ret
)
break
;
}
}
static
void
DecoderPlayAudio
(
decoder_t
*
p_dec
,
aout_buffer_t
*
p_audio
,
int
*
pi_played_sum
,
int
*
pi_lost_sum
)
{
...
...
@@ -1153,20 +1182,8 @@ static void DecoderPlayAudio( decoder_t *p_dec, aout_buffer_t *p_audio,
i_rate
>
INPUT_RATE_DEFAULT
*
AOUT_MAX_INPUT_RATE
)
b_reject
=
true
;
/* Do not wait against unprotected date */
const
mtime_t
i_deadline
=
p_audio
->
start_date
-
AOUT_MAX_PREPARE_TIME
;
while
(
!
b_reject
&&
i_deadline
>
mdate
()
)
{
vlc_mutex_lock
(
&
p_owner
->
lock
);
if
(
p_owner
->
b_flushing
||
p_dec
->
b_die
)
{
b_reject
=
true
;
vlc_mutex_unlock
(
&
p_owner
->
lock
);
break
;
}
vlc_cond_timedwait
(
&
p_owner
->
wait_request
,
&
p_owner
->
lock
,
i_deadline
);
vlc_mutex_unlock
(
&
p_owner
->
lock
);
}
DecoderWaitDate
(
p_dec
,
&
b_reject
,
p_audio
->
start_date
-
AOUT_MAX_PREPARE_TIME
);
if
(
!
b_reject
)
{
...
...
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