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
ea86f279
Commit
ea86f279
authored
Mar 21, 2015
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
decoder: remove BLOCK_FLAG_CORE_EOS
Do not rely on allocating a block for draining the decoder and output.
parent
2a0ed113
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
20 deletions
+23
-20
src/input/decoder.c
src/input/decoder.c
+23
-19
src/input/decoder.h
src/input/decoder.h
+0
-1
No files found.
src/input/decoder.c
View file @
ea86f279
...
@@ -112,6 +112,7 @@ struct decoder_owner_sys_t
...
@@ -112,6 +112,7 @@ struct decoder_owner_sys_t
/* Flushing */
/* Flushing */
bool
b_flushing
;
bool
b_flushing
;
bool
b_draining
;
/* CC */
/* CC */
struct
struct
...
@@ -1426,14 +1427,23 @@ static void *DecoderThread( void *p_data )
...
@@ -1426,14 +1427,23 @@ 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
);
while
(
vlc_fifo_IsEmpty
(
p_owner
->
p_fifo
)
)
while
(
vlc_fifo_IsEmpty
(
p_owner
->
p_fifo
)
)
{
{
if
(
p_owner
->
b_woken
)
if
(
p_owner
->
b_draining
)
{
/* We have emptied the FIFO and there is a pending request to
* drain. Pass p_block = NULL to decoder just once. */
p_owner
->
b_draining
=
false
;
draining
=
true
;
break
;
break
;
}
if
(
p_owner
->
b_woken
)
break
;
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. */
...
@@ -1446,23 +1456,13 @@ static void *DecoderThread( void *p_data )
...
@@ -1446,23 +1456,13 @@ static void *DecoderThread( void *p_data )
p_owner
->
b_woken
=
false
;
p_owner
->
b_woken
=
false
;
vlc_cleanup_run
();
vlc_cleanup_run
();
if
(
p_block
==
NULL
||
p_block
->
i_flags
&
BLOCK_FLAG_CORE_EOS
)
if
(
p_block
==
NULL
)
DecoderSignalWait
(
p_dec
);
DecoderSignalWait
(
p_dec
);
if
(
p_block
)
if
(
p_block
!=
NULL
||
draining
)
{
{
int
canc
=
vlc_savecancel
();
int
canc
=
vlc_savecancel
();
if
(
p_block
->
i_flags
&
BLOCK_FLAG_CORE_EOS
)
{
/* calling DecoderProcess() with NULL block will make
* decoders/packetizers flush their buffers */
block_Release
(
p_block
);
p_block
=
NULL
;
}
DecoderProcess
(
p_dec
,
p_block
);
DecoderProcess
(
p_dec
,
p_block
);
vlc_restorecancel
(
canc
);
vlc_restorecancel
(
canc
);
}
}
}
}
...
@@ -1616,6 +1616,7 @@ static decoder_t * CreateDecoder( vlc_object_t *p_parent,
...
@@ -1616,6 +1616,7 @@ static decoder_t * CreateDecoder( vlc_object_t *p_parent,
p_owner
->
b_has_data
=
false
;
p_owner
->
b_has_data
=
false
;
p_owner
->
b_flushing
=
false
;
p_owner
->
b_flushing
=
false
;
p_owner
->
b_draining
=
false
;
/* */
/* */
p_owner
->
cc
.
b_supported
=
false
;
p_owner
->
cc
.
b_supported
=
false
;
...
@@ -1920,12 +1921,12 @@ bool input_DecoderIsEmpty( decoder_t * p_dec )
...
@@ -1920,12 +1921,12 @@ bool input_DecoderIsEmpty( decoder_t * p_dec )
*/
*/
void
input_DecoderDrain
(
decoder_t
*
p_dec
)
void
input_DecoderDrain
(
decoder_t
*
p_dec
)
{
{
block_t
*
p_block
=
block_Alloc
(
0
);
decoder_owner_sys_t
*
p_owner
=
p_dec
->
p_owner
;
if
(
unlikely
(
p_block
==
NULL
)
)
return
;
p_block
->
i_flags
|=
BLOCK_FLAG_CORE_EOS
;
vlc_fifo_Lock
(
p_owner
->
p_fifo
);
input_DecoderDecode
(
p_dec
,
p_block
,
false
);
p_owner
->
b_draining
=
true
;
vlc_fifo_Signal
(
p_owner
->
p_fifo
);
vlc_fifo_Unlock
(
p_owner
->
p_fifo
);
}
}
static
void
DecoderFlush
(
decoder_t
*
p_dec
)
static
void
DecoderFlush
(
decoder_t
*
p_dec
)
...
@@ -1934,8 +1935,11 @@ static void DecoderFlush( decoder_t *p_dec )
...
@@ -1934,8 +1935,11 @@ static void DecoderFlush( decoder_t *p_dec )
vlc_assert_locked
(
&
p_owner
->
lock
);
vlc_assert_locked
(
&
p_owner
->
lock
);
vlc_fifo_Lock
(
p_owner
->
p_fifo
);
/* Empty the fifo */
/* Empty the fifo */
block_FifoEmpty
(
p_owner
->
p_fifo
);
block_ChainRelease
(
vlc_fifo_DequeueAllUnlocked
(
p_owner
->
p_fifo
)
);
p_owner
->
b_draining
=
false
;
/* flush supersedes drain */
vlc_fifo_Unlock
(
p_owner
->
p_fifo
);
/* Monitor for flush end */
/* Monitor for flush end */
p_owner
->
b_flushing
=
true
;
p_owner
->
b_flushing
=
true
;
...
...
src/input/decoder.h
View file @
ea86f279
...
@@ -29,7 +29,6 @@
...
@@ -29,7 +29,6 @@
#include <vlc_codec.h>
#include <vlc_codec.h>
#define BLOCK_FLAG_CORE_FLUSH (1 <<BLOCK_FLAG_CORE_PRIVATE_SHIFT)
#define BLOCK_FLAG_CORE_FLUSH (1 <<BLOCK_FLAG_CORE_PRIVATE_SHIFT)
#define BLOCK_FLAG_CORE_EOS (1 <<(BLOCK_FLAG_CORE_PRIVATE_SHIFT + 1))
decoder_t
*
input_DecoderNew
(
input_thread_t
*
,
es_format_t
*
,
input_clock_t
*
,
decoder_t
*
input_DecoderNew
(
input_thread_t
*
,
es_format_t
*
,
input_clock_t
*
,
sout_instance_t
*
)
VLC_USED
;
sout_instance_t
*
)
VLC_USED
;
...
...
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