[vlc-devel] [PATCH 2/3] stream_Demux: handle slave demuxes

Rémi Denis-Courmont remi at remlab.net
Mon Sep 14 14:36:43 CEST 2015


Le 2015-09-14 15:11, Francois Cartegnie a écrit :
> Passive demux requiring SET_NEXT_DEMUX_TIME controls
> are never demuxed through stream_Demux()
> ---
>  src/input/stream_demux.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
>
> diff --git a/src/input/stream_demux.c b/src/input/stream_demux.c
> index e6a104c..a7629b4 100644
> --- a/src/input/stream_demux.c
> +++ b/src/input/stream_demux.c
> @@ -54,6 +54,7 @@ struct stream_sys_t
>          int64_t length;
>          int64_t time;
>      } stats;
> +    mtime_t i_next_demux_time;
>  };
>
>  static ssize_t DStreamRead( stream_t *, void *p_read, size_t i_read 
> );
> @@ -88,6 +89,7 @@ stream_t *stream_DemuxNew( demux_t *p_demux, const
> char *psz_demux, es_out_t *ou
>      p_sys->stats.position = 0.;
>      p_sys->stats.length = 0;
>      p_sys->stats.time = 0;
> +    p_sys->i_next_demux_time = VLC_TS_0 + CLOCK_FREQ / 4;
>
>      /* decoder fifo */
>      if( ( p_sys->p_fifo = block_FifoNew() ) == NULL )
> @@ -289,7 +291,13 @@ static void* DStreamThread( void *obj )
>          }
>
>          if( demux_Demux( p_demux ) <= 0 )
> +        {
>              break;
> +        }
> +        vlc_mutex_lock( &p_sys->lock );

What's the lock for?

> +        demux_Control( p_demux, DEMUX_SET_NEXT_DEMUX_TIME,
> p_sys->i_next_demux_time );
> +        p_sys->i_next_demux_time += CLOCK_FREQ / 4;

That can't work in any meaingful way. DEMUX_SET_NEXT_DEMUX_TIME is 
supposed to make the next demux_Demux() wait for the time to be reached. 
You have no ways to wait here, so this is a useless no-op.

> +        vlc_mutex_unlock( &p_sys->lock );
>      }
>
>      /* Explicit kludge: the stream is destroyed by the owner of the

-- 
Rémi Denis-Courmont
http://www.remlab.net/


More information about the vlc-devel mailing list