[vlc-devel] [PATCH 1/3] stream_demux: add end of data signalling
Francois Cartegnie
fcvlcdev at free.fr
Mon Sep 14 14:11:18 CEST 2015
Some demux thread do Peek() (readline based for ex) more data than will
even be available through fifo. If this happens in demux Open(), no data
will ever be processed.
---
src/input/stream_demux.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/src/input/stream_demux.c b/src/input/stream_demux.c
index e25814c..e6a104c 100644
--- a/src/input/stream_demux.c
+++ b/src/input/stream_demux.c
@@ -39,6 +39,7 @@ struct stream_sys_t
/* Data buffer */
block_fifo_t *p_fifo;
block_t *p_block;
+ bool b_nomoredata;
/* Demuxer */
char *psz_name;
@@ -82,6 +83,7 @@ stream_t *stream_DemuxNew( demux_t *p_demux, const char *psz_demux, es_out_t *ou
p_sys->out = out;
p_sys->p_block = NULL;
+ p_sys->b_nomoredata = false;
p_sys->psz_name = strdup( psz_demux );
p_sys->stats.position = 0.;
p_sys->stats.length = 0;
@@ -169,7 +171,7 @@ static ssize_t DStreamRead( stream_t *s, void *buf, size_t len )
{
stream_sys_t *sys = s->p_sys;
- if( !atomic_load( &sys->active ) )
+ if( !atomic_load( &sys->active ) || sys->b_nomoredata )
return -1;
if( len == 0 )
return 0;
@@ -187,6 +189,9 @@ static ssize_t DStreamRead( stream_t *s, void *buf, size_t len )
if( buf != NULL && copy > 0 )
memcpy( buf, block->p_buffer, copy );
+ if( block->i_flags & BLOCK_FLAG_END_OF_SEQUENCE )
+ sys->b_nomoredata = true;
+
block->p_buffer += copy;
block->i_buffer -= copy;
if( block->i_buffer == 0 )
--
2.4.3
More information about the vlc-devel
mailing list