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
498f442c
Commit
498f442c
authored
Mar 21, 2015
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
decoder: simplify audio path
DecoderPlayAudio() has no effects with a NULL block.
parent
34e54fee
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
47 deletions
+35
-47
src/input/decoder.c
src/input/decoder.c
+35
-47
No files found.
src/input/decoder.c
View file @
498f442c
...
...
@@ -1073,7 +1073,7 @@ static void DecoderPlayAudio( decoder_t *p_dec, block_t *p_audio,
audio_output_t
*
p_aout
=
p_owner
->
p_aout
;
/* */
if
(
p_audio
&&
p_audio
->
i_pts
<=
VLC_TS_INVALID
)
// FIXME --VLC_TS_INVALID verify audio_output/*
if
(
p_audio
->
i_pts
<=
VLC_TS_INVALID
)
// FIXME --VLC_TS_INVALID verify audio_output/*
{
msg_Warn
(
p_dec
,
"non-dated audio buffer received"
);
*
pi_lost_sum
+=
1
;
...
...
@@ -1083,58 +1083,47 @@ static void DecoderPlayAudio( decoder_t *p_dec, block_t *p_audio,
/* */
vlc_mutex_lock
(
&
p_owner
->
lock
);
if
(
p_
audio
&&
p_
owner
->
b_waiting
)
race:
if
(
p_owner
->
b_waiting
)
{
p_owner
->
b_has_data
=
true
;
vlc_cond_signal
(
&
p_owner
->
wait_acknowledge
);
}
for
(
;;
)
{
bool
b_paused
;
bool
b_reject
=
DecoderWaitUnblock
(
p_dec
);
b_paused
=
p_owner
->
b_paused
;
if
(
!
p_audio
)
break
;
/* */
int
i_rate
=
INPUT_RATE_DEFAULT
;
bool
b_reject
=
DecoderWaitUnblock
(
p_dec
);
bool
b_paused
=
p_owner
->
b_paused
;
DecoderFixTs
(
p_dec
,
&
p_audio
->
i_pts
,
NULL
,
&
p_audio
->
i_length
,
&
i_rate
,
AOUT_MAX_ADVANCE_TIME
)
;
/* */
int
i_rate
=
INPUT_RATE_DEFAULT
;
if
(
p_audio
->
i_pts
<=
VLC_TS_INVALID
||
i_rate
<
INPUT_RATE_DEFAULT
/
AOUT_MAX_INPUT_RATE
||
i_rate
>
INPUT_RATE_DEFAULT
*
AOUT_MAX_INPUT_RATE
)
b_reject
=
true
;
DecoderFixTs
(
p_dec
,
&
p_audio
->
i_pts
,
NULL
,
&
p_audio
->
i_length
,
&
i_rate
,
AOUT_MAX_ADVANCE_TIME
);
DecoderWaitDate
(
p_dec
,
&
b_reject
,
p_audio
->
i_pts
-
AOUT_MAX_PREPARE_TIME
);
if
(
p_audio
->
i_pts
<=
VLC_TS_INVALID
||
i_rate
<
INPUT_RATE_DEFAULT
/
AOUT_MAX_INPUT_RATE
||
i_rate
>
INPUT_RATE_DEFAULT
*
AOUT_MAX_INPUT_RATE
)
b_reject
=
true
;
if
(
unlikely
(
p_owner
->
b_paused
!=
b_paused
)
)
continue
;
/* race with input thread? retry... */
if
(
p_aout
==
NULL
)
b_reject
=
true
;
DecoderWaitDate
(
p_dec
,
&
b_reject
,
p_audio
->
i_pts
-
AOUT_MAX_PREPARE_TIME
);
if
(
!
b_reject
)
{
assert
(
!
p_owner
->
b_paused
);
if
(
!
aout_DecPlay
(
p_aout
,
p_audio
,
i_rate
)
)
*
pi_played_sum
+=
1
;
*
pi_lost_sum
+=
aout_DecGetResetLost
(
p_aout
);
}
else
{
msg_Dbg
(
p_dec
,
"discarded audio buffer"
);
*
pi_lost_sum
+=
1
;
block_Release
(
p_audio
);
}
if
(
unlikely
(
p_owner
->
b_paused
!=
b_paused
)
)
goto
race
;
/* race with input thread? retry... */
if
(
p_aout
==
NULL
)
b_reject
=
true
;
break
;
if
(
!
b_reject
)
{
assert
(
!
p_owner
->
b_paused
);
if
(
!
aout_DecPlay
(
p_aout
,
p_audio
,
i_rate
)
)
*
pi_played_sum
+=
1
;
*
pi_lost_sum
+=
aout_DecGetResetLost
(
p_aout
);
}
else
{
msg_Dbg
(
p_dec
,
"discarded audio buffer"
);
*
pi_lost_sum
+=
1
;
block_Release
(
p_audio
);
}
vlc_mutex_unlock
(
&
p_owner
->
lock
);
}
...
...
@@ -1147,11 +1136,10 @@ static void DecoderDecodeAudio( decoder_t *p_dec, block_t *p_block )
int
i_lost
=
0
;
int
i_played
=
0
;
if
(
!
p_block
)
{
/* Play a NULL block to output buffered frames */
DecoderPlayAudio
(
p_dec
,
NULL
,
&
i_played
,
&
i_lost
);
}
else
while
(
(
p_aout_buf
=
p_dec
->
pf_decode_audio
(
p_dec
,
&
p_block
))
)
if
(
p_block
==
NULL
)
return
;
/* TODO: remove this check, drain audio decoders properly */
while
(
(
p_aout_buf
=
p_dec
->
pf_decode_audio
(
p_dec
,
&
p_block
))
)
{
if
(
DecoderIsFlushing
(
p_dec
)
)
{
...
...
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