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
355ec9f1
Commit
355ec9f1
authored
Mar 21, 2015
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
decoder: do not wait for buffering when there is no data
This removes small hacks surrounding this corner case.
parent
ea86f279
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
21 deletions
+17
-21
src/input/decoder.c
src/input/decoder.c
+17
-21
No files found.
src/input/decoder.c
View file @
355ec9f1
...
@@ -105,7 +105,6 @@ struct decoder_owner_sys_t
...
@@ -105,7 +105,6 @@ struct decoder_owner_sys_t
}
pause
;
}
pause
;
/* Waiting */
/* Waiting */
bool
b_woken
;
bool
b_waiting
;
bool
b_waiting
;
bool
b_first
;
bool
b_first
;
bool
b_has_data
;
bool
b_has_data
;
...
@@ -113,6 +112,7 @@ struct decoder_owner_sys_t
...
@@ -113,6 +112,7 @@ struct decoder_owner_sys_t
/* Flushing */
/* Flushing */
bool
b_flushing
;
bool
b_flushing
;
bool
b_draining
;
bool
b_draining
;
bool
b_idle
;
/* CC */
/* CC */
struct
struct
...
@@ -1427,44 +1427,33 @@ static void *DecoderThread( void *p_data )
...
@@ -1427,44 +1427,33 @@ static void *DecoderThread( void *p_data )
for
(
;;
)
for
(
;;
)
{
{
block_t
*
p_block
;
block_t
*
p_block
;
bool
draining
=
false
;
vlc_fifo_Lock
(
p_owner
->
p_fifo
);
vlc_fifo_Lock
(
p_owner
->
p_fifo
);
vlc_fifo_CleanupPush
(
p_owner
->
p_fifo
);
vlc_fifo_CleanupPush
(
p_owner
->
p_fifo
);
vlc_cond_signal
(
&
p_owner
->
wait_acknowledge
);
while
(
vlc_fifo_IsEmpty
(
p_owner
->
p_fifo
)
)
while
(
vlc_fifo_IsEmpty
(
p_owner
->
p_fifo
)
)
{
{
if
(
p_owner
->
b_draining
)
if
(
p_owner
->
b_draining
)
{
/* We have emptied the FIFO and there is a pending request to
{
/* We have emptied the FIFO and there is a pending request to
* drain. Pass p_block = NULL to decoder just once. */
* drain. Pass p_block = NULL to decoder just once. */
p_owner
->
b_draining
=
false
;
p_owner
->
b_draining
=
false
;
draining
=
true
;
break
;
break
;
}
}
if
(
p_owner
->
b_woken
)
break
;
p_owner
->
b_idle
=
true
;
vlc_fifo_Wait
(
p_owner
->
p_fifo
);
vlc_fifo_Wait
(
p_owner
->
p_fifo
);
/* Make sure there is no cancellation point other than this one^^.
/* Make sure there is no cancellation point other than this one^^.
* If you need one, be sure to push cleanup of p_block. */
* If you need one, be sure to push cleanup of p_block. */
p_owner
->
b_idle
=
false
;
}
}
p_block
=
vlc_fifo_DequeueUnlocked
(
p_owner
->
p_fifo
);
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
();
vlc_cleanup_run
();
if
(
p_block
==
NULL
)
int
canc
=
vlc_savecancel
();
DecoderSignalWait
(
p_dec
);
DecoderProcess
(
p_dec
,
p_block
);
vlc_restorecancel
(
canc
);
if
(
p_block
!=
NULL
||
draining
)
{
int
canc
=
vlc_savecancel
();
DecoderProcess
(
p_dec
,
p_block
);
vlc_restorecancel
(
canc
);
}
}
}
return
NULL
;
return
NULL
;
}
}
...
@@ -1529,7 +1518,6 @@ static decoder_t * CreateDecoder( vlc_object_t *p_parent,
...
@@ -1529,7 +1518,6 @@ static decoder_t * CreateDecoder( vlc_object_t *p_parent,
es_format_Init
(
&
p_owner
->
fmt
,
UNKNOWN_ES
,
0
);
es_format_Init
(
&
p_owner
->
fmt
,
UNKNOWN_ES
,
0
);
/* decoder fifo */
/* decoder fifo */
p_owner
->
b_woken
=
false
;
p_owner
->
p_fifo
=
block_FifoNew
();
p_owner
->
p_fifo
=
block_FifoNew
();
if
(
unlikely
(
p_owner
->
p_fifo
==
NULL
)
)
if
(
unlikely
(
p_owner
->
p_fifo
==
NULL
)
)
{
{
...
@@ -1617,6 +1605,7 @@ static decoder_t * CreateDecoder( vlc_object_t *p_parent,
...
@@ -1617,6 +1605,7 @@ static decoder_t * CreateDecoder( vlc_object_t *p_parent,
p_owner
->
b_flushing
=
false
;
p_owner
->
b_flushing
=
false
;
p_owner
->
b_draining
=
false
;
p_owner
->
b_draining
=
false
;
p_owner
->
b_idle
=
false
;
/* */
/* */
p_owner
->
cc
.
b_supported
=
false
;
p_owner
->
cc
.
b_supported
=
false
;
...
@@ -2125,14 +2114,21 @@ void input_DecoderWait( decoder_t *p_dec )
...
@@ -2125,14 +2114,21 @@ void input_DecoderWait( decoder_t *p_dec )
assert
(
p_owner
->
b_waiting
);
assert
(
p_owner
->
b_waiting
);
vlc_mutex_lock
(
&
p_owner
->
lock
);
vlc_mutex_lock
(
&
p_owner
->
lock
);
vlc_fifo_Lock
(
p_owner
->
p_fifo
);
while
(
!
p_owner
->
b_has_data
)
while
(
!
p_owner
->
b_has_data
)
{
{
vlc_fifo_Lock
(
p_owner
->
p_fifo
);
if
(
p_owner
->
b_idle
)
p_owner
->
b_woken
=
true
;
{
assert
(
vlc_fifo_IsEmpty
(
p_owner
->
p_fifo
)
);
msg_Warn
(
p_dec
,
"can't wait without data to decode"
);
break
;
}
vlc_fifo_Signal
(
p_owner
->
p_fifo
);
vlc_fifo_Signal
(
p_owner
->
p_fifo
);
vlc_fifo_Unlock
(
p_owner
->
p_fifo
);
vlc_fifo_Unlock
(
p_owner
->
p_fifo
);
vlc_cond_wait
(
&
p_owner
->
wait_acknowledge
,
&
p_owner
->
lock
);
vlc_cond_wait
(
&
p_owner
->
wait_acknowledge
,
&
p_owner
->
lock
);
vlc_fifo_Lock
(
p_owner
->
p_fifo
);
}
}
vlc_fifo_Unlock
(
p_owner
->
p_fifo
);
vlc_mutex_unlock
(
&
p_owner
->
lock
);
vlc_mutex_unlock
(
&
p_owner
->
lock
);
}
}
...
...
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