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
e70ced80
Commit
e70ced80
authored
Mar 19, 2015
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
decoder: avoid block_FifoPace(), fix races
parent
b3e6be7e
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
14 deletions
+22
-14
src/input/decoder.c
src/input/decoder.c
+22
-14
No files found.
src/input/decoder.c
View file @
e70ced80
...
...
@@ -347,25 +347,30 @@ void input_DecoderDecode( decoder_t *p_dec, block_t *p_block, bool b_do_pace )
{
decoder_owner_sys_t
*
p_owner
=
p_dec
->
p_owner
;
if
(
b_do_pace
)
{
/* The fifo is not consumed when waiting and so will
* deadlock vlc.
* There is no need to lock as b_waiting is never modified
* inside decoder thread. */
if
(
!
p_owner
->
b_waiting
)
block_FifoPace
(
p_owner
->
p_fifo
,
10
,
SIZE_MAX
);
}
else
if
(
block_FifoSize
(
p_owner
->
p_fifo
)
>
400
*
1024
*
1024
/* 400 MiB, ie ~ 50mb/s for 60s */
)
vlc_fifo_Lock
(
p_owner
->
p_fifo
);
if
(
!
b_do_pace
)
{
/* FIXME: ideally we would check the time amount of data
* in the FIFO instead of its size. */
/* 400 MiB, i.e. ~ 50mb/s for 60s */
if
(
vlc_fifo_GetBytes
(
p_owner
->
p_fifo
)
>
400
*
1024
*
1024
)
{
msg_Warn
(
p_dec
,
"decoder/packetizer fifo full (data not "
"consumed quickly enough), resetting fifo!"
);
block_FifoEmpty
(
p_owner
->
p_fifo
);
block_ChainRelease
(
vlc_fifo_DequeueAllUnlocked
(
p_owner
->
p_fifo
)
);
}
}
else
if
(
!
p_owner
->
b_waiting
)
{
/* The FIFO is not consumed when waiting, so pacing would deadlock VLC.
* Locking is not necessary as b_waiting is only read, not written by
* the decoder thread. */
while
(
vlc_fifo_GetCount
(
p_owner
->
p_fifo
)
>=
10
)
vlc_fifo_WaitCond
(
p_owner
->
p_fifo
,
&
p_owner
->
wait_acknowledge
);
}
block_FifoPut
(
p_owner
->
p_fifo
,
p_block
);
vlc_fifo_QueueUnlocked
(
p_owner
->
p_fifo
,
p_block
);
vlc_fifo_Unlock
(
p_owner
->
p_fifo
);
}
bool
input_DecoderIsEmpty
(
decoder_t
*
p_dec
)
...
...
@@ -885,6 +890,9 @@ static void *DecoderThread( void *p_data )
}
p_block
=
vlc_fifo_DequeueUnlocked
(
p_owner
->
p_fifo
);
if
(
p_block
!=
NULL
)
vlc_cond_signal
(
&
p_owner
->
wait_acknowledge
);
p_owner
->
b_woken
=
false
;
vlc_cleanup_run
();
...
...
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